Merge "Create nova-api database"
This commit is contained in:
commit
7c264ca022
@ -21,6 +21,9 @@ nova_database_name: "nova"
|
||||
nova_database_user: "nova"
|
||||
nova_database_address: "{{ kolla_internal_address }}"
|
||||
|
||||
nova_api_database_name: "nova_api"
|
||||
nova_api_database_user: "nova_api"
|
||||
nova_api_database_address: "{{ kolla_internal_address }}"
|
||||
|
||||
####################
|
||||
# Docker
|
||||
|
@ -17,6 +17,24 @@
|
||||
set_fact:
|
||||
database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
|
||||
|
||||
- name: Creating Nova-api database
|
||||
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
||||
-m mysql_db
|
||||
-a "login_host='{{ database_address }}'
|
||||
login_user='{{ database_user }}'
|
||||
login_password='{{ database_password }}'
|
||||
name='{{ nova_api_database_name }}'"
|
||||
register: database_api
|
||||
changed_when: "{{ database_api.stdout.find('localhost | SUCCESS => ') != -1 and
|
||||
(database_api.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
|
||||
failed_when: database_api.stdout.split()[2] != 'SUCCESS'
|
||||
run_once: True
|
||||
delegate_to: "{{ groups['nova-api'][0] }}"
|
||||
|
||||
- name: Reading json from variable
|
||||
set_fact:
|
||||
database_api_created: "{{ (database_api.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
|
||||
|
||||
- name: Creating Nova database user and setting permissions
|
||||
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
||||
-m mysql_user
|
||||
@ -35,6 +53,24 @@
|
||||
run_once: True
|
||||
delegate_to: "{{ groups['nova-api'][0] }}"
|
||||
|
||||
- name: Creating Nova-api database user and setting permissions
|
||||
command: docker exec -t kolla_ansible /usr/bin/ansible localhost
|
||||
-m mysql_user
|
||||
-a "login_host='{{ database_address }}'
|
||||
login_user='{{ database_user }}'
|
||||
login_password='{{ database_password }}'
|
||||
name='{{ nova_api_database_name }}'
|
||||
password='{{ nova_api_database_password }}'
|
||||
host='%'
|
||||
priv='{{ nova_api_database_name }}.*:ALL'
|
||||
append_privs='yes'"
|
||||
register: database_api_user_create
|
||||
changed_when: "{{ database_api_user_create.stdout.find('localhost | SUCCESS => ') != -1 and
|
||||
(database_api_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
|
||||
failed_when: database_api_user_create.stdout.split()[2] != 'SUCCESS'
|
||||
run_once: True
|
||||
delegate_to: "{{ groups['nova-api'][0] }}"
|
||||
|
||||
- name: Running Nova bootstrap container
|
||||
kolla_docker:
|
||||
action: "start_container"
|
||||
|
@ -125,6 +125,9 @@ password = {{ neutron_keystone_password }}
|
||||
[database]
|
||||
connection = mysql+pymysql://{{ nova_database_user }}:{{ nova_database_password }}@{{ nova_database_address }}/{{ nova_database_name }}
|
||||
|
||||
[api_database]
|
||||
connection = mysql+pymysql://{{ nova_api_database_user }}:{{ nova_api_database_password }}@{{ nova_api_database_address }}/{{ nova_api_database_name }}
|
||||
|
||||
[keystone_authtoken]
|
||||
auth_uri = http://{{ kolla_internal_address }}:{{ keystone_public_port }}
|
||||
auth_url = http://{{ kolla_internal_address }}:{{ keystone_admin_port }}
|
||||
|
@ -4,5 +4,6 @@
|
||||
# of the KOLLA_BOOTSTRAP variable being set, including empty.
|
||||
if [[ "${!KOLLA_BOOTSTRAP[@]}" ]]; then
|
||||
nova-manage db sync
|
||||
nova-manage api_db sync
|
||||
exit 0
|
||||
fi
|
||||
|
@ -33,6 +33,7 @@ glance_database_password: "password"
|
||||
glance_keystone_password: "password"
|
||||
|
||||
nova_database_password: "password"
|
||||
nova_api_database_password: "password"
|
||||
nova_keystone_password: "password"
|
||||
|
||||
neutron_database_password: "password"
|
||||
|
Loading…
Reference in New Issue
Block a user