ansible playbook to deploy galera cluster code example

Example 1: ansible example playbook

---
- name: update web servers
  hosts: webservers
  remote_user: root

  tasks:
  - name: ensure apache is at the latest version
    yum:
      name: httpd
      state: latest
  - name: write the apache config file
    template:
      src: /srv/httpd.j2
      dest: /etc/httpd.conf

- name: update db servers
  hosts: databases
  remote_user: root

  tasks:
  - name: ensure postgresql is at the latest version
    yum:
      name: postgresql
      state: latest
  - name: ensure that postgresql is started
    service:
      name: postgresql
      state: started

Example 2: ansible playbook post deployment

ps -aef|grep ClientProvision.exe
if it is running we can go & check in logs as well
cd /opt/Logs/dmApp
current hour application log we can grep & see printing in logs
date=date '+%d-%m-%y_%H_'
cat ClientProv_30xcf_$date *.log |grep "Loading InRoamer Details.."
if it is returing result as below we can ensure it is up & running fine
[InRoamer.cpp|00040|05:06:34:396|DG]Loading InRoamer Details
date=date '+%d_%m_%Y_05_'
#echo $date
cd /opt/Logs/dmApp
logfile=ClientProv_30xcf_$date*.log
#echo $logfile
cat $logfile |grep "Loading InRoamer Details.."