Added the DB and DB user create to the plays

All of the database and database user creates have
been removed from the roles into the playbooks. This
allows the roles to be tested independently of the
deployed database and also allows the toles to be
used independently of infrastructure choices made by
the integrated OSA project.

Change-Id: If58e482034a65c0e50241448dbe298a73c1ae71b
Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
Kevin Carter 2016-05-10 21:58:00 -05:00 committed by Jesse Pretorius (odyssey4me)
parent 2a3c695972
commit cff6ea0533
9 changed files with 262 additions and 39 deletions

View File

@ -143,6 +143,34 @@
tags: tags:
- cinder-rabbitmq - cinder-rabbitmq
- cinder-rabbitmq-user - cinder-rabbitmq-user
- name: Create DB for service
mysql_db:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "{{ cinder_galera_address }}"
name: "{{ cinder_galera_database }}"
state: "present"
when: inventory_hostname == groups['cinder_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
tags:
- mysql-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: "{{ cinder_galera_address }}"
name: "{{ cinder_galera_user }}"
password: "{{ cinder_container_mysql_password }}"
host: "{{ item }}"
state: "present"
priv: "{{ cinder_galera_database }}.*:ALL"
when: inventory_hostname == groups['cinder_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
with_items:
- "localhost"
- "%"
tags:
- mysql-db-setup
- name: Set cinder storage bridge (is_metal) - name: Set cinder storage bridge (is_metal)
set_fact: set_fact:
storage_bridge: "{{ 'ansible_' + hostvars[inventory_hostname]['container_networks']['storage_address']['bridge'] | replace('-', '_') }}" storage_bridge: "{{ 'ansible_' + hostvars[inventory_hostname]['container_networks']['storage_address']['bridge'] | replace('-', '_') }}"
@ -187,7 +215,6 @@
- role: "os_cinder" - role: "os_cinder"
cinder_venv_tag: "{{ openstack_release }}" cinder_venv_tag: "{{ openstack_release }}"
cinder_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/cinder-{{ openstack_release }}.tgz" cinder_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/cinder-{{ openstack_release }}.tgz"
cinder_galera_address: "{{ internal_lb_vip_address }}"
cinder_management_address: "{{ ansible_ssh_host }}" cinder_management_address: "{{ ansible_ssh_host }}"
cinder_glance_host: "{{ internal_lb_vip_address }}" cinder_glance_host: "{{ internal_lb_vip_address }}"
cinder_glance_service_port: "{{ glance_service_port }}" cinder_glance_service_port: "{{ glance_service_port }}"
@ -211,6 +238,9 @@
vars: vars:
galera_address: "{{ internal_lb_vip_address }}" galera_address: "{{ internal_lb_vip_address }}"
is_metal: "{{ properties.is_metal|default(false) }}" is_metal: "{{ properties.is_metal|default(false) }}"
cinder_galera_user: cinder
cinder_galera_database: cinder
cinder_galera_address: "{{ galera_address }}"
cinder_rabbitmq_userid: cinder cinder_rabbitmq_userid: cinder
cinder_rabbitmq_vhost: /cinder cinder_rabbitmq_vhost: /cinder
cinder_rabbitmq_servers: "{{ rabbitmq_servers }}" cinder_rabbitmq_servers: "{{ rabbitmq_servers }}"

View File

@ -119,9 +119,36 @@
tags: tags:
- glance-rabbitmq - glance-rabbitmq
- glance-rabbitmq-user - glance-rabbitmq-user
- name: Create DB for service
mysql_db:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "{{ glance_galera_address }}"
name: "{{ glance_galera_database }}"
state: "present"
when: inventory_hostname == groups['glance_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
tags:
- mysql-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: "{{ glance_galera_address }}"
name: "{{ glance_galera_user }}"
password: "{{ glance_container_mysql_password }}"
host: "{{ item }}"
state: "present"
priv: "{{ glance_galera_database }}.*:ALL"
when: inventory_hostname == groups['glance_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
with_items:
- "localhost"
- "%"
tags:
- mysql-db-setup
roles: roles:
- role: "os_glance" - role: "os_glance"
glance_galera_address: "{{ galera_address }}"
glance_venv_tag: "{{ openstack_release }}" glance_venv_tag: "{{ openstack_release }}"
glance_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/glance-{{ openstack_release }}.tgz" glance_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/glance-{{ openstack_release }}.tgz"
tags: tags:
@ -145,6 +172,9 @@
vars: vars:
galera_address: "{{ internal_lb_vip_address }}" galera_address: "{{ internal_lb_vip_address }}"
is_metal: "{{ properties.is_metal|default(false) }}" is_metal: "{{ properties.is_metal|default(false) }}"
glance_galera_user: glance
glance_galera_database: glance
glance_galera_address: "{{ galera_address }}"
glance_rabbitmq_userid: glance glance_rabbitmq_userid: glance
glance_rabbitmq_vhost: /glance glance_rabbitmq_vhost: /glance
glance_rabbitmq_servers: "{{ rabbitmq_servers }}" glance_rabbitmq_servers: "{{ rabbitmq_servers }}"

View File

@ -102,11 +102,38 @@
tags: tags:
- heat-rabbitmq - heat-rabbitmq
- heat-rabbitmq-user - heat-rabbitmq-user
- name: Create DB for service
mysql_db:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "{{ heat_galera_address }}"
name: "{{ heat_galera_database }}"
state: "present"
when: inventory_hostname == groups['heat_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
tags:
- mysql-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: "{{ heat_galera_address }}"
name: "{{ heat_galera_user }}"
password: "{{ heat_container_mysql_password }}"
host: "{{ item }}"
state: "present"
priv: "{{ heat_galera_database }}.*:ALL"
when: inventory_hostname == groups['heat_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
with_items:
- "localhost"
- "%"
tags:
- mysql-db-setup
roles: roles:
- role: "os_heat" - role: "os_heat"
heat_venv_tag: "{{ openstack_release }}" heat_venv_tag: "{{ openstack_release }}"
heat_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/heat-{{ openstack_release }}.tgz" heat_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/heat-{{ openstack_release }}.tgz"
heat_galera_address: "{{ galera_address }}"
tags: tags:
- "os-heat" - "os-heat"
- role: "rsyslog_client" - role: "rsyslog_client"
@ -122,6 +149,9 @@
vars: vars:
galera_address: "{{ internal_lb_vip_address }}" galera_address: "{{ internal_lb_vip_address }}"
is_metal: "{{ properties.is_metal|default(false) }}" is_metal: "{{ properties.is_metal|default(false) }}"
heat_galera_user: heat
heat_galera_database: heat
heat_galera_address: "{{ galera_address }}"
heat_rabbitmq_userid: heat heat_rabbitmq_userid: heat
heat_rabbitmq_vhost: /heat heat_rabbitmq_vhost: /heat
heat_rabbitmq_servers: "{{ rabbitmq_servers }}" heat_rabbitmq_servers: "{{ rabbitmq_servers }}"

View File

@ -75,9 +75,36 @@
when: is_metal | bool when: is_metal | bool
tags: tags:
- horizon-logs - horizon-logs
- 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"
when: inventory_hostname == groups['horizon_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
tags:
- mysql-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"
when: inventory_hostname == groups['horizon_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
with_items:
- "localhost"
- "%"
tags:
- mysql-db-setup
roles: roles:
- role: "os_horizon" - role: "os_horizon"
horizon_galera_address: "{{ galera_address }}"
horizon_server_name: "{{ container_name }}" horizon_server_name: "{{ container_name }}"
horizon_venv_tag: "{{ openstack_release }}" horizon_venv_tag: "{{ openstack_release }}"
horizon_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/horizon-{{ openstack_release }}.tgz" horizon_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/horizon-{{ openstack_release }}.tgz"
@ -96,3 +123,6 @@
vars: vars:
galera_address: "{{ internal_lb_vip_address }}" galera_address: "{{ internal_lb_vip_address }}"
is_metal: "{{ properties.is_metal|default(false) }}" is_metal: "{{ properties.is_metal|default(false) }}"
horizon_galera_user: horizon
horizon_galera_database: horizon
horizon_galera_address: "{{ galera_address }}"

View File

@ -40,34 +40,6 @@
retries: 3 retries: 3
tags: tags:
- ssh-wait - ssh-wait
- name: Create DB for Ironic
mysql_db:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "{{ ironic_galera_address }}"
name: "{{ ironic_galera_database }}"
state: "present"
delegate_to: "{{ groups['galera_all'][0] }}"
run_once: true
tags:
- ironic-db-setup
- name: Grant access to the DB for Ironic
mysql_user:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "{{ ironic_galera_address }}"
name: "{{ ironic_galera_user }}"
password: "{{ ironic_galera_password }}"
host: "{{ item }}"
state: "present"
priv: "{{ ironic_galera_database }}.*:ALL"
with_items:
- "localhost"
- "%"
delegate_to: "{{ groups['galera_all'][0] }}"
run_once: true
tags:
- ironic-db-setup
- name: Ensure Rabbitmq vhost for Ironic - name: Ensure Rabbitmq vhost for Ironic
rabbitmq_vhost: rabbitmq_vhost:
name: "{{ ironic_rabbitmq_vhost }}" name: "{{ ironic_rabbitmq_vhost }}"
@ -91,6 +63,36 @@
tags: tags:
- ironic-rabbitmq - ironic-rabbitmq
- ironic-rabbitmq-user - ironic-rabbitmq-user
- name: Create DB for Ironic
mysql_db:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "{{ ironic_galera_address }}"
name: "{{ ironic_galera_database }}"
state: "present"
when: inventory_hostname == groups['ironic_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
run_once: true
tags:
- mysql-db-setup
- name: Grant access to the DB for Ironic
mysql_user:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "{{ ironic_galera_address }}"
name: "{{ ironic_galera_user }}"
password: "{{ ironic_galera_password }}"
host: "{{ item }}"
state: "present"
priv: "{{ ironic_galera_database }}.*:ALL"
when: inventory_hostname == groups['ironic_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
with_items:
- "localhost"
- "%"
run_once: true
tags:
- mysql-db-setup
- name: Sort the rabbitmq servers - name: Sort the rabbitmq servers
dist_sort: dist_sort:
value_to_lookup: "{{ container_name }}" value_to_lookup: "{{ container_name }}"
@ -124,7 +126,10 @@
tags: tags:
- "system-crontab-coordination" - "system-crontab-coordination"
vars: vars:
galera_address: "{{ internal_lb_vip_address }}"
ansible_hostname: "{{ container_name }}" ansible_hostname: "{{ container_name }}"
ansible_ssh_host: "{{ container_address }}" ansible_ssh_host: "{{ container_address }}"
ironic_galera_address: "{{ internal_lb_vip_address }}"
is_metal: "{{ properties.is_metal|default(false) }}" is_metal: "{{ properties.is_metal|default(false) }}"
ironic_galera_user: ironic
ironic_galera_database: ironic
ironic_galera_address: "{{ galera_address }}"

View File

@ -123,7 +123,7 @@
mysql_db: mysql_db:
login_user: "{{ galera_root_user }}" login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}" login_password: "{{ galera_root_password }}"
login_host: "{{ galera_address }}" login_host: "{{ keystone_galera_address }}"
name: "{{ keystone_galera_database }}" name: "{{ keystone_galera_database }}"
state: "present" state: "present"
when: inventory_hostname == groups['keystone_all'][0] when: inventory_hostname == groups['keystone_all'][0]
@ -134,7 +134,7 @@
mysql_user: mysql_user:
login_user: "{{ galera_root_user }}" login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}" login_password: "{{ galera_root_password }}"
login_host: "{{ galera_address }}" login_host: "{{ keystone_galera_address }}"
name: "{{ keystone_galera_database }}" name: "{{ keystone_galera_database }}"
password: "{{ keystone_container_mysql_password }}" password: "{{ keystone_container_mysql_password }}"
host: "{{ item }}" host: "{{ item }}"
@ -151,7 +151,6 @@
- role: "os_keystone" - role: "os_keystone"
keystone_venv_tag: "{{ openstack_release }}" keystone_venv_tag: "{{ openstack_release }}"
keystone_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/keystone-{{ openstack_release }}.tgz" keystone_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/keystone-{{ openstack_release }}.tgz"
keystone_galera_address: "{{ galera_address }}"
tags: tags:
- "os-keystone" - "os-keystone"
- { role: "openstack_openrc", tags: [ "openstack-openrc" ] } - { role: "openstack_openrc", tags: [ "openstack-openrc" ] }
@ -172,6 +171,7 @@
keystone_admin_port: 35357 keystone_admin_port: 35357
keystone_galera_user: keystone keystone_galera_user: keystone
keystone_galera_database: keystone keystone_galera_database: keystone
keystone_galera_address: "{{ galera_address }}"
keystone_rabbitmq_userid: keystone keystone_rabbitmq_userid: keystone
keystone_rabbitmq_vhost: /keystone keystone_rabbitmq_vhost: /keystone
keystone_rabbitmq_servers: "{{ rabbitmq_servers }}" keystone_rabbitmq_servers: "{{ rabbitmq_servers }}"

View File

@ -121,6 +121,34 @@
tags: tags:
- neutron-rabbitmq - neutron-rabbitmq
- neutron-rabbitmq-user - neutron-rabbitmq-user
- name: Create DB for service
mysql_db:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "{{ neutron_galera_address }}"
name: "{{ neutron_galera_database }}"
state: "present"
when: inventory_hostname == groups['neutron_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
tags:
- mysql-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: "{{ neutron_galera_address }}"
name: "{{ neutron_galera_user }}"
password: "{{ neutron_container_mysql_password }}"
host: "{{ item }}"
state: "present"
priv: "{{ neutron_galera_database }}.*:ALL"
when: inventory_hostname == groups['neutron_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
with_items:
- "localhost"
- "%"
tags:
- mysql-db-setup
- name: Create the neutron provider networks facts - name: Create the neutron provider networks facts
provider_networks: provider_networks:
provider_networks: "{{ provider_networks }}" provider_networks: "{{ provider_networks }}"
@ -156,7 +184,6 @@
- role: "os_neutron" - role: "os_neutron"
neutron_venv_tag: "{{ openstack_release }}" neutron_venv_tag: "{{ openstack_release }}"
neutron_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/neutron-{{ openstack_release }}.tgz" neutron_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/neutron-{{ openstack_release }}.tgz"
neutron_galera_address: "{{ galera_address }}"
neutron_local_ip: "{{ _local_ip }}" neutron_local_ip: "{{ _local_ip }}"
neutron_overlay_network: "{{ _overlay_network }}" neutron_overlay_network: "{{ _overlay_network }}"
neutron_provider_networks: "{{ _provider_networks }}" neutron_provider_networks: "{{ _provider_networks }}"
@ -179,6 +206,9 @@
vars: vars:
galera_address: "{{ internal_lb_vip_address }}" galera_address: "{{ internal_lb_vip_address }}"
is_metal: "{{ properties.is_metal|default(false) }}" is_metal: "{{ properties.is_metal|default(false) }}"
neutron_galera_user: neutron
neutron_galera_database: neutron
neutron_galera_address: "{{ galera_address }}"
bind_prefix: "{{ provider_network_bind_prefix|default('') }}" bind_prefix: "{{ provider_network_bind_prefix|default('') }}"
neutron_rabbitmq_userid: neutron neutron_rabbitmq_userid: neutron
neutron_rabbitmq_vhost: /neutron neutron_rabbitmq_vhost: /neutron

View File

@ -154,6 +154,62 @@
tags: tags:
- nova-rabbitmq - nova-rabbitmq
- nova-rabbitmq-user - nova-rabbitmq-user
- name: Create DB for service
mysql_db:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "{{ nova_galera_address }}"
name: "{{ nova_galera_database }}"
state: "present"
when: inventory_hostname == groups['nova_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
tags:
- mysql-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: "{{ nova_galera_address }}"
name: "{{ nova_galera_user }}"
password: "{{ nova_container_mysql_password }}"
host: "{{ item }}"
state: "present"
priv: "{{ nova_galera_database }}.*:ALL"
when: inventory_hostname == groups['nova_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
with_items:
- "localhost"
- "%"
tags:
- mysql-db-setup
- name: Create API DB for service
mysql_db:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "{{ nova_api_galera_address }}"
name: "{{ nova_api_galera_database }}"
state: "present"
when: inventory_hostname == groups['nova_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
tags:
- mysql-db-setup
- name: Grant access to the API DB for the service
mysql_user:
login_user: "{{ galera_root_user }}"
login_password: "{{ galera_root_password }}"
login_host: "{{ nova_api_galera_address }}"
name: "{{ nova_api_galera_user }}"
password: "{{ nova_api_container_mysql_password }}"
host: "{{ item }}"
state: "present"
priv: "{{ nova_api_galera_database }}.*:ALL"
when: inventory_hostname == groups['nova_all'][0]
delegate_to: "{{ groups['galera_all'][0] }}"
with_items:
- "localhost"
- "%"
tags:
- mysql-db-setup
- name: Set nova management bridge (is_metal) - name: Set nova management bridge (is_metal)
set_fact: set_fact:
management_bridge: "{{ 'ansible_' + hostvars[inventory_hostname]['management_bridge'] | replace('-', '_') }}" management_bridge: "{{ 'ansible_' + hostvars[inventory_hostname]['management_bridge'] | replace('-', '_') }}"
@ -192,8 +248,6 @@
nova_novncproxy_git_install_branch: "{{ novncproxy_git_install_branch }}" nova_novncproxy_git_install_branch: "{{ novncproxy_git_install_branch }}"
nova_spicehtml5_git_repo: "{{ openstack_repo_git_url }}/spice-html5" nova_spicehtml5_git_repo: "{{ openstack_repo_git_url }}/spice-html5"
nova_spicehtml5_git_install_branch: "{{ spicehtml5_git_install_branch }}" nova_spicehtml5_git_install_branch: "{{ spicehtml5_git_install_branch }}"
nova_galera_address: "{{ galera_address }}"
nova_api_galera_address: "{{ galera_address }}"
nova_management_address: "{{ management_address }}" nova_management_address: "{{ management_address }}"
nova_venv_tag: "{{ openstack_release }}" nova_venv_tag: "{{ openstack_release }}"
nova_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/nova-{{ openstack_release }}.tgz" nova_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/nova-{{ openstack_release }}.tgz"
@ -222,6 +276,12 @@
vars: vars:
galera_address: "{{ internal_lb_vip_address }}" galera_address: "{{ internal_lb_vip_address }}"
is_metal: "{{ properties.is_metal|default(false) }}" is_metal: "{{ properties.is_metal|default(false) }}"
nova_galera_user: nova
nova_galera_database: nova
nova_api_galera_user: nova_api
nova_api_galera_database: nova_api
nova_galera_address: "{{ galera_address }}"
nova_api_galera_address: "{{ galera_address }}"
glance_host: "{{ internal_lb_vip_address }}" glance_host: "{{ internal_lb_vip_address }}"
nova_rabbitmq_userid: nova nova_rabbitmq_userid: nova
nova_rabbitmq_vhost: /nova nova_rabbitmq_vhost: /nova

View File

@ -0,0 +1,8 @@
---
features:
- All of the database and database user creates have
been removed from the roles into the playbooks. This
allows the roles to be tested independently of the
deployed database and also allows the roles to be
used independently of infrastructure choices made by
the integrated OSA project.