diff --git a/defaults/main.yml b/defaults/main.yml index 122837a..d9359d0 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -59,14 +59,31 @@ tacker_system_shell: /bin/false tacker_system_comment: tacker system user tacker_system_user_home: "/var/lib/{{ tacker_system_user_name }}" +## Configuration for Oslo Messaging -## RabbitMQ info +# RPC +tacker_oslomsg_rpc_transport: rabbit +tacker_oslomsg_rpc_servers: "{{ oslomsg_rpc_all|default('127.0.0.1') }}" +tacker_oslomsg_rpc_port: 5672 +tacker_oslomsg_rpc_use_ssl: False +tacker_oslomsg_rpc_userid: tacker +tacker_oslomsg_rpc_vhost: /tacker -tacker_rabbitmq_userid: tacker -tacker_rabbitmq_vhost: /tacker -glance_rabbitmq_port: 5672 -glance_rabbitmq_servers: 127.0.0.1 -glance_rabbitmq_use_ssl: False +# Notify +tacker_oslomsg_notify_transport: rabbit +tacker_oslomsg_notify_servers: "{{ oslomsg_notify_all|default('127.0.0.1') }}" +tacker_oslomsg_notify_port: 5672 +tacker_oslomsg_notify_use_ssl: False +tacker_oslomsg_notify_userid: "{{ tacker_oslomsg_rpc_userid }}" +tacker_oslomsg_notify_password: "{{ tacker_oslomsg_rpc_password }}" +tacker_oslomsg_notify_vhost: "{{ tacker_oslomsg_rpc_vhost }}" + +## (Qdrouterd) integration +# TODO(ansmith): Change structure when more backends will be supported +tacker_oslomsg_amqp1_enabled: "{{ tacker_oslomsg_rpc_transport == 'amqp' }}" + +tacker_optional_oslomsg_amqp1_pip_packages: + - oslo.messaging[amqp1] ## Database info tacker_db_setup_host: "{{ ('galera_all' in groups) | ternary(groups['galera_all'][0], 'localhost') }}" diff --git a/tasks/tacker_install.yml b/tasks/tacker_install.yml index 440ab96..310fe09 100644 --- a/tasks/tacker_install.yml +++ b/tasks/tacker_install.yml @@ -96,6 +96,20 @@ notify: - Restart tacker services +- name: Install optional pip packages + pip: + name: "{{ tacker_optional_oslomsg_amqp1_pip_packages }}" + state: "{{ tacker_pip_package_state }}" + virtualenv: "{{ tacker_bin | dirname }}" + virtualenv_site_packages: "no" + when: tacker_oslomsg_amqp1_enabled + register: install_optional_packages + until: install_optional_packages is success + retries: 5 + delay: 2 + notify: + - Restart tacker services + - name: Remove python from path first (CentOS, openSUSE) file: path: "{{ tacker_bin | dirname }}/bin/python2.7" diff --git a/tasks/tacker_messaging_setup.yml b/tasks/tacker_messaging_setup.yml index ae38632..4767594 100644 --- a/tasks/tacker_messaging_setup.yml +++ b/tasks/tacker_messaging_setup.yml @@ -1,26 +1,26 @@ --- # tacker messaging setup - +# TODO(ansmith): change to common messaging setup - name: Ensure Rabbitmq vhost rabbitmq_vhost: - name: "{{ tacker_rabbitmq_vhost }}" + name: "{{ tacker_oslomsg_rpc_vhost }}" state: "present" - delegate_to: "{{ groups['rabbitmq_all'][0] }}" + delegate_to: "{{ groups['oslomsg_rpc_all'][0] }}" tags: - tacker-rabbitmq - tacker-rabbitmq-vhost - name: Ensure rabbitmq user rabbitmq_user: - user: "{{ tacker_rabbitmq_userid }}" - password: "{{ tacker_rabbitmq_password }}" - vhost: "{{ tacker_rabbitmq_vhost }}" + user: "{{ tacker_oslomsg_rpc_userid }}" + password: "{{ tacker_oslomsg_rpc_password }}" + vhost: "{{ tacker_oslomsg_rpc_vhost }}" configure_priv: ".*" read_priv: ".*" write_priv: ".*" state: "present" - delegate_to: "{{ groups['rabbitmq_all'][0] }}" + delegate_to: "{{ groups['oslomsg_rpc_all'][0] }}" no_log: true tags: - tacker-rabbitmq diff --git a/templates/tacker.conf.j2 b/templates/tacker.conf.j2 index 0c31207..2c3879f 100644 --- a/templates/tacker.conf.j2 +++ b/templates/tacker.conf.j2 @@ -4,6 +4,8 @@ verbose = {{ verbose }} debug = {{ debug }} +# oslo.messaging rpc transport +transport_url = {{ tacker_oslomsg_rpc_transport }}://{% for host in tacker_oslomsg_rpc_servers.split(',') %}{{ tacker_oslomsg_rpc_userid }}:{{ tacker_oslomsg_rpc_password }}@{{ host }}:{{ tacker_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ tacker_oslomsg_rpc_vhost }}{% if (tacker_oslomsg_rpc_use_ssl | lower) | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} # Where to store Tacker state files. This directory must be writable by the # user executing the agent. @@ -103,3 +105,9 @@ monitor_driver = ping, http_ping [vim_keys] openstack = {{ tacker_etc_dir }}/vim/fernet_keys + +[oslo_messaging_rabbit] +ssl = {{ tacker_oslomsg_notify_use_ssl | bool }} + +[oslo_messaging_notifications] +transport_url = {{ tacker_oslomsg_notify_transport }}://{% for host in tacker_oslomsg_notify_servers.split(',') %}{{ tacker_oslomsg_notify_userid }}:{{ tacker_oslomsg_notify_password }}@{{ host }}:{{ tacker_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ tacker_oslomsg_notify_vhost }}{% if (tacker_oslomsg_notify_use_ssl | lower) | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} diff --git a/tests/inventory b/tests/inventory index 9e0b85d..333b3ac 100644 --- a/tests/inventory +++ b/tests/inventory @@ -7,6 +7,12 @@ tacker1 infra1 tacker1 +[oslomsg_rpc_all] +infra1 + +[oslomsg_notify_all] +infra1 + [rabbitmq_all] infra1 diff --git a/tests/os_tacker-overrides.yml b/tests/os_tacker-overrides.yml index 0dbae15..441b83c 100644 --- a/tests/os_tacker-overrides.yml +++ b/tests/os_tacker-overrides.yml @@ -14,16 +14,21 @@ # limitations under the License. tacker_service_tenant_name: service -tacker_rabbitmq_port: "{{ rabbitmq_port }}" -tacker_rabbitmq_use_ssl: "{{ rabbitmq_use_ssl }}" -tacker_rabbitmq_servers: "{{ rabbitmq_servers }}" -tacker_rabbitmq_host_group: "{{ rabbitmq_host_group }}" +tacker_oslomsg_rpc_port: "{{ oslomsg_rpc_port }}" +tacker_oslomsg_rpc_use_ssl: "{{ oslomsg_rpc_use_ssl }}" +tacker_oslomsg_rpc_servers: "{{ oslomsg_rpc_servers }}" +tacker_oslomsg_rpc_host_group: "{{ oslomsg_rpc_host_group }}" +tacker_oslomsg_notify_port: "{{ oslomsg_notify_port }}" +tacker_oslomsg_notify_use_ssl: "{{ oslomsg_notify_use_ssl }}" +tacker_oslomsg_notify_servers: "{{ oslomsg_notify_servers }}" +tacker_oslomsg_notify_host_group: "{{ oslomsg_notify_host_group }}" tacker_service_publicuri: "{{ tacker_service_proto }}://{{ hostvars[groups['tacker_all'][0]]['ansible_host'] }}:{{ tacker_service_port }}" tacker_service_adminurl: "{{ tacker_service_proto }}://{{ hostvars[groups['tacker_all'][0]]['ansible_host'] }}:{{ tacker_service_port }}" tacker_service_adminuri: "{{ tacker_service_proto }}://{{ hostvars[groups['tacker_all'][0]]['ansible_host'] }}:{{ tacker_service_port }}" tacker_aodh_enabled: false tacker_gnocchi_enabled: false -tacker_rabbitmq_password: "secrete" +tacker_oslomsg_rpc_password: "secrete" +tacker_oslomsg_notify_password: "{{ tacker_oslomsg_rpc_password }}" tacker_service_password: "secrete" tacker_container_mysql_password: "secrete" tacker_developer_mode: true diff --git a/tests/test-install-tacker.yml b/tests/test-install-tacker.yml index df540e5..07eed23 100644 --- a/tests/test-install-tacker.yml +++ b/tests/test-install-tacker.yml @@ -19,11 +19,13 @@ gather_facts: true any_errors_fatal: true pre_tasks: - - include: common/ensure-rabbitmq.yml - vhost_name: "{{ tacker_rabbitmq_vhost }}" - user_name: "{{ tacker_rabbitmq_userid }}" - user_password: "{{ tacker_rabbitmq_password }}" - when: groups['rabbitmq_all'] is defined + - include: common/ensure-oslomsg.yml + rpc_vhost: "{{ tacker_oslomsg_rpc_vhost }}" + rpc_user: "{{ tacker_oslomsg_rpc_userid }}" + rpc_password: "{{ tacker_oslomsg_rpc_password }}" + notify_vhost: "{{ tacker_oslomsg_notify_vhost }}" + notify_user: "{{ tacker_oslomsg_notify_userid }}" + notify_password: "{{ tacker_oslomsg_notify_password }}" roles: - role: os_tacker vars_files: