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 'cloudkitty_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 cloudkitty_galera_address which has been used for a long time, but never documented. Change-Id: I7bb3f38556558ef14723361d3672a1d06f839b52
This commit is contained in:
3 changed files with 10 additions and 6 deletions
@@ -63,8 +63,12 @@ cloudkitty_output_backend: cloudkitty.backend.file.FileBackend
cloudkitty_output_pipeline:osrf
cloudkitty_output_basepath:/var/cloudkitty/reports
cloudkitty_db_setup_host:"{{ ('galera_all' in groups) | ternary(groups['galera_all'][0], 'localhost') }}"
cloudkitty_galera_address:"{{ galera_address | default('127.0.0.1') }}"
cloudkitty_galera_database:cloudkitty
cloudkitty_galera_user:cloudkitty
cloudkitty_database_connection:>-
mysql+pymysql://{{ cloudkitty_galera_user }}:{{ cloudkitty_container_mysql_password }}@{{ cloudkitty_galera_address }}/{{ cloudkitty_galera_database }}?charset=utf8
## Service Type and Data
cloudkitty_service_region:RegionOne
@@ -117,7 +121,3 @@ cloudkitty_requires_pip_packages:
# pip packages required by this role. The value is picked up
# by the py_pkgs lookup.
cloudkitty_role_project_group:cloudkitty_all
# The messaging driver to use, defaults to rabbit. Other drivers
# include qpid and zmq. (string value)
cloudkitty_database_connection:"mysql+pymysql://{{ cloudkitty_galera_user }}:{{ cloudkitty_container_mysql_password }}@{{ cloudkitty_galera_address }}/{{ cloudkitty_galera_database }}?charset=utf8"
@@ -128,5 +128,9 @@
cloudkitty_rabbitmq_servers:"{{ rabbitmq_servers }}"
cloudkitty_rabbitmq_port:"{{ rabbitmq_port }}"
cloudkitty_rabbitmq_use_ssl:"{{ rabbitmq_use_ssl }}"
galera_root_user:root
vars_prompt:
- name:"galera_root_password"
prompt:"What is galera_root_password?"
vars_files:
- defaults/repo_packages/openstack_services.yml
@@ -22,7 +22,7 @@
login_host:"{{ cloudkitty_galera_address }}"
name:"{{ cloudkitty_galera_database }}"
state:"present"
delegate_to:"{{ groups['galera_all'][0] }}"
delegate_to:"{{ cloudkitty_db_setup_host }}"
no_log:true
tags:
- cloudkitty-db-setup
@@ -37,7 +37,7 @@
host:"{{ item }}"
state:"present"
priv:"{{ cloudkitty_galera_database }}.*:ALL"
delegate_to:"{{ groups['galera_all'][0] }}"
delegate_to:"{{ cloudkitty_db_setup_host }}"
no_log:true
with_items:
- "localhost"
Reference in New Issue
Block a user
Blocking a user prevents them from interacting with repositories, such as opening or commenting on pull requests or issues. Learn more about blocking a user.