Merge "Refactor Designate and Panko bootstrap.yml"
This commit is contained in:
commit
c108c5e604
@ -1,79 +1,40 @@
|
|||||||
---
|
---
|
||||||
- name: Creating Designate database
|
- name: Creating Designate databases
|
||||||
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
|
kolla_toolbox:
|
||||||
-m mysql_db
|
module_name: mysql_db
|
||||||
-a "login_host='{{ database_address }}'
|
module_args:
|
||||||
login_port='{{ database_port }}'
|
login_host: "{{ database_address }}"
|
||||||
login_user='{{ database_user }}'
|
login_port: "{{ database_port }}"
|
||||||
login_password='{{ database_password }}'
|
login_user: "{{ database_user }}"
|
||||||
name='{{ designate_database_name }}'"
|
login_password: "{{ database_password }}"
|
||||||
|
name: "{{ item }}"
|
||||||
register: database
|
register: database
|
||||||
changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and
|
|
||||||
(database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
|
|
||||||
failed_when: database.stdout.split()[2] != 'SUCCESS'
|
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['designate-central'][0] }}"
|
delegate_to: "{{ groups['designate-central'][0] }}"
|
||||||
|
with_items:
|
||||||
|
- "{{ designate_database_name }}"
|
||||||
|
- "{{ designate_pool_manager_database_name }}"
|
||||||
|
|
||||||
- name: Reading json from variable
|
- name: Creating Designate databases user and setting permissions
|
||||||
set_fact:
|
kolla_toolbox:
|
||||||
database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
|
module_name: mysql_user
|
||||||
|
module_args:
|
||||||
- name: Creating Designate Pool Manager database
|
login_host: "{{ database_address }}"
|
||||||
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
|
login_port: "{{ database_port }}"
|
||||||
-m mysql_db
|
login_user: "{{ database_user }}"
|
||||||
-a "login_host='{{ database_address }}'
|
login_password: "{{ database_password }}"
|
||||||
login_port='{{ database_port }}'
|
name: "{{ item.database_name }}"
|
||||||
login_user='{{ database_user }}'
|
password: "{{ item.database_password }}"
|
||||||
login_password='{{ database_password }}'
|
host: "%"
|
||||||
name='{{ designate_pool_manager_database_name }}'"
|
priv: "{{ item.database_name }}.*:ALL"
|
||||||
register: database_pool_manager
|
append_privs: "yes"
|
||||||
changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and
|
|
||||||
(database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
|
|
||||||
failed_when: database.stdout.split()[2] != 'SUCCESS'
|
|
||||||
run_once: True
|
|
||||||
delegate_to: "{{ groups['designate-central'][0] }}"
|
|
||||||
|
|
||||||
- name: Reading json from variable
|
|
||||||
set_fact:
|
|
||||||
database_pool_manager_created: "{{ (database_pool_manager.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
|
|
||||||
|
|
||||||
- name: Creating Designate database user and setting permissions
|
|
||||||
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
|
|
||||||
-m mysql_user
|
|
||||||
-a "login_host='{{ database_address }}'
|
|
||||||
login_port='{{ database_port }}'
|
|
||||||
login_user='{{ database_user }}'
|
|
||||||
login_password='{{ database_password }}'
|
|
||||||
name='{{ designate_database_name }}'
|
|
||||||
password='{{ designate_database_password }}'
|
|
||||||
host='%'
|
|
||||||
priv='{{ designate_database_name }}.*:ALL'
|
|
||||||
append_privs='yes'"
|
|
||||||
register: database_user_create
|
|
||||||
changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and
|
|
||||||
(database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
|
|
||||||
failed_when: database_user_create.stdout.split()[2] != 'SUCCESS'
|
|
||||||
run_once: True
|
|
||||||
delegate_to: "{{ groups['designate-central'][0] }}"
|
|
||||||
|
|
||||||
- name: Creating Designate Pool Manager database user and setting permissions
|
|
||||||
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
|
|
||||||
-m mysql_user
|
|
||||||
-a "login_host='{{ database_address }}'
|
|
||||||
login_port='{{ database_port }}'
|
|
||||||
login_user='{{ database_user }}'
|
|
||||||
login_password='{{ database_password }}'
|
|
||||||
name='{{ designate_pool_manager_database_name }}'
|
|
||||||
password='{{ designate_pool_manager_database_password }}'
|
|
||||||
host='%'
|
|
||||||
priv='{{ designate_pool_manager_database_name }}.*:ALL'
|
|
||||||
append_privs='yes'"
|
|
||||||
register: database_pool_manager_user_create
|
|
||||||
changed_when: "{{ database_pool_manager_user_create.stdout.find('localhost | SUCCESS => ') != -1 and
|
|
||||||
(database_pool_manager_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
|
|
||||||
failed_when: database_pool_manager_user_create.stdout.split()[2] != 'SUCCESS'
|
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['designate-central'][0] }}"
|
delegate_to: "{{ groups['designate-central'][0] }}"
|
||||||
|
with_items:
|
||||||
|
- database_name: "{{ designate_database_name }}"
|
||||||
|
database_password: "{{ designate_database_password }}"
|
||||||
|
- database_name: "{{ designate_pool_manager_database_name }}"
|
||||||
|
database_password: "{{ designate_pool_manager_database_password }}"
|
||||||
|
|
||||||
- include: bootstrap_service.yml
|
- include: bootstrap_service.yml
|
||||||
when: database_created
|
when: database.changed
|
||||||
|
@ -10,60 +10,38 @@
|
|||||||
when:
|
when:
|
||||||
- panko_database_type == "mongodb"
|
- panko_database_type == "mongodb"
|
||||||
|
|
||||||
- name: Checking Panko mysql database
|
- name: Creating Panko mysql database
|
||||||
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
|
kolla_toolbox:
|
||||||
-m mysql_db
|
module_name: mysql_db
|
||||||
-a "login_host='{{ panko_database_mysql_address }}'
|
module_args:
|
||||||
login_port='{{ panko_database_port }}'
|
login_host: "{{ panko_database_mysql_address }}"
|
||||||
login_user='{{ panko_database_user }}'
|
login_port: "{{ panko_database_port }}"
|
||||||
login_password='{{ panko_database_password }}'
|
login_user: "{{ database_user }}"
|
||||||
name='{{ panko_database_name }}'"
|
login_password: "{{ database_password }}"
|
||||||
register: mysql_access
|
name: "{{ panko_database_name }}"
|
||||||
failed_when: False
|
|
||||||
changed_when: False
|
|
||||||
run_once: True
|
|
||||||
when:
|
|
||||||
- panko_database_type == "mysql"
|
|
||||||
|
|
||||||
- name: Creating panko mysql database
|
|
||||||
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
|
|
||||||
-m mysql_db
|
|
||||||
-a "login_host='{{ panko_database_mysql_address }}'
|
|
||||||
login_port='{{ panko_database_port }}'
|
|
||||||
login_user='{{ database_user }}'
|
|
||||||
login_password='{{ database_password }}'
|
|
||||||
name='{{ panko_database_name }}'"
|
|
||||||
register: mysql_panko_database
|
register: mysql_panko_database
|
||||||
changed_when: "{{ mysql_panko_database.stdout.find('localhost | SUCCESS => ') != -1 and
|
|
||||||
(mysql_panko_database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
|
|
||||||
failed_when: mysql_panko_database.stdout.split()[2] != 'SUCCESS'
|
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['panko-api'][0] }}"
|
delegate_to: "{{ groups['panko-api'][0] }}"
|
||||||
when:
|
when:
|
||||||
- panko_database_type == "mysql"
|
- panko_database_type == "mysql"
|
||||||
- "'FAILED' in mysql_access.stdout"
|
|
||||||
|
|
||||||
- name: Creating panko database user and setting permissions
|
- name: Creating Panko mysql database user and setting permissions
|
||||||
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
|
kolla_toolbox:
|
||||||
-m mysql_user
|
module_name: mysql_user
|
||||||
-a "login_host='{{ panko_database_mysql_address }}'
|
module_args:
|
||||||
login_port='{{ panko_database_port }}'
|
login_host: "{{ panko_database_mysql_address }}"
|
||||||
login_user='{{ database_user }}'
|
login_port: "{{ panko_database_port }}"
|
||||||
login_password='{{ database_password }}'
|
login_user: "{{ database_user }}"
|
||||||
name='{{ panko_database_name }}'
|
login_password: "{{ database_password }}"
|
||||||
password='{{ panko_database_password }}'
|
name: "{{ panko_database_name }}"
|
||||||
host='%'
|
password: "{{ panko_database_password }}"
|
||||||
priv='{{ panko_database_name }}.*:ALL'
|
host: "%"
|
||||||
append_privs='yes'"
|
priv: "{{ panko_database_name }}.*:ALL"
|
||||||
register: database_user_create
|
append_privs: "yes"
|
||||||
changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and
|
|
||||||
(database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
|
|
||||||
failed_when: database_user_create.stdout.split()[2] != 'SUCCESS'
|
|
||||||
run_once: True
|
run_once: True
|
||||||
delegate_to: "{{ groups['panko-api'][0] }}"
|
delegate_to: "{{ groups['panko-api'][0] }}"
|
||||||
when:
|
when:
|
||||||
- panko_database_type == "mysql"
|
- panko_database_type == "mysql"
|
||||||
- "'FAILED' in mysql_access.stdout"
|
|
||||||
|
|
||||||
- include: bootstrap_service.yml
|
- include: bootstrap_service.yml
|
||||||
when: ((panko_database_type == "mongodb" and mongodb_panko_database.changed)
|
when: ((panko_database_type == "mongodb" and mongodb_panko_database.changed)
|
||||||
|
Loading…
Reference in New Issue
Block a user