Move database creation into role
There is no record for why we implement the database creation outside of the role in the playbook, when we could do it inside the role. Implementing it inside the role allows us to reduce the quantity of group_vars duplicated from the role, and allows us to better document the required variables in the role. The delegation can still be done as it is done in the playbook too. In this patch we implement a new variable called 'zun_db_setup_host' which is used in the role to allow delegation of the database setup task to any host, but defaults to the first member of the galera_all host group. We also document the variable 'zun_galera_address' which has been used for a long time, but never documented. A bunch of unused variables have also been removed. Change-Id: Ic1e3c870a220f67cc5220a1dbc644d8bf47b0f16
This commit is contained in:
parent
d7cfc79426
commit
110c2038ed
@ -96,6 +96,8 @@ zun_docker_api_version: false
|
||||
# zun_system_group_gid = <GID>
|
||||
|
||||
## Database info
|
||||
zun_db_setup_host: "{{ ('galera_all' in groups) | ternary(groups['galera_all'][0], 'localhost') }}"
|
||||
zun_galera_address: "{{ galera_address | default('127.0.0.1') }}"
|
||||
zun_galera_user: zun
|
||||
zun_galera_database: zun
|
||||
zun_db_max_overflow: 10
|
||||
|
@ -25,7 +25,7 @@
|
||||
login_host: "{{ zun_galera_address }}"
|
||||
name: "{{ zun_galera_database }}"
|
||||
state: "present"
|
||||
delegate_to: "{{ groups['galera_all'][0] }}"
|
||||
delegate_to: "{{ zun_db_setup_host }}"
|
||||
no_log: True
|
||||
|
||||
- name: Grant access to the DB for the service
|
||||
@ -38,7 +38,8 @@
|
||||
host: "{{ item }}"
|
||||
state: "present"
|
||||
priv: "{{ zun_galera_database }}.*:ALL"
|
||||
append_privs: "{{ db_append_privs | default(omit) }}"
|
||||
delegate_to: "{{ groups['galera_all'][0] }}"
|
||||
with_items: "{{ grant_list | default(['localhost', '%']) }}"
|
||||
delegate_to: "{{ zun_db_setup_host }}"
|
||||
with_items:
|
||||
- "localhost"
|
||||
- "%"
|
||||
no_log: True
|
||||
|
@ -23,7 +23,6 @@
|
||||
zun_service_password: secrete
|
||||
zun_kuryr_service_password: secrete
|
||||
zun_developer_mode: true
|
||||
zun_galera_address: "{{ hostvars[groups['galera_all'][0]]['ansible_host'] }}"
|
||||
zun_rabbitmq_servers: "{{ hostvars[groups['rabbitmq_all'][0]]['ansible_host'] }}"
|
||||
zun_service_publicuri: "http://{{ hostvars[groups['keystone_all'][0]]['ansible_host'] }}:9517"
|
||||
zun_service_adminuri: "http://{{ hostvars[groups['keystone_all'][0]]['ansible_host'] }}:9517"
|
||||
|
Loading…
Reference in New Issue
Block a user