cobar.reload.yml
1017 Bytes
---
# reload cobar server for mysql backend changed?
# fetching cobar user and password from hashicorp vault
- hosts: cobar-server
remote_user: root
vars:
cobar: "{{ lookup('hashi_vault', 'secret=yoho/ops/cobar token=6GbUnoyubwn2nJgaehFaUPH3 url=http://10.66.107.2:8200') }}"
vars_prompt:
- name: "confirmation"
prompt: "Reload cobar. Please Enter YES to continue"
private: no
tasks:
- name: install mysql client
yum: name=mysql state=present
- name: --COBAR-- Checking cobar status
command: /home/master/cobar-server/bin/switch.sh status
become: true
become_method: sudo
become_user: master
register: cobar_status
failed_when: cobar_status.rc != 0
changed_when: False
- name: --COBAR-- Reloading cobar
command: /usr/bin/mysql -h 127.0.0.1 -u{{cobar.user}} -p"{{ cobar.password }}" -P 9066 -e "reload @@config"
register: cobar_reload
failed_when: cobar_reload.rc != 0
changed_when: cobar_reload.rc == 0