From 0382909dbba7069c6d001b47931baa886450afd4 Mon Sep 17 00:00:00 2001 From: Sam Yaple Date: Sun, 26 Jul 2015 10:39:07 +0000 Subject: [PATCH] Rename role name to service name The original purpose for having an abstract like 'database' rather than the service name of 'mariadb' has been change. Our direction is different and this patch reflects consistent naming throughout Change-Id: I704896191cc5243f9dab2a4cca9120e9dc2ceb2c Closes-Bug: #1478328 --- ansible/inventory/all-in-one | 4 ++-- ansible/inventory/multinode | 4 ++-- ansible/roles/haproxy/templates/haproxy.cfg.j2 | 4 ++-- ansible/roles/haproxy/templates/keepalived.conf.j2 | 2 +- .../roles/{database => mariadb}/defaults/main.yml | 0 .../roles/{database => mariadb}/tasks/bootstrap.yml | 2 +- .../roles/{database => mariadb}/tasks/config.yml | 2 +- ansible/roles/{database => mariadb}/tasks/main.yml | 0 .../roles/{database => mariadb}/tasks/register.yml | 0 ansible/roles/{database => mariadb}/tasks/start.yml | 4 ++-- .../{database => mariadb}/templates/galera.cnf.j2 | 2 +- .../{message-broker => rabbitmq}/defaults/main.yml | 0 .../tasks/bootstrap.yml | 0 .../{message-broker => rabbitmq}/tasks/config.yml | 4 ++-- .../{message-broker => rabbitmq}/tasks/main.yml | 0 .../{message-broker => rabbitmq}/tasks/start.yml | 0 .../templates/rabbitmq-env.conf.j2 | 0 .../templates/rabbitmq.config.j2 | 2 +- ansible/site.yml | 13 ++++++------- docs/ansible-deployment.md | 4 ++-- 20 files changed, 23 insertions(+), 24 deletions(-) rename ansible/roles/{database => mariadb}/defaults/main.yml (100%) rename ansible/roles/{database => mariadb}/tasks/bootstrap.yml (99%) rename ansible/roles/{database => mariadb}/tasks/config.yml (83%) rename ansible/roles/{database => mariadb}/tasks/main.yml (100%) rename ansible/roles/{database => mariadb}/tasks/register.yml (100%) rename ansible/roles/{database => mariadb}/tasks/start.yml (81%) rename ansible/roles/{database => mariadb}/templates/galera.cnf.j2 (74%) rename ansible/roles/{message-broker => rabbitmq}/defaults/main.yml (100%) rename ansible/roles/{message-broker => rabbitmq}/tasks/bootstrap.yml (100%) rename ansible/roles/{message-broker => rabbitmq}/tasks/config.yml (74%) rename ansible/roles/{message-broker => rabbitmq}/tasks/main.yml (100%) rename ansible/roles/{message-broker => rabbitmq}/tasks/start.yml (100%) rename ansible/roles/{message-broker => rabbitmq}/templates/rabbitmq-env.conf.j2 (100%) rename ansible/roles/{message-broker => rabbitmq}/templates/rabbitmq.config.j2 (92%) diff --git a/ansible/inventory/all-in-one b/ansible/inventory/all-in-one index c79d87eb97..63771f54a6 100644 --- a/ansible/inventory/all-in-one +++ b/ansible/inventory/all-in-one @@ -15,10 +15,10 @@ localhost ansible_connection=local [haproxy:children] support -[database:children] +[mariadb:children] support -[message-broker:children] +[rabbitmq:children] support [keystone:children] diff --git a/ansible/inventory/multinode b/ansible/inventory/multinode index 116f813ff2..5806f26f3a 100644 --- a/ansible/inventory/multinode +++ b/ansible/inventory/multinode @@ -18,10 +18,10 @@ compute01 [haproxy:children] support -[database:children] +[mariadb:children] support -[message-broker:children] +[rabbitmq:children] support [keystone:children] diff --git a/ansible/roles/haproxy/templates/haproxy.cfg.j2 b/ansible/roles/haproxy/templates/haproxy.cfg.j2 index 07fe7aacf4..ab866c0bc0 100755 --- a/ansible/roles/haproxy/templates/haproxy.cfg.j2 +++ b/ansible/roles/haproxy/templates/haproxy.cfg.j2 @@ -21,7 +21,7 @@ listen mariadb # TODO(SamYaple): Make DB port configurable throughout Ansible bind {{ kolla_internal_address }}:3306 -{% for host in groups['database'] %} +{% for host in groups['mariadb'] %} server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }}:3306 check inter 2000 rise 2 fall 5 {% if not loop.first %}backup{% endif %} {% endfor %} @@ -32,7 +32,7 @@ listen rabbitmq # TODO(SamYaple): Make rabbitmq port configurable throughout Ansible bind {{ kolla_internal_address }}:5672 -{% for host in groups['message-broker'] %} +{% for host in groups['rabbitmq'] %} server {{ hostvars[host]['ansible_hostname'] }} {{ hostvars[host]['ansible_' + api_interface]['ipv4']['address'] }}:5672 check inter 2000 rise 2 fall 5 {% endfor %} diff --git a/ansible/roles/haproxy/templates/keepalived.conf.j2 b/ansible/roles/haproxy/templates/keepalived.conf.j2 index 05062e5bdb..e2c37dab5d 100644 --- a/ansible/roles/haproxy/templates/keepalived.conf.j2 +++ b/ansible/roles/haproxy/templates/keepalived.conf.j2 @@ -8,7 +8,7 @@ vrrp_instance Floating { state MASTER interface {{ api_interface }} virtual_router_id 51 - priority {{ groups['database'].index(inventory_hostname) }} + priority {{ groups['rabbitmq'].index(inventory_hostname) }} advert_int 1 virtual_ipaddress { {{ kolla_internal_address }} diff --git a/ansible/roles/database/defaults/main.yml b/ansible/roles/mariadb/defaults/main.yml similarity index 100% rename from ansible/roles/database/defaults/main.yml rename to ansible/roles/mariadb/defaults/main.yml diff --git a/ansible/roles/database/tasks/bootstrap.yml b/ansible/roles/mariadb/tasks/bootstrap.yml similarity index 99% rename from ansible/roles/database/tasks/bootstrap.yml rename to ansible/roles/mariadb/tasks/bootstrap.yml index 5e98c3b265..8eea886d53 100644 --- a/ansible/roles/database/tasks/bootstrap.yml +++ b/ansible/roles/mariadb/tasks/bootstrap.yml @@ -57,4 +57,4 @@ - "{{ node_config_directory }}/mariadb/:/opt/kolla/mariadb/:ro" container_volumes_from: - "mariadb_data" - when: delegate_host == 'None' and inventory_hostname == groups['database'][0] + when: delegate_host == 'None' and inventory_hostname == groups['mariadb'][0] diff --git a/ansible/roles/database/tasks/config.yml b/ansible/roles/mariadb/tasks/config.yml similarity index 83% rename from ansible/roles/database/tasks/config.yml rename to ansible/roles/mariadb/tasks/config.yml index ce7ff973e7..868ae0524e 100644 --- a/ansible/roles/database/tasks/config.yml +++ b/ansible/roles/mariadb/tasks/config.yml @@ -3,7 +3,7 @@ vars: service_name: "mariadb" config_source: - - "roles/database/templates/galera.cnf.j2" + - "roles/mariadb/templates/galera.cnf.j2" config_template_dest: - "{{ node_templates_directory }}/mariadb/galera.cnf_minimal" config_dest: "{{ node_config_directory }}/mariadb/galera.cnf" diff --git a/ansible/roles/database/tasks/main.yml b/ansible/roles/mariadb/tasks/main.yml similarity index 100% rename from ansible/roles/database/tasks/main.yml rename to ansible/roles/mariadb/tasks/main.yml diff --git a/ansible/roles/database/tasks/register.yml b/ansible/roles/mariadb/tasks/register.yml similarity index 100% rename from ansible/roles/database/tasks/register.yml rename to ansible/roles/mariadb/tasks/register.yml diff --git a/ansible/roles/database/tasks/start.yml b/ansible/roles/mariadb/tasks/start.yml similarity index 81% rename from ansible/roles/database/tasks/start.yml rename to ansible/roles/mariadb/tasks/start.yml index fcddb9e0ca..da0a8d3795 100644 --- a/ansible/roles/database/tasks/start.yml +++ b/ansible/roles/mariadb/tasks/start.yml @@ -9,5 +9,5 @@ - "{{ node_config_directory }}/mariadb/:/opt/kolla/mariadb/:ro" container_volumes_from: - "mariadb_data" - when: delegate_host != 'None' or (groups['database'] | length) == 1 or - ( delegate_host == 'None' and inventory_hostname != groups['database'][0] ) + when: delegate_host != 'None' or (groups['mariadb'] | length) == 1 or + ( delegate_host == 'None' and inventory_hostname != groups['mariadb'][0] ) diff --git a/ansible/roles/database/templates/galera.cnf.j2 b/ansible/roles/mariadb/templates/galera.cnf.j2 similarity index 74% rename from ansible/roles/database/templates/galera.cnf.j2 rename to ansible/roles/mariadb/templates/galera.cnf.j2 index 5f3dbbda04..271d12d7ec 100644 --- a/ansible/roles/database/templates/galera.cnf.j2 +++ b/ansible/roles/mariadb/templates/galera.cnf.j2 @@ -8,7 +8,7 @@ query_cache_type=0 innodb_log_file_size=48M wsrep_provider=/usr/lib64/galera/libgalera_smm.so -wsrep_cluster_address=gcomm://{% if (groups['database'] | length) > 1 %}{% for host in groups['database'] %}{{ hostvars[host]['ansible_hostname'] }}{% if not loop.last %},{% endif %}{% endfor %}{% endif %} +wsrep_cluster_address=gcomm://{% if (groups['mariadb'] | length) > 1 %}{% for host in groups['mariadb'] %}{{ hostvars[host]['ansible_hostname'] }}{% if not loop.last %},{% endif %}{% endfor %}{% endif %} wsrep_cluster_name="{{ database_cluster_name }}" wsrep_node_address={{ hostvars[inventory_hostname]['ansible_' + api_interface]['ipv4']['address'] }} diff --git a/ansible/roles/message-broker/defaults/main.yml b/ansible/roles/rabbitmq/defaults/main.yml similarity index 100% rename from ansible/roles/message-broker/defaults/main.yml rename to ansible/roles/rabbitmq/defaults/main.yml diff --git a/ansible/roles/message-broker/tasks/bootstrap.yml b/ansible/roles/rabbitmq/tasks/bootstrap.yml similarity index 100% rename from ansible/roles/message-broker/tasks/bootstrap.yml rename to ansible/roles/rabbitmq/tasks/bootstrap.yml diff --git a/ansible/roles/message-broker/tasks/config.yml b/ansible/roles/rabbitmq/tasks/config.yml similarity index 74% rename from ansible/roles/message-broker/tasks/config.yml rename to ansible/roles/rabbitmq/tasks/config.yml index 8c6caf5e53..21a5f90ca2 100644 --- a/ansible/roles/message-broker/tasks/config.yml +++ b/ansible/roles/rabbitmq/tasks/config.yml @@ -10,7 +10,7 @@ src: "{{ item.src }}" dest: "{{ item.dest }}" with_items: - - { src: "roles/message-broker/templates/rabbitmq-env.conf.j2", + - { src: "rabbitmq-env.conf.j2", dest: "{{ node_config_directory }}/rabbitmq/rabbitmq-env.conf" } - - { src: "roles/message-broker/templates/rabbitmq.config.j2", + - { src: "rabbitmq.config.j2", dest: "{{ node_config_directory }}/rabbitmq/rabbitmq.config" } diff --git a/ansible/roles/message-broker/tasks/main.yml b/ansible/roles/rabbitmq/tasks/main.yml similarity index 100% rename from ansible/roles/message-broker/tasks/main.yml rename to ansible/roles/rabbitmq/tasks/main.yml diff --git a/ansible/roles/message-broker/tasks/start.yml b/ansible/roles/rabbitmq/tasks/start.yml similarity index 100% rename from ansible/roles/message-broker/tasks/start.yml rename to ansible/roles/rabbitmq/tasks/start.yml diff --git a/ansible/roles/message-broker/templates/rabbitmq-env.conf.j2 b/ansible/roles/rabbitmq/templates/rabbitmq-env.conf.j2 similarity index 100% rename from ansible/roles/message-broker/templates/rabbitmq-env.conf.j2 rename to ansible/roles/rabbitmq/templates/rabbitmq-env.conf.j2 diff --git a/ansible/roles/message-broker/templates/rabbitmq.config.j2 b/ansible/roles/rabbitmq/templates/rabbitmq.config.j2 similarity index 92% rename from ansible/roles/message-broker/templates/rabbitmq.config.j2 rename to ansible/roles/rabbitmq/templates/rabbitmq.config.j2 index 47ba09e858..787d63ae63 100644 --- a/ansible/roles/message-broker/templates/rabbitmq.config.j2 +++ b/ansible/roles/rabbitmq/templates/rabbitmq.config.j2 @@ -10,7 +10,7 @@ {default_pass, <<"{{ rabbitmq_password }}">>}, {cluster_partition_handling, autoheal}, {cluster_nodes, [ - {% for host in groups['database'] %}'rabbit@{{ hostvars[host]['ansible_hostname'] }}'{% if not loop.last %},{% endif %}{% endfor %} + {% for host in groups['rabbitmq'] %}'rabbit@{{ hostvars[host]['ansible_hostname'] }}'{% if not loop.last %},{% endif %}{% endfor %} ]} ]}, diff --git a/ansible/site.yml b/ansible/site.yml index 1b708080be..0dd67b69bc 100755 --- a/ansible/site.yml +++ b/ansible/site.yml @@ -4,16 +4,15 @@ - haproxy tags: haproxy -- hosts: database +- hosts: mariadb roles: - - database - tags: - - database + - mariadb + tags: mariadb -- hosts: message-broker +- hosts: rabbitmq roles: - - message-broker - tags: message-broker + - rabbitmq + tags: rabbitmq - hosts: keystone roles: diff --git a/docs/ansible-deployment.md b/docs/ansible-deployment.md index 402afec4a9..6e3e8c9146 100644 --- a/docs/ansible-deployment.md +++ b/docs/ansible-deployment.md @@ -86,8 +86,8 @@ To run the playbooks for only a particular service, Ansible tags can be used. Multiple tags may be specified, and order is still determined by the playbooks. cd ./kolla/ansible - ansible-playbook -i inventory/all-in-one -e @/etc/kolla/defaults.yml -e @/etc/kolla/globals.yml -e @/etc/kolla/passwords.yml site.yml --tags message-broker - ansible-playbook -i inventory/all-in-one -e @/etc/kolla/defaults.yml -e @/etc/kolla/globals.yml -e @/etc/kolla/passwords.yml site.yml --tags message-broker,database + ansible-playbook -i inventory/all-in-one -e @/etc/kolla/defaults.yml -e @/etc/kolla/globals.yml -e @/etc/kolla/passwords.yml site.yml --tags rabbitmq + ansible-playbook -i inventory/all-in-one -e @/etc/kolla/defaults.yml -e @/etc/kolla/globals.yml -e @/etc/kolla/passwords.yml site.yml --tags rabbitmq,mariadb Further Reading