cobar.config.yml
1.57 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
---
# config cobar and reload
# fetching cobar user and password from hashicorp vault
- hosts: cobar-server
remote_user: root
vars_files:
- extra_vars/all.yml
vars:
cobar: "{{ lookup('hashi_vault', 'secret=yoho/ops/cobar token='+'{{vault.token}}'+' url='+'{{vault.server}}', errors='ignore') }}"
vars_prompt:
- name: "confirmation"
prompt: "Config and reload cobar. Please Enter YES to continue"
private: no
tasks:
- name: copy rule.xml
template:
src: cobar/rule.xml
dest: /home/master/cobar-server/conf
owner: master
group: master
backup: yes
- name: copy schemal.xml
template:
src: cobar/schema.xml
dest: /home/master/cobar-server/conf
owner: master
group: master
backup: yes
- name: copy server.xml
template:
src: cobar/server.xml
dest: /home/master/cobar-server/conf
owner: master
group: master
backup: yes
- 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