prameswar 7ef0b41e0f corrected register variable name in ceilometer bootstrap.yml
Closes-Bug: #1635322

Change-Id: I6f3351d098dfd9a7c1c3e3e8b213134284f823f9
2016-10-20 21:04:56 +05:30

56 lines
2.7 KiB
YAML

---
- name: Creating Ceilometer MongoDB database
command: docker exec -t mongodb mongo --host {{ ceilometer_database_mongodb_address }} --eval 'db = db.getSiblingDB("{{ ceilometer_database_name }}"); db.createUser({user':' "{{ ceilometer_database_user }}", pwd':' "{{ ceilometer_database_password}}", roles':' [ "readWrite", "dbAdmin" ]})'
register: mongodb_ceilometer_database
run_once: true
failed_when:
- "'already' not in mongodb_ceilometer_database.stdout"
- mongodb_ceilometer_database.stdout.split()[4] != 'connecting'
delegate_to: "{{ groups['mongodb'][0] }}"
when:
- ceilometer_database_type == "mongodb"
- name: Creating Ceilometer mysql database
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
-m mysql_db
-a "login_host='{{ ceilometer_database_mysql_address }}'
login_port='{{ database_port }}'
login_user='{{ database_user }}'
login_password='{{ database_password }}'
name='{{ ceilometer_database_name }}'"
register: mysql_ceilometer_database
changed_when: "{{ mysql_ceilometer_database.stdout.find('localhost | SUCCESS => ') != -1 and
(mysql_ceilometer_database.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
failed_when: mysql_ceilometer_database.stdout.split()[2] != 'SUCCESS'
run_once: True
delegate_to: "{{ groups['ceilometer-api'][0] }}"
when:
- ceilometer_database_type == "mysql"
- name: Creating Ceilometer database user and setting permissions
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
-m mysql_user
-a "login_host='{{ ceilometer_database_mysql_address }}'
login_port='{{ database_port }}'
login_user='{{ database_user }}'
login_password='{{ database_password }}'
name='{{ ceilometer_database_name }}'
password='{{ ceilometer_database_password }}'
host='%'
priv='{{ ceilometer_database_name }}.*:ALL'
append_privs='yes'"
register: database_user_create
changed_when: "{{ database_user_create.stdout.find('localhost | SUCCESS => ') != -1 and
(database_user_create.stdout.split('localhost | SUCCESS => ')[1]|from_json).changed }}"
failed_when: database_user_create.stdout.split()[2] != 'SUCCESS'
run_once: True
delegate_to: "{{ groups['ceilometer-api'][0] }}"
when:
- ceilometer_database_type == "mysql"
# TODO(Jeffrey4l): fix idempotent when ceilomter_database_type == "gnocchi"
- include: bootstrap_service.yml
when: ((ceilometer_database_type == "mongodb" and mongodb_ceilometer_database.changed)
or (ceilometer_database_type == "mysql" and mysql_ceilometer_database.changed)
or ceilometer_database_type == "gnocchi")