Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Customers can retrieve reference configuration data from CMDB instead of Ansible. In this example we use force.com CLI for this purpose.

Example
Code Block
languagebash
#!/bin/bash

force="/etc/ansible/scripts/force"
user="user"
password="password"

$force login -u $user -p $password > /dev/null 2>&1
if [[ $? -eq 0 ]]; then
  curvalue=`grep 'app_version' /tmp/ansible-config.conf|awk -F= '{print $2}'|tr -d ' '`
  $force query select Approved_Value__c, Force_Compliance__c from Acme_Cluster_ITIL_CI__c|head -n2|tail -n1|tr -d \" > /etc/ansible/temp/cademo_last_value
  $force record update Acme_Cluster_ITIL_CI__c a9Z36000000GzJ7EAK Reported_Value__c:$curvalue > /dev/null 2>&1
  $force logout -u=cloudaware@cloudaware.net > /dev/null 2>&1
  value=`awk -F, '{print $1}' /etc/ansible/temp/cademo_last_value`
  compliance=`awk -F, '{print $2}' /etc/ansible/temp/cademo_last_value`
  if [[ $compliance == true ]]; then
    echo "$value","$compliance"
  else
    value=`grep 'app_version' /tmp/ansible-config.conf|awk -F= '{print $2}'|tr -d ' '`
    echo "$value","$compliance"
  fi
else
  echo "Cannot login to Salesforce."
fi

...