From 95ecdb773c9fa90f9e4f1f792f5cc5dc8328fd6a Mon Sep 17 00:00:00 2001 From: chigang Date: Fri, 30 Jun 2017 20:24:25 +0800 Subject: Remove obsoleted code JIRA:- use OpenStack-ansible deploy openstack, so remove obsoleted code. Some of the enhanced features will be added in later versions Change-Id: Ie92b92b5de234a7d7d03b578b0bc15fd0218b3b3 Signed-off-by: chigang --- .../ansible/roles/database/files/remove_user.sh | 14 --- .../adapters/ansible/roles/database/tasks/main.yml | 35 ------- .../roles/database/tasks/mariadb_cluster.yml | 14 --- .../database/tasks/mariadb_cluster_debian.yml | 73 -------------- .../database/tasks/mariadb_cluster_redhat.yml | 71 -------------- .../roles/database/tasks/mariadb_config.yml | 88 ----------------- .../roles/database/tasks/mariadb_install.yml | 75 --------------- .../roles/database/tasks/mongodb_config.yml | 70 -------------- .../roles/database/tasks/mongodb_install.yml | 40 -------- .../ansible/roles/database/templates/data.j2 | 51 ---------- .../ansible/roles/database/templates/mongodb.conf | 6 -- .../ansible/roles/database/templates/my.cnf | 59 ------------ .../ansible/roles/database/templates/replica.js | 8 -- .../ansible/roles/database/templates/wsrep.cnf | 105 --------------------- .../ansible/roles/database/vars/Debian.yml | 55 ----------- .../ansible/roles/database/vars/RedHat.yml | 45 --------- .../adapters/ansible/roles/database/vars/main.yml | 39 -------- 17 files changed, 848 deletions(-) delete mode 100644 deploy/adapters/ansible/roles/database/files/remove_user.sh delete mode 100644 deploy/adapters/ansible/roles/database/tasks/main.yml delete mode 100644 deploy/adapters/ansible/roles/database/tasks/mariadb_cluster.yml delete mode 100644 deploy/adapters/ansible/roles/database/tasks/mariadb_cluster_debian.yml delete mode 100644 deploy/adapters/ansible/roles/database/tasks/mariadb_cluster_redhat.yml delete mode 100644 deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml delete mode 100644 deploy/adapters/ansible/roles/database/tasks/mariadb_install.yml delete mode 100755 deploy/adapters/ansible/roles/database/tasks/mongodb_config.yml delete mode 100755 deploy/adapters/ansible/roles/database/tasks/mongodb_install.yml delete mode 100644 deploy/adapters/ansible/roles/database/templates/data.j2 delete mode 100644 deploy/adapters/ansible/roles/database/templates/mongodb.conf delete mode 100644 deploy/adapters/ansible/roles/database/templates/my.cnf delete mode 100644 deploy/adapters/ansible/roles/database/templates/replica.js delete mode 100644 deploy/adapters/ansible/roles/database/templates/wsrep.cnf delete mode 100644 deploy/adapters/ansible/roles/database/vars/Debian.yml delete mode 100644 deploy/adapters/ansible/roles/database/vars/RedHat.yml delete mode 100644 deploy/adapters/ansible/roles/database/vars/main.yml (limited to 'deploy/adapters/ansible/roles/database') diff --git a/deploy/adapters/ansible/roles/database/files/remove_user.sh b/deploy/adapters/ansible/roles/database/files/remove_user.sh deleted file mode 100644 index dc0b43fa..00000000 --- a/deploy/adapters/ansible/roles/database/files/remove_user.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/bin/sh -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## - -mysql -uroot -Dmysql < - service mysql bootstrap; - service mysql start; - when: | - inventory_hostname == haproxy_hosts.keys()[0] - 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}' - register: cluster_status - until: cluster_status|success - failed_when: not cluster_status.stdout | search("OPERATIONAL") - retries: 10 - delay: 3 - when: | - inventory_hostname == haproxy_hosts.keys()[0] - 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}' - register: cluster_nodes - changed_when: false - -- name: restart other nodes and join cluster1 - shell: service mysql restart; - when: | - inventory_hostname != haproxy_hosts.keys()[0] - and not cluster_nodes.stdout | search( "{{ internal_ip }}" ) - ignore_errors: "True" - -- name: delay 60 seconds - shell: sleep 60 - -- name: restart other nodes and join cluster2 - shell: service mysql restart; - when: | - inventory_hostname != haproxy_hosts.keys()[0] - and not cluster_nodes.stdout | search( "{{ internal_ip }}" ) - -- name: chmod directory - shell: > - 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] - 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 deleted file mode 100644 index 77b18702..00000000 --- a/deploy/adapters/ansible/roles/database/tasks/mariadb_cluster_redhat.yml +++ /dev/null @@ -1,71 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -- name: Register RECOVERY - set_fact: RECOVERY_ENV={{RECOVERY_ENV | default('False')}} - -- name: killall mysqld processes - shell: sudo killall -9 mysqld - when: RECOVERY_ENV - ignore_errors: "True" - -- name: get cluster status - 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] - -- name: start first node to create new cluster - shell: service mysql start --wsrep-new-cluster - when: | - inventory_hostname == haproxy_hosts.keys()[0] - 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}' - register: cluster_status - until: cluster_status|success - failed_when: not cluster_status.stdout | search("OPERATIONAL") - retries: 10 - delay: 3 - when: | - inventory_hostname == haproxy_hosts.keys()[0] - 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}' - register: cluster_nodes - changed_when: false - -- name: restart other nodes and join cluster - service: - name: mysql - state: restarted - enabled: "yes" - when: | - inventory_hostname != haproxy_hosts.keys()[0] - and not cluster_nodes.stdout | search( "{{ internal_ip }}") - -- name: remove unused user - script: remove_user.sh - when: ansible_os_family == "RedHat" - -- name: restart first nodes - service: - name: mysql - state: restarted - when: | - 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 deleted file mode 100644 index 22b5d60c..00000000 --- a/deploy/adapters/ansible/roles/database/tasks/mariadb_config.yml +++ /dev/null @@ -1,88 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -- name: create all needed db - mysql_db: - login_unix_socket=/var/run/mysqld/mysqld.sock - name={{ item.db }} - state=present - with_items: "{{ credentials }}" - tags: - - test_db - -- name: create service db user - mysql_user: - login_unix_socket=/var/run/mysqld/mysqld.sock - name={{ item[0].user }} - password={{ item[0].password }} - priv=*.*:ALL,GRANT - host={{ item[1] }} - state=present - with_nested: - - "{{ credentials }}" - - ['%', 'localhost'] - tags: - - test_user - -- name: create wsrep db user - mysql_user: - login_unix_socket=/var/run/mysqld/mysqld.sock - name={{ WSREP_SST_USER }} - password={{ WSREP_SST_PASS }} - priv=*.*:ALL,GRANT - host={{ item }} - state=present - with_items: ['%', 'localhost'] - -- name: remove unused user - script: remove_user.sh - when: ansible_os_family == "RedHat" - -- name: restart mysql for centos noha - service: - name: mysql - state: restarted - when: > - inventory_hostname == haproxy_hosts.keys()[0] - and haproxy_hosts|length == 1 - and ansible_os_family == "RedHat" - -- name: restart mysql second time for centos noha - service: - name: mysql - state: restarted - when: > - inventory_hostname == haproxy_hosts.keys()[0] - and haproxy_hosts|length == 1 - and ansible_os_family == "RedHat" - -- name: restart first nodes - service: - name: mysql - state: restarted - when: inventory_hostname == haproxy_hosts.keys()[0] - and haproxy_hosts|length > 1 - -- name: wait for cluster ready - command: mysql -e"show status like 'wsrep%'" - register: cluster_status - until: cluster_status|success - failed_when: not cluster_status.stdout | search("ON") - retries: 10 - delay: 3 - when: - - inventory_hostname == haproxy_hosts.keys()[0] - -- name: restart other nodes - service: - name: mysql - state: restarted - 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 deleted file mode 100644 index ba800dca..00000000 --- a/deploy/adapters/ansible/roles/database/tasks/mariadb_install.yml +++ /dev/null @@ -1,75 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -- name: disable auto start - copy: - content: "#!/bin/sh\nexit 101" - dest: "/usr/sbin/policy-rc.d" - mode: 0755 - when: ansible_os_family == "Debian" - -- name: change open file limit - copy: - content: "* - nofile 65536 }}" - dest: "/etc/security/limits.conf" - mode: 0755 - -- name: install python-mysqldb - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: "{{ maridb_packages | union(packages_noarch) }}" - -- name: create conf dir for wsrep - file: path=/etc/my.cnf.d state=directory mode=0755 - when: ansible_os_family == "RedHat" - -- name: update mariadb config file - template: - src: '{{ item.src }}' - dest: '{{ item.dest }}' - backup: "yes" - mode: 0644 - with_items: "{{ mysql_config }}" - -- name: bugfix for rsync version 3.1 - lineinfile: - dest: /usr/bin/wsrep_sst_rsync - state: absent - regexp: '{{ item }}' - with_items: - - "\\s*uid = \\$MYUID$" - - "\\s*gid = \\$MYGID$" - -- name: enable auto start - file: - path=/usr/sbin/policy-rc.d - state=absent - when: ansible_os_family == "Debian" - -- name: set owner - 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' - register: logfile_stat - -- debug: msg='{{ logfile_stat.stat.exists}}' -- debug: msg='{{ logfile_stat.stat.size }}' - when: logfile_stat.stat.exists - -- name: rm logfile if exist and size mismatch - shell: 'rm -rf {{ mysql_data_dir }}/ib_logfile*' - 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 deleted file mode 100755 index 10f0322c..00000000 --- a/deploy/adapters/ansible/roles/database/tasks/mongodb_config.yml +++ /dev/null @@ -1,70 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -- name: copy mongo js - template: - src: '{{ item.src }}' - dest: '{{ item.dest }}' - with_items: - - src: replica.js - dest: /opt/replica.js - -- name: init replica servers - 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 - register: servers - until: servers.stdout|int == {{ haproxy_hosts|length }} - retries: 60 - delay: 10 - -- debug: msg='{{ servers.stdout |int }}' - -- name: wait replica servers are ready - shell: mongo compass --eval 'printjson(rs.status())'|grep -E 'PRIMARY'|wc -l - register: servers - until: servers.stdout|int == 1 - retries: 60 - delay: 10 - -- debug: msg='{{ servers.stdout |int }}' - -- name: Add admin user - mongodb_user: - login_host: "{{ internal_vip.ip }}" - database: admin - name: root - password: root - roles: 'root' - state: present - -- name: create mongodb user and db - mongodb_user: - login_host: "{{ internal_vip.ip }}" - login_user: root - login_password: root - database: ceilometer - name: ceilometer - password: "{{ CEILOMETER_DBPASS }}" - roles: 'readWrite,dbAdmin' - state: present - -- name: grant user privilege - mongodb_user: - login_host: "{{ internal_vip.ip }}" - login_user: root - login_password: root - database: ceilometer - name: ceilometer - password: "{{ CEILOMETER_DBPASS }}" - roles: 'readWrite,dbAdmin' - state: present diff --git a/deploy/adapters/ansible/roles/database/tasks/mongodb_install.yml b/deploy/adapters/ansible/roles/database/tasks/mongodb_install.yml deleted file mode 100755 index 67bc0499..00000000 --- a/deploy/adapters/ansible/roles/database/tasks/mongodb_install.yml +++ /dev/null @@ -1,40 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -- name: install mongodb packages - action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" - with_items: "{{ mongodb_packages | union(packages_noarch) }}" - -- name: install pymongod packages - pip: name={{ item }} state=present extra_args='--pre' - with_items: "{{ pip_packages }}" - -- name: copy ceilometer configs - 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 - -- name: rm prealloc files - file: - dest: "{{ item }}" - state: absent - with_fileglob: - - "{{ mongodb_config.journal }}" - -- name: manually restart mongodb server - service: name={{ mongodb_service }} state=restarted enabled=yes - ignore_errors: true - -- name: write mongodb to monitor list - lineinfile: dest=/opt/service create=yes line={{ mongodb_service}} - -- name: wait for mongod ready - wait_for: host=0.0.0.0 port=27017 delay=10 diff --git a/deploy/adapters/ansible/roles/database/templates/data.j2 b/deploy/adapters/ansible/roles/database/templates/data.j2 deleted file mode 100644 index 66c2fead..00000000 --- a/deploy/adapters/ansible/roles/database/templates/data.j2 +++ /dev/null @@ -1,51 +0,0 @@ -#!/bin/sh -mysql -uroot -Dmysql <[:port] of the node. -# The values supplied will be used as defaults for state transfer receiving, -# listening ports and so on. Default: address of the first network interface. -wsrep_node_address={{ internal_ip }} - -# Address for incoming client connections. Autodetect by default. -#wsrep_node_incoming_address= - -# How many threads will process writesets from other nodes -wsrep_slave_threads={{ ansible_processor_vcpus }} - -# DBUG options for wsrep provider -#wsrep_dbug_option - -# Generate fake primary keys for non-PK tables (required for multi-master -# and parallel applying operation) -wsrep_certify_nonPK=1 - -# Maximum number of rows in write set -wsrep_max_ws_rows=131072 - -# Maximum size of write set -wsrep_max_ws_size=1073741824 - -# to enable debug level logging, set this to 1 -wsrep_debug=1 - -# convert locking sessions into transactions -wsrep_convert_LOCK_to_trx=0 - -# how many times to retry deadlocked autocommits -wsrep_retry_autocommit=3 - -# change auto_increment_increment and auto_increment_offset automatically -wsrep_auto_increment_control=1 - -# retry autoinc insert, which failed for duplicate key error -wsrep_drupal_282555_workaround=0 - -# enable "strictly synchronous" semantics for read operations -wsrep_causal_reads=0 - -# Command to call when node status or cluster membership changes. -# Will be passed all or some of the following options: -# --status - new status of this node -# --uuid - UUID of the cluster -# --primary - whether the component is primary or not ("yes"/"no") -# --members - comma-separated list of members -# --index - index of this node in the list -wsrep_notify_cmd= - -## -## WSREP State Transfer options -## - -# State Snapshot Transfer method -wsrep_sst_method=rsync - -# Address on THIS node to receive SST at. DON'T SET IT TO DONOR ADDRESS!!! -# (SST method dependent. Defaults to the first IP of the first interface) -#wsrep_sst_receive_address= - -# SST authentication string. This will be used to send SST to joining nodes. -# Depends on SST method. For mysqldump method it is root: -wsrep_sst_auth={{ WSREP_SST_USER }}:{{ WSREP_SST_PASS }} - -# Desired SST donor name. -#wsrep_sst_donor= - -# Protocol version to use -# wsrep_protocol_version= diff --git a/deploy/adapters/ansible/roles/database/vars/Debian.yml b/deploy/adapters/ansible/roles/database/vars/Debian.yml deleted file mode 100644 index c657f62e..00000000 --- a/deploy/adapters/ansible/roles/database/vars/Debian.yml +++ /dev/null @@ -1,55 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -mongodb_packages: - - 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 - - socat - - mariadb-galera-server-10.0 - - python-mysqldb - -pip_packages: [] - -services: [] - -mongodb_service: mongodb -mysql_config: - - dest: /etc/mysql/my.cnf - src: my.cnf - - dest: /etc/mysql/conf.d/wsrep.cnf - src: wsrep.cnf - -mysql_config_dir: /etc/mysql/conf.d -mysql_data_dir: /var/lib/mysql - -mongodb_config: - dest: /etc/mongodb.conf - src: mongodb.conf - journal: /var/lib/mongodb/journal/* - -wsrep_provider_file: "/usr/lib/galera/libgalera_smm.so" diff --git a/deploy/adapters/ansible/roles/database/vars/RedHat.yml b/deploy/adapters/ansible/roles/database/vars/RedHat.yml deleted file mode 100644 index 62f331c7..00000000 --- a/deploy/adapters/ansible/roles/database/vars/RedHat.yml +++ /dev/null @@ -1,45 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -mysql_packages: - - MySQL-python - - mysql-server - -maridb_packages: - - MySQL-python - - MariaDB-Galera-server - - MariaDB-client - - galera - -mongodb_packages: - - mongo-10gen-server - - mongo-10gen - -pip_packages: - - pymongo - -services: [] - -mongodb_service: mongod - -mysql_config: - - dest: /etc/my.cnf - src: my.cnf - - dest: /etc/my.cnf.d/wsrep.cnf - src: wsrep.cnf - -mysql_config_dir: /etc/my.cnf.d -mysql_data_dir: /var/lib/mysql - -mongodb_config: - dest: /etc/mongod.conf - src: mongodb.conf - journal: /var/lib/mongo/journal/* - -wsrep_provider_file: "/usr/lib64/galera/libgalera_smm.so" diff --git a/deploy/adapters/ansible/roles/database/vars/main.yml b/deploy/adapters/ansible/roles/database/vars/main.yml deleted file mode 100644 index a32897f0..00000000 --- a/deploy/adapters/ansible/roles/database/vars/main.yml +++ /dev/null @@ -1,39 +0,0 @@ -############################################################################## -# Copyright (c) 2016 HUAWEI TECHNOLOGIES CO.,LTD and others. -# -# All rights reserved. This program and the accompanying materials -# are made available under the terms of the Apache License, Version 2.0 -# which accompanies this distribution, and is available at -# http://www.apache.org/licenses/LICENSE-2.0 -############################################################################## ---- -packages_noarch: [] - -services_noarch: - - mysql - -credentials: - - user: keystone - db: keystone - password: "{{ KEYSTONE_DBPASS }}" - - user: neutron - db: neutron - password: "{{ NEUTRON_DBPASS }}" - - user: glance - db: glance - password: "{{ GLANCE_DBPASS }}" - - user: nova - db: nova_api - password: "{{ NOVA_DBPASS }}" - - user: nova - db: nova - password: "{{ NOVA_DBPASS }}" - - user: cinder - db: cinder - password: "{{ CINDER_DBPASS }}" - - user: heat - db: heat - password: "{{ HEAT_DBPASS }}" - - user: aodh - db: aodh - password: "{{ AODH_DBPASS }}" -- cgit 1.2.3-korg