diff --git a/defaults/main.yml b/defaults/main.yml index 3568977..4c95d74 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -120,19 +120,24 @@ zun_rpc_thread_pool_size: 64 zun_rpc_conn_pool_size: 30 zun_rpc_response_timeout: 60 -zun_rabbitmq_servers: 127.0.0.1 -zun_rabbitmq_port: 5672 -zun_rabbitmq_userid: zun -zun_rabbitmq_vhost: /zun -zun_rabbitmq_use_ssl: False +## Oslo Messaging info -## Configuration for notifications communication, i.e. [oslo_messaging_notifications] -zun_rabbitmq_telemetry_userid: "{{ zun_rabbitmq_userid }}" -zun_rabbitmq_telemetry_password: "{{ zun_rabbitmq_password }}" -zun_rabbitmq_telemetry_vhost: "{{ zun_rabbitmq_vhost }}" -zun_rabbitmq_telemetry_port: "{{ zun_rabbitmq_port }}" -zun_rabbitmq_telemetry_servers: "{{ zun_rabbitmq_servers }}" -zun_rabbitmq_telemetry_use_ssl: "{{ zun_rabbitmq_use_ssl }}" +# RPC +zun_oslomsg_rpc_transport: rabbit +zun_oslomsg_rpc_servers: 127.0.0.1 +zun_oslomsg_rpc_port: 5672 +zun_oslomsg_rpc_use_ssl: False +zun_oslomsg_rpc_userid: zun +zun_oslomsg_rpc_vhost: /zun + +# Notify +zun_oslomsg_notify_transport: rabbit +zun_oslomsg_notify_servers: 127.0.0.1 +zun_oslomsg_notify_port: 5672 +zun_oslomsg_notify_use_ssl: False +zun_oslomsg_notify_userid: "{{ zun_oslomsg_rpc_userid }}" +zun_oslomsg_notify_password: "{{ zun_oslomsg_rpc_password }}" +zun_oslomsg_notify_vhost: "{{ zun_oslomsg_rpc_vhost }}" # If this is not set, then the playbook will try to guess it. #zun_virt_type: kvm @@ -238,6 +243,13 @@ zun_pip_packages: - pymysql - zun +## (Qdrouterd) integration +# TODO(ansmith): Change structure when more backends will be supported +zun_oslomsg_amqp1_enabled: "{{ zun_oslomsg_rpc_transport == 'amqp' }}" + +zun_optional_oslomsg_amqp1_pip_packages: + - oslo.messaging[amqp1] + ## Default service options used within all systemd unit files. zun_service_defaults: {} diff --git a/tasks/zun_amqp_setup.yml b/tasks/zun_amqp_setup.yml index 437f919..4e4300a 100644 --- a/tasks/zun_amqp_setup.yml +++ b/tasks/zun_amqp_setup.yml @@ -13,20 +13,21 @@ # See the License for the specific language governing permissions and # limitations under the License. +# TODO(ansmith): change to common messaging setup - name: Ensure Rabbitmq vhost rabbitmq_vhost: - name: "{{ zun_rabbitmq_vhost }}" + name: "{{ zun_oslomsg_rpc_vhost }}" state: "present" - delegate_to: "{{ groups['rabbitmq_all'][0] }}" + delegate_to: "{{ groups['oslomsg_rpc_all'][0] }}" - name: Ensure rabbitmq user rabbitmq_user: - user: "{{ zun_rabbitmq_userid }}" - password: "{{ zun_rabbitmq_password }}" - vhost: "{{ zun_rabbitmq_vhost }}" + user: "{{ zun_oslomsg_rpc_userid }}" + password: "{{ zun_oslomsg_rpc_password }}" + vhost: "{{ zun_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 diff --git a/tasks/zun_install.yml b/tasks/zun_install.yml index a66bd01..b4695b1 100644 --- a/tasks/zun_install.yml +++ b/tasks/zun_install.yml @@ -99,6 +99,23 @@ tags: - zun-pip-packages +- name: Install optional pip packages + pip: + name: "{{ zun_optional_oslomsg_amqp1_pip_packages }}" + state: "{{ zun_pip_package_state }}" + virtualenv: "{{ zun_bin | dirname }}" + virtualenv_site_packages: "no" + when: zun_oslomsg_amqp1_enabled + register: install_optional_packages + until: install_optional_packages is success + retries: 5 + delay: 2 + notify: + - Manage LB + - Restart zun services + tags: + - zun-pip-packages + - name: Remove python from path first (CentOS, openSUSE) file: path: "{{ zun_bin | dirname }}/bin/python2.7" diff --git a/tasks/zun_pre_flight.yml b/tasks/zun_pre_flight.yml index d64ef39..e69f74d 100644 --- a/tasks/zun_pre_flight.yml +++ b/tasks/zun_pre_flight.yml @@ -24,21 +24,21 @@ - "zun_api" - "zun_compute" -- name: Check for rabbitmq_all group +- name: Check for oslomsg_rpc_all group fail: msg: >- - The group `rabbitmq_all` is undefined. Before moving forward + The group `oslomsg_rpc_all` is undefined. Before moving forward set this group within inventory with at least one host. when: - - (groups['rabbitmq_all'] | length) < 1 + - (groups['oslomsg_rpc_all'] | length) < 1 -- name: Check for rabbitmq password +- name: Check for oslomsg_rpc_password fail: msg: >- - The variable `zun_rabbitmq_password` is undefined. Before moving forward + The variable `zun_oslomsg_rpc_password` is undefined. Before moving forward set this variable on the CLI or in a variable file. when: - - zun_rabbitmq_password is undefined + - zun_oslomsg_rpc_password is undefined - name: Check for galera_all group fail: diff --git a/templates/zun.conf.j2 b/templates/zun.conf.j2 index 2a95160..3d0bbb7 100644 --- a/templates/zun.conf.j2 +++ b/templates/zun.conf.j2 @@ -290,7 +290,7 @@ rpc_conn_pool_size = {{ zun_rpc_conn_pool_size }} # oslo_messaging.TransportURL at # https://docs.openstack.org/oslo.messaging/latest/reference/transport.html # (string value) -transport_url = rabbit://{% for host in zun_rabbitmq_servers.split(',') %}{{ zun_rabbitmq_userid }}:{{ zun_rabbitmq_password }}@{{ host }}:{{ zun_rabbitmq_port }}{% if not loop.last %},{% else %}/{{ zun_rabbitmq_vhost }}{% endif %}{% endfor %} +transport_url = {{ zun_oslomsg_rpc_transport }}://{% for host in zun_oslomsg_rpc_servers.split(',') %}{{ zun_oslomsg_rpc_userid }}:{{ zun_oslomsg_rpc_password }}@{{ host }}:{{ zun_oslomsg_rpc_port }}{% if not loop.last %},{% else %}/{{ zun_oslomsg_rpc_vhost }}{% if (zun_oslomsg_rpc_use_ssl | lower) | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} # DEPRECATED: The messaging driver to use, defaults to rabbit. Other drivers # include amqp and zmq. (string value) @@ -1603,7 +1603,7 @@ driver = messagingv2 # we fall back to the same configuration used for RPC. (string value) # Deprecated group/name - [DEFAULT]/notification_transport_url #transport_url = -transport_url = rabbit://{% for host in zun_rabbitmq_telemetry_servers.split(',') %}{{ zun_rabbitmq_telemetry_userid }}:{{ zun_rabbitmq_telemetry_password }}@{{ host }}:{{ zun_rabbitmq_telemetry_port }}{% if not loop.last %},{% else %}/{{ zun_rabbitmq_telemetry_vhost }}{% endif %}{% endfor %} +transport_url = {{ zun_oslomsg_notify_transport }}://{% for host in zun_oslomsg_notify_servers.split(',') %}{{ zun_oslomsg_notify_userid }}:{{ zun_oslomsg_notify_password }}@{{ host }}:{{ zun_oslomsg_notify_port }}{% if not loop.last %},{% else %}/{{ zun_oslomsg_notify_vhost }}{% if (zun_oslomsg_notify_use_ssl | lower) | bool %}?ssl=1{% else %}?ssl=0{% endif %}{% endif %}{% endfor %} # AMQP topic used for OpenStack notifications. (list value) # Deprecated group/name - [rpc_notifier2]/topics @@ -1643,7 +1643,7 @@ topics = {{ notification_topics | join(',') }} # Connect over SSL. (boolean value) # Deprecated group/name - [oslo_messaging_rabbit]/rabbit_use_ssl #ssl = false -ssl = {{ zun_rabbitmq_use_ssl }} +ssl = {{ zun_oslomsg_notify_use_ssl | bool }} # SSL version to use (valid only if SSL enabled). Valid values are TLSv1 and # SSLv23. SSLv2, SSLv3, TLSv1_1, and TLSv1_2 may be available on some diff --git a/tests/inventory b/tests/inventory index a627174..6b6b654 100644 --- a/tests/inventory +++ b/tests/inventory @@ -7,6 +7,12 @@ openstack1 infra1 openstack1 +[oslomsg_rpc_all] +infra1 + +[oslomsg_notify_all] +infra1 + [rabbitmq_all] infra1 diff --git a/tests/test-install-zun.yml b/tests/test-install-zun.yml index 7fcd070..678ccbb 100644 --- a/tests/test-install-zun.yml +++ b/tests/test-install-zun.yml @@ -18,12 +18,14 @@ remote_user: root roles: - role: "os_zun" - zun_rabbitmq_password: secrete + zun_oslomsg_rpc_password: secrete + zun_oslomsg_notify_password: "{{ zun_oslomsg_rpc_password }}" zun_galera_password: secrete zun_service_password: secrete zun_kuryr_service_password: secrete zun_developer_mode: true - zun_rabbitmq_servers: "{{ hostvars[groups['rabbitmq_all'][0]]['ansible_host'] }}" + zun_oslomsg_rpc_servers: "{{ hostvars[groups['oslomsg_rpc_all'][0]]['ansible_host'] }}" + zun_oslomsg_notify_servers: "{{ hostvars[groups['oslomsg_notify_all'][0]]['ansible_host'] }}" zun_service_publicuri: "http://{{ hostvars[groups['keystone_all'][0]]['ansible_host'] }}:9517" zun_service_adminuri: "http://{{ hostvars[groups['keystone_all'][0]]['ansible_host'] }}:9517" zun_service_internaluri: "http://{{ hostvars[groups['keystone_all'][0]]['ansible_host'] }}:9517"