diff options
| -rw-r--r-- | roles/mariadb/tasks/main.yml | 20 | ||||
| -rw-r--r-- | roles/mariadb/templates/sql.txt | 1 | ||||
| -rw-r--r-- | roles/oam_core/tasks/main.yml | 6 | ||||
| -rwxr-xr-x | roles/setup_mariadb/files/mysql | bin | 0 -> 12185005 bytes | |||
| -rw-r--r-- | roles/setup_mariadb/tasks/main.yml | 17 | ||||
| -rw-r--r-- | roles/setup_mariadb/templates/tsg_threshold.sql.j2 (renamed from roles/mariadb/templates/tsg_threshold.sql.j2) | 0 |
6 files changed, 23 insertions, 21 deletions
diff --git a/roles/mariadb/tasks/main.yml b/roles/mariadb/tasks/main.yml index 5780ad0..57df61a 100644 --- a/roles/mariadb/tasks/main.yml +++ b/roles/mariadb/tasks/main.yml @@ -129,25 +129,5 @@ - name: "set mariadb privileges" shell: mysql -uroot -p{{ mariadb.password }} -e "grant all privileges on *.* to root@'%' identified by '111111' with grant option;" shell: mysql -uroot -p{{ mariadb.password }} -e "flush privileges;" - shell: mysql -uroot -p{{ mariadb.password }} -e "create database tsg_oam" when: return.rc != 0 -- name: "get remote tsg sn" - shell: cat /opt/tsg/etc/tsg_sn.json | grep sn | awk -F "\"" {'print $4'} - register: adc_tsg_sn - when: return.rc != 0 - -- name: "Templates tsg_threshold.sql" - template: - src: "{{role_path}}/templates/tsg_threshold.sql.j2" - dest: /tmp/tsg-cli-deploy/tsg_threshold.sql - tags: template - when: return.rc != 0 - -- name: "debug show tsg_sn" - debug: var=adc_tsg_sn.stdout - when: return.rc != 0 - -- name: "import the sql after template" - shell: mysql -s -h 127.0.0.1 -u {{ mariadb.username }} -p{{ mariadb.password }} < /tmp/tsg-cli-deploy/tsg_threshold.sql - when: return.rc != 0 diff --git a/roles/mariadb/templates/sql.txt b/roles/mariadb/templates/sql.txt deleted file mode 100644 index 234f528..0000000 --- a/roles/mariadb/templates/sql.txt +++ /dev/null @@ -1 +0,0 @@ -mysql -s -h $host -u $user -p$passwd $dbname < tsg_threshold.sql
\ No newline at end of file diff --git a/roles/oam_core/tasks/main.yml b/roles/oam_core/tasks/main.yml index dd54604..7c07a08 100644 --- a/roles/oam_core/tasks/main.yml +++ b/roles/oam_core/tasks/main.yml @@ -24,3 +24,9 @@ template: src: "{{ role_path }}/templates/oam_core.service.j2" dest: /usr/lib/systemd/system/oam_core.service + +- name: "copy /usr/local/bin/mysql to destination server" + copy: + src: "{{ role_path }}/files/mysql" + dest: /usr/local/bin + mode: 0755 diff --git a/roles/setup_mariadb/files/mysql b/roles/setup_mariadb/files/mysql Binary files differnew file mode 100755 index 0000000..f1d99c8 --- /dev/null +++ b/roles/setup_mariadb/files/mysql diff --git a/roles/setup_mariadb/tasks/main.yml b/roles/setup_mariadb/tasks/main.yml new file mode 100644 index 0000000..4ecbb61 --- /dev/null +++ b/roles/setup_mariadb/tasks/main.yml @@ -0,0 +1,17 @@ +- name: "judge tsg_oam" + shell: mysql -uroot -p111111 -e "show databases;" |grep tsg_oam + register: return + ignore_errors: true + +- name: "set tsg_oam database" + shell: mysql -uroot -p{{ mariadb.password }} -e "create database tsg_oam" + when: return.rc != 0 + +- name: "Templates tsg_threshold.sql" + template: + src: "{{role_path}}/templates/tsg_threshold.sql.j2" + dest: /tmp/tsg-cli-deploy/tsg_threshold.sql + tags: template + +- name: "import the sql after template" + shell: mysql -s -h 127.0.0.1 -u {{ mariadb.username }} -p{{ mariadb.password }} < /tmp/tsg-cli-deploy/tsg_threshold.sql diff --git a/roles/mariadb/templates/tsg_threshold.sql.j2 b/roles/setup_mariadb/templates/tsg_threshold.sql.j2 index 8aa2f2d..8aa2f2d 100644 --- a/roles/mariadb/templates/tsg_threshold.sql.j2 +++ b/roles/setup_mariadb/templates/tsg_threshold.sql.j2 |
