Merge "Allow flexibility in mysql backend for ceilometer"
This commit is contained in:
commit
b3ef02193d
@ -7,9 +7,10 @@ project_name: "ceilometer"
|
|||||||
####################
|
####################
|
||||||
ceilometer_database_name: "ceilometer"
|
ceilometer_database_name: "ceilometer"
|
||||||
ceilometer_database_user: "ceilometer"
|
ceilometer_database_user: "ceilometer"
|
||||||
|
ceilometer_database_port: "{{ mondodb_port if ceilometer_database_type == 'mongodb' else database_port }}"
|
||||||
|
|
||||||
ceilometer_database_mongodb_address: "{% for host in groups['mongodb'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ mongodb_port }}{% if not loop.last %},{% endif %}{% endfor %}"
|
ceilometer_database_mongodb_address: "{% for host in groups['mongodb'] %}{{ hostvars[host]['ansible_' + hostvars[host]['api_interface']]['ipv4']['address'] }}:{{ ceilometer_database_port }}{% if not loop.last %},{% endif %}{% endfor %}"
|
||||||
ceilometer_database_mysql_address: "{{ kolla_internal_fqdn }}:{{ database_port }}"
|
ceilometer_database_mysql_address: "{{ kolla_internal_fqdn }}:{{ ceilometer_database_port }}"
|
||||||
|
|
||||||
|
|
||||||
####################
|
####################
|
||||||
|
@ -10,11 +10,26 @@
|
|||||||
when:
|
when:
|
||||||
- ceilometer_database_type == "mongodb"
|
- ceilometer_database_type == "mongodb"
|
||||||
|
|
||||||
|
- name: Checking 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='{{ ceilometer_database_port }}'
|
||||||
|
login_user='{{ ceilometer_database_user }}'
|
||||||
|
login_password='{{ ceilometer_database_password }}'
|
||||||
|
name='{{ ceilometer_database_name }}'"
|
||||||
|
register: mysql_access
|
||||||
|
failed_when: False
|
||||||
|
changed_when: False
|
||||||
|
run_once: True
|
||||||
|
when:
|
||||||
|
- ceilometer_database_type == "mysql"
|
||||||
|
|
||||||
- name: Creating Ceilometer mysql database
|
- name: Creating Ceilometer mysql database
|
||||||
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
|
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
|
||||||
-m mysql_db
|
-m mysql_db
|
||||||
-a "login_host='{{ ceilometer_database_mysql_address }}'
|
-a "login_host='{{ ceilometer_database_mysql_address }}'
|
||||||
login_port='{{ database_port }}'
|
login_port='{{ ceilometer_database_port }}'
|
||||||
login_user='{{ database_user }}'
|
login_user='{{ database_user }}'
|
||||||
login_password='{{ database_password }}'
|
login_password='{{ database_password }}'
|
||||||
name='{{ ceilometer_database_name }}'"
|
name='{{ ceilometer_database_name }}'"
|
||||||
@ -26,12 +41,13 @@
|
|||||||
delegate_to: "{{ groups['ceilometer-api'][0] }}"
|
delegate_to: "{{ groups['ceilometer-api'][0] }}"
|
||||||
when:
|
when:
|
||||||
- ceilometer_database_type == "mysql"
|
- ceilometer_database_type == "mysql"
|
||||||
|
- "'FAILED' in mysql_access.stdout"
|
||||||
|
|
||||||
- name: Creating Ceilometer database user and setting permissions
|
- name: Creating Ceilometer database user and setting permissions
|
||||||
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
|
command: docker exec -t kolla_toolbox /usr/bin/ansible localhost
|
||||||
-m mysql_user
|
-m mysql_user
|
||||||
-a "login_host='{{ ceilometer_database_mysql_address }}'
|
-a "login_host='{{ ceilometer_database_mysql_address }}'
|
||||||
login_port='{{ database_port }}'
|
login_port='{{ ceilometer_database_port }}'
|
||||||
login_user='{{ database_user }}'
|
login_user='{{ database_user }}'
|
||||||
login_password='{{ database_password }}'
|
login_password='{{ database_password }}'
|
||||||
name='{{ ceilometer_database_name }}'
|
name='{{ ceilometer_database_name }}'
|
||||||
@ -47,9 +63,11 @@
|
|||||||
delegate_to: "{{ groups['ceilometer-api'][0] }}"
|
delegate_to: "{{ groups['ceilometer-api'][0] }}"
|
||||||
when:
|
when:
|
||||||
- ceilometer_database_type == "mysql"
|
- ceilometer_database_type == "mysql"
|
||||||
|
- "'FAILED' in mysql_access.stdout"
|
||||||
|
|
||||||
# TODO(Jeffrey4l): fix idempotent when ceilomter_database_type == "gnocchi"
|
# TODO(Jeffrey4l): fix idempotent when ceilomter_database_type == "gnocchi"
|
||||||
|
# NOTE(vbel): bootstrapping of mysql db for ceilometer is idempotent
|
||||||
- include: bootstrap_service.yml
|
- include: bootstrap_service.yml
|
||||||
when: ((ceilometer_database_type == "mongodb" and mongodb_ceilometer_database.changed)
|
when: ((ceilometer_database_type == "mongodb" and mongodb_ceilometer_database.changed)
|
||||||
or (ceilometer_database_type == "mysql" and mysql_ceilometer_database.changed)
|
or ceilometer_database_type == "mysql"
|
||||||
or ceilometer_database_type == "gnocchi")
|
or ceilometer_database_type == "gnocchi")
|
||||||
|
Loading…
x
Reference in New Issue
Block a user