2015-07-13 07:32:29 +00:00
|
|
|
---
|
2015-08-11 06:38:49 +00:00
|
|
|
- name: Creating Neutron database
|
2016-01-29 16:40:54 +00:00
|
|
|
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
|
2015-08-11 06:38:49 +00:00
|
|
|
-m mysql_db
|
|
|
|
-a "login_host='{{ database_address }}'
|
|
|
|
login_user='{{ database_user }}'
|
|
|
|
login_password='{{ database_password }}'
|
|
|
|
name='{{ neutron_database_name }}'"
|
|
|
|
register: database
|
2015-11-05 12:15:49 +00:00
|
|
|
changed_when: "{{ database.stdout.find('localhost | SUCCESS => ') != -1 and
|
|
|
|
(database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
|
2015-08-11 06:38:49 +00:00
|
|
|
failed_when: database.stdout.split()[2] != 'SUCCESS'
|
|
|
|
run_once: True
|
2015-11-07 15:11:40 -05:00
|
|
|
delegate_to: "{{ groups['neutron-server'][0] }}"
|
2015-08-11 06:38:49 +00:00
|
|
|
|
2015-11-05 12:15:49 +00:00
|
|
|
- name: Reading json from variable
|
|
|
|
set_fact:
|
|
|
|
database_created: "{{ (database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
|
|
|
|
|
2015-08-11 06:38:49 +00:00
|
|
|
- name: Creating Neutron database user and setting permissions
|
2016-01-29 16:40:54 +00:00
|
|
|
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
|
2015-08-11 06:38:49 +00:00
|
|
|
-m mysql_user
|
|
|
|
-a "login_host='{{ database_address }}'
|
|
|
|
login_user='{{ database_user }}'
|
|
|
|
login_password='{{ database_password }}'
|
|
|
|
name='{{ neutron_database_name }}'
|
|
|
|
password='{{ neutron_database_password }}'
|
|
|
|
host='%'
|
|
|
|
priv='{{ neutron_database_name }}.*:ALL'
|
|
|
|
append_privs='yes'"
|
2015-08-20 00:35:38 -07:00
|
|
|
register: database_user_create
|
2015-11-05 12:15:49 +00:00
|
|
|
changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and
|
|
|
|
(database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
|
2015-08-20 00:35:38 -07:00
|
|
|
failed_when: database_user_create.stdout.split()[2] != 'SUCCESS'
|
2015-08-11 06:38:49 +00:00
|
|
|
run_once: True
|
2015-11-07 15:11:40 -05:00
|
|
|
delegate_to: "{{ groups['neutron-server'][0] }}"
|
2015-08-11 06:38:49 +00:00
|
|
|
|
2016-02-26 15:53:42 +00:00
|
|
|
- include: bootstrap_service.yml
|
2015-11-05 12:15:49 +00:00
|
|
|
when: database_created
|