summaryrefslogtreecommitdiffstats
path: root/deploy/adapters/ansible/roles/database
diff options
context:
space:
mode:
Diffstat (limited to 'deploy/adapters/ansible/roles/database')
-rw-r--r--deploy/adapters/ansible/roles/database/tasks/mariadb_cluster_debian.yml24
-rw-r--r--deploy/adapters/ansible/roles/database/tasks/mariadb_cluster_redhat.yml20
-rw-r--r--deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml11
-rw-r--r--deploy/adapters/ansible/roles/database/tasks/mariadb_install.yml11
-rwxr-xr-xdeploy/adapters/ansible/roles/database/tasks/mongodb_config.yml4
-rwxr-xr-xdeploy/adapters/ansible/roles/database/tasks/mongodb_install.yml3
-rw-r--r--deploy/adapters/ansible/roles/database/vars/Debian.yml30
7 files changed, 61 insertions, 42 deletions
diff --git a/deploy/adapters/ansible/roles/database/tasks/mariadb_cluster_debian.yml b/deploy/adapters/ansible/roles/database/tasks/mariadb_cluster_debian.yml
index 442cd18b..9752b550 100644
--- a/deploy/adapters/ansible/roles/database/tasks/mariadb_cluster_debian.yml
+++ b/deploy/adapters/ansible/roles/database/tasks/mariadb_cluster_debian.yml
@@ -8,7 +8,9 @@
##############################################################################
---
- name: get cluster status
- shell: mysql --silent --skip-column-names -e 'SHOW STATUS LIKE "wsrep_evs_state"'|awk '{print $2}'
+ shell: |
+ mysql --silent --skip-column-names -e 'SHOW STATUS LIKE "wsrep_evs_state"' \
+ | awk '{print $2}'
register: cluster_status
when:
- inventory_hostname == haproxy_hosts.keys()[0]
@@ -22,7 +24,9 @@
and not cluster_status.stdout | search("OPERATIONAL")
- name: wait for cluster ready
- shell: mysql --silent --skip-column-names -e 'SHOW STATUS LIKE "wsrep_evs_state"'|awk '{print $2}'
+ shell: |
+ mysql --silent --skip-column-names -e 'SHOW STATUS LIKE "wsrep_evs_state"' \
+ | awk '{print $2}'
register: cluster_status
until: cluster_status|success
failed_when: not cluster_status.stdout | search("OPERATIONAL")
@@ -33,7 +37,9 @@
and not cluster_status.stdout | search("OPERATIONAL")
- name: if I in the cluster nodes
- shell: mysql --silent --skip-column-names -e 'SHOW STATUS LIKE "wsrep_incoming_addresses"'|awk '{print $2}'
+ shell: |
+ mysql --silent --skip-column-names \
+ -e 'SHOW STATUS LIKE "wsrep_incoming_addresses"' | awk '{print $2}'
register: cluster_nodes
changed_when: false
@@ -42,7 +48,7 @@
when: |
inventory_hostname != haproxy_hosts.keys()[0]
and not cluster_nodes.stdout | search( "{{ internal_ip }}" )
- ignore_errors: True
+ ignore_errors: "True"
- name: delay 60 seconds
shell: sleep 60
@@ -55,15 +61,13 @@
- name: chmod directory
shell: >
- chmod 755 -R /var/lib/mysql/ ;
- chmod 755 -R /var/log/mysql/ ;
- chmod 755 -R /etc/mysql/conf.d/;
+ chmod 755 -R /var/lib/mysql/;
+ chmod 755 -R /var/log/mysql/;
+ chmod 755 -R /etc/mysql/conf.d/;
- name: restart first nodes
shell: service mysql restart
when: |
- (inventory_hostname == haproxy_hosts.keys()[0]
+ (inventory_hostname == haproxy_hosts.keys()[0]
and haproxy_hosts|length > 1
and not cluster_nodes.stdout | search( '{{ internal_ip }}' ))
-
-
diff --git a/deploy/adapters/ansible/roles/database/tasks/mariadb_cluster_redhat.yml b/deploy/adapters/ansible/roles/database/tasks/mariadb_cluster_redhat.yml
index cfd778f1..77b18702 100644
--- a/deploy/adapters/ansible/roles/database/tasks/mariadb_cluster_redhat.yml
+++ b/deploy/adapters/ansible/roles/database/tasks/mariadb_cluster_redhat.yml
@@ -13,10 +13,12 @@
- name: killall mysqld processes
shell: sudo killall -9 mysqld
when: RECOVERY_ENV
- ignore_errors: True
+ ignore_errors: "True"
- name: get cluster status
- shell: mysql --silent --skip-column-names -e 'SHOW STATUS LIKE "wsrep_evs_state"'|awk '{print $2}'
+ shell: |
+ mysql --silent --skip-column-names -e 'SHOW STATUS LIKE "wsrep_evs_state"' \
+ | awk '{print $2}'
register: cluster_status
when:
- inventory_hostname == haproxy_hosts.keys()[0]
@@ -28,7 +30,9 @@
and not cluster_status.stdout | search("OPERATIONAL")
- name: wait for cluster ready
- shell: mysql --silent --skip-column-names -e 'SHOW STATUS LIKE "wsrep_evs_state"'|awk '{print $2}'
+ shell: |
+ mysql --silent --skip-column-names -e 'SHOW STATUS LIKE "wsrep_evs_state"' \
+ | awk '{print $2}'
register: cluster_status
until: cluster_status|success
failed_when: not cluster_status.stdout | search("OPERATIONAL")
@@ -39,7 +43,9 @@
and not cluster_status.stdout | search("OPERATIONAL")
- name: if I in the cluster nodes
- shell: mysql --silent --skip-column-names -e 'SHOW STATUS LIKE "wsrep_incoming_addresses"'|awk '{print $2}'
+ shell: |
+ mysql --silent --skip-column-names \
+ -e 'SHOW STATUS LIKE "wsrep_incoming_addresses"' | awk '{print $2}'
register: cluster_nodes
changed_when: false
@@ -47,7 +53,7 @@
service:
name: mysql
state: restarted
- enabled: yes
+ enabled: "yes"
when: |
inventory_hostname != haproxy_hosts.keys()[0]
and not cluster_nodes.stdout | search( "{{ internal_ip }}")
@@ -61,7 +67,5 @@
name: mysql
state: restarted
when: |
- inventory_hostname == haproxy_hosts.keys()[0]
+ inventory_hostname == haproxy_hosts.keys()[0]
and haproxy_hosts|length > 1
-
-
diff --git a/deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml b/deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml
index 780fc322..22b5d60c 100644
--- a/deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml
+++ b/deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml
@@ -8,7 +8,10 @@
##############################################################################
---
- name: create all needed db
- mysql_db: login_unix_socket=/var/run/mysqld/mysqld.sock name={{ item.db }} state=present
+ mysql_db:
+ login_unix_socket=/var/run/mysqld/mysqld.sock
+ name={{ item.db }}
+ state=present
with_items: "{{ credentials }}"
tags:
- test_db
@@ -63,7 +66,8 @@
service:
name: mysql
state: restarted
- when: inventory_hostname == haproxy_hosts.keys()[0] and haproxy_hosts|length > 1
+ when: inventory_hostname == haproxy_hosts.keys()[0]
+ and haproxy_hosts|length > 1
- name: wait for cluster ready
command: mysql -e"show status like 'wsrep%'"
@@ -79,7 +83,6 @@
service:
name: mysql
state: restarted
- enabled: yes
+ enabled: "yes"
when:
- inventory_hostname != haproxy_hosts.keys()[0]
-
diff --git a/deploy/adapters/ansible/roles/database/tasks/mariadb_install.yml b/deploy/adapters/ansible/roles/database/tasks/mariadb_install.yml
index d1897173..ba800dca 100644
--- a/deploy/adapters/ansible/roles/database/tasks/mariadb_install.yml
+++ b/deploy/adapters/ansible/roles/database/tasks/mariadb_install.yml
@@ -32,7 +32,7 @@
template:
src: '{{ item.src }}'
dest: '{{ item.dest }}'
- backup: yes
+ backup: "yes"
mode: 0644
with_items: "{{ mysql_config }}"
@@ -52,7 +52,13 @@
when: ansible_os_family == "Debian"
- name: set owner
- file: path=/var/lib/mysql owner=mysql group=mysql recurse=yes state=directory mode=0755
+ file:
+ path: /var/lib/mysql
+ owner: mysql
+ group: mysql
+ recurse: "yes"
+ state: directory
+ mode: 0755
- name: get logfile stat
stat: path='{{ mysql_data_dir }}/ib_logfile0'
@@ -67,4 +73,3 @@
when: |
logfile_stat.stat.exists
and logfile_stat.stat.size != 1073741824
-
diff --git a/deploy/adapters/ansible/roles/database/tasks/mongodb_config.yml b/deploy/adapters/ansible/roles/database/tasks/mongodb_config.yml
index 76aa5675..10f0322c 100755
--- a/deploy/adapters/ansible/roles/database/tasks/mongodb_config.yml
+++ b/deploy/adapters/ansible/roles/database/tasks/mongodb_config.yml
@@ -19,7 +19,9 @@
shell: mongo compass /opt/replica.js
- name: wait replica servers are ready
- shell: mongo compass --eval 'printjson(rs.status())'|grep -E 'PRIMARY|SECONDARY'|wc -l
+ shell: |
+ mongo compass --eval 'printjson(rs.status())'| \
+ grep -E 'PRIMARY|SECONDARY'| wc -l
register: servers
until: servers.stdout|int == {{ haproxy_hosts|length }}
retries: 60
diff --git a/deploy/adapters/ansible/roles/database/tasks/mongodb_install.yml b/deploy/adapters/ansible/roles/database/tasks/mongodb_install.yml
index bac6c6eb..67bc0499 100755
--- a/deploy/adapters/ansible/roles/database/tasks/mongodb_install.yml
+++ b/deploy/adapters/ansible/roles/database/tasks/mongodb_install.yml
@@ -19,7 +19,8 @@
template: src=mongodb.conf dest=/opt/os_templates backup=yes
- name: update mongodb config file
- shell: crudini --merge {{ mongodb_config.dest }} < /opt/os_templates/mongodb.conf
+ shell: |
+ crudini --merge {{ mongodb_config.dest }} < /opt/os_templates/mongodb.conf
- name: rm prealloc files
file:
diff --git a/deploy/adapters/ansible/roles/database/vars/Debian.yml b/deploy/adapters/ansible/roles/database/vars/Debian.yml
index 1021524d..c657f62e 100644
--- a/deploy/adapters/ansible/roles/database/vars/Debian.yml
+++ b/deploy/adapters/ansible/roles/database/vars/Debian.yml
@@ -8,27 +8,27 @@
##############################################################################
---
mongodb_packages:
- - mongodb-server
- - mongodb-clients
- - python-pymongo
+ - mongodb-server
+ - mongodb-clients
+ - python-pymongo
mysql_packages:
- python-mysqldb
- mysql-server
maridb_packages:
- - apt-transport-https
- - debconf-utils
- - libaio1
- - libc6
- - libdbd-mysql-perl
- - libgcc1
- - libgcrypt20
- - libstdc++6
- - python-software-properties
- - mariadb-client
- - galera-3
- - rsync
+ - apt-transport-https
+ - debconf-utils
+ - libaio1
+ - libc6
+ - libdbd-mysql-perl
+ - libgcc1
+ - libgcrypt20
+ - libstdc++6
+ - python-software-properties
+ - mariadb-client
+ - galera-3
+ - rsync
- socat
- mariadb-galera-server-10.0
- python-mysqldb