diff --git a/releasenotes/notes/removed-db-create-tasks-8ae301041fe46cfb.yaml b/releasenotes/notes/removed-db-create-tasks-8ae301041fe46cfb.yaml new file mode 100644 index 00000000..98d5a849 --- /dev/null +++ b/releasenotes/notes/removed-db-create-tasks-8ae301041fe46cfb.yaml @@ -0,0 +1,5 @@ +--- +upgrade: + - The database and user creates have been removed from the + ``os_horizon`` role. These tasks have been relocated to + the playbooks. diff --git a/tasks/horizon_db_setup.yml b/tasks/horizon_db_setup.yml index b647cd70..bac738fa 100644 --- a/tasks/horizon_db_setup.yml +++ b/tasks/horizon_db_setup.yml @@ -13,32 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Create DB for service - mysql_db: - login_user: "{{ galera_root_user }}" - login_password: "{{ galera_root_password }}" - login_host: "{{ horizon_galera_address }}" - name: "{{ horizon_galera_database }}" - state: "present" - tags: - - horizon-db-setup - -- name: Grant access to the DB for the service - mysql_user: - login_user: "{{ galera_root_user }}" - login_password: "{{ galera_root_password }}" - login_host: "{{ horizon_galera_address }}" - name: "{{ horizon_galera_user }}" - password: "{{ horizon_container_mysql_password }}" - host: "{{ item }}" - state: "present" - priv: "{{ horizon_galera_database }}.*:ALL" - with_items: - - "localhost" - - "%" - tags: - - horizon-db-setup - - name: Perform a horizon DB sync command: "{{ horizon_bin }}/horizon-manage.py syncdb --noinput" become: yes diff --git a/tests/test-install-infra.yml b/tests/test-install-infra.yml index 86e8625e..28f28b56 100644 --- a/tests/test-install-infra.yml +++ b/tests/test-install-infra.yml @@ -30,3 +30,28 @@ galera_wsrep_provider_options: - { option: "gcache.size", value: "32M" } galera_server_id: "{{ inventory_hostname | string_2_int }}" + post_tasks: + - name: Create DB for service + mysql_db: + login_user: "{{ galera_root_user }}" + login_password: "{{ galera_root_password }}" + login_host: "127.0.0.1" + name: "{{ horizon_galera_database }}" + state: "present" + when: inventory_hostname == groups['service_all'][0] + - name: Grant access to the DB for the service + mysql_user: + login_user: "{{ galera_root_user }}" + login_password: "{{ galera_root_password }}" + login_host: "127.0.0.1" + name: "{{ horizon_galera_user }}" + password: "{{ horizon_container_mysql_password }}" + host: "{{ item }}" + state: "present" + priv: "{{ horizon_galera_database }}.*:ALL" + with_items: + - "localhost" + - "%" + when: inventory_hostname == groups['service_all'][0] + vars_files: + - test-vars.yml diff --git a/tests/test-vars.yml b/tests/test-vars.yml index 81a093cc..b6423187 100644 --- a/tests/test-vars.yml +++ b/tests/test-vars.yml @@ -16,11 +16,14 @@ external_lb_vip_address: 10.100.100.3 galera_client_drop_config_file: false galera_root_password: "secrete" +galera_root_user: "root" horizon_developer_mode: true horizon_venv_tag: "testing" horizon_git_install_branch: master horizon_requirements_git_install_branch: master horizon_galera_address: 10.100.100.2 +horizon_galera_database: dash +horizon_galera_user: dash horizon_rabbitmq_password: "secrete" horizon_rabbitmq_userid: horizon horizon_rabbitmq_vhost: /horizon