Guys, Currently, I have an Ansible automation to deploy OpenStack, it works great but, starting from Mitaka, Nova requires two SQL databases (nova and nova_api), and not just only one anymore.
So, for Liberty, I have something like this: group_vars/all: (https://github.com/tmartinx/svauto/blob/dev/ansible/group_vars/all) --- mysql_databases: - { os_project: "keystone", db_name: "keystone", db_host: "%", db_user: "keystoneUser", db_pass: "keystonePass" } - { os_project: "glance", db_name: "glance", db_host: "%", db_user: "glanceUser", db_pass: "glancePass" } - { os_project: "nova", db_name: "nova", db_host: "%", db_user: "novaUser", db_pass: "novaPass" } --- And inside of my Nova task, I have this: (https://github.com/tmartinx/svauto/blob/dev/ansible/roles/os_nova_aio/tasks/main.yml) --- - name: Updating nova.conf template: src={{openstack_release}}/nova.conf dest=/etc/nova/nova.conf owner=nova group=nova mode=0640 backup=yes when: item.os_project == "nova" with_items: mysql_databases notify: restart-nova --- That uses the nova.conf template: --- [database] connection = mysql+pymysql://{{item.db_user}}:{{item.db_pass}}@{{controller_addr}}/{{item.db_name}} --- This works like a charm for Liberty, but, I am unable to figure out how to add more databases... Here is what I am trying to do for Mitaka (which does not work), as follows: --- mysql_databases: - { os_project: "keystone", db_name: "keystone", db_host: "%", db_user: "keystoneUser", db_pass: "keystonePass" } - { os_project: "glance", db_name: "glance", db_host: "%", db_user: "glanceUser", db_pass: "glancePass" } - { os_project: "nova", db_name: "nova", db_host: "%", db_user: "novaUser", db_pass: "novaPass" } - { os_project: "nova_api", db_name: "nova_api", db_host: "%", db_user: "novaAPIUser", db_pass: "novaAPIPass" } --- NOTE: My "os_mysql_db" role creates "nova_api" DB as expected (https://github.com/tmartinx/svauto/blob/dev/ansible/roles/os_mysql_db/tasks/main.yml). New Nova task (this does not work): --- - name: Updating nova.conf template: src={{openstack_release}}/nova.conf dest=/etc/nova/nova.conf owner=nova group=nova mode=0640 backup=yes when: - item.os_project == "nova" - item.os_project == "nova_api" with_items: mysql_databases notify: restart-nova --- And New template (being ignored, not working): --- [database] connection = mysql+pymysql://{{item.db_user}}:{{item.db_pass}}@{{controller_addr}}/{{item.db_name}} [api_database] connection = mysql+pymysql://{{item.db_user}}:{{item.db_pass}}@{{controller_addr}}/{{item.db_name}} --- But, of curse, I am doing it wrong (it is not somehow, iterating over the two)... Any tips? I also tried a different task, like this: --- - name: Updating nova.conf template: src={{openstack_release}}/nova.conf dest=/etc/nova/nova.conf owner=nova group=nova mode=0640 backup=yes when: item.os_project == "nova" and item.os_project == "nova_api" with_items: mysql_databases notify: restart-nova --- But didn't worked either... I really appreciate any help! Thanks in advance! Best, Thiago -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/7bcf84b1-9d0f-45df-95a1-5e836b186d0e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
