diff --git a/playbooks/roles/bifrost-ironic-install/defaults/main.yml b/playbooks/roles/bifrost-ironic-install/defaults/main.yml index 032c5622e..c978e895c 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/main.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/main.yml @@ -23,6 +23,8 @@ transform_boot_image: false # virtual machines for the hardware instead of real hardware. testing: false ci_testing: false +# Use Rabbit MQ as a message bus. +use_rabbitmq: true # set to true to skip installing ironic dependencies skip_package_install: False diff --git a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Debian_family.yml b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Debian_family.yml index e8c87ccdc..8b3e5190b 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Debian_family.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Debian_family.yml @@ -10,7 +10,6 @@ mysql_service_name: mysql tftp_service_name: tftpd-hpa required_packages: - mysql-server - - rabbitmq-server - python-dev - python-mysqldb - python-configparser diff --git a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Debian_jessie.yml b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Debian_jessie.yml index ef512aeb1..d4af668b2 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Debian_jessie.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Debian_jessie.yml @@ -8,7 +8,6 @@ nginx_user: www-data mysql_service_name: mysql required_packages: - mysql-server - - rabbitmq-server - python-dev - python-mysqldb - python-configparser diff --git a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Fedora_25.yml b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Fedora_25.yml index 4db3b9cf4..af362c314 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Fedora_25.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Fedora_25.yml @@ -11,7 +11,6 @@ tftp_service_name: tftp required_packages: - mariadb-server - dnsmasq - - rabbitmq-server - python-devel - MySQL-python - libselinux-python diff --git a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Fedora_26.yml b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Fedora_26.yml index f0d3d5190..892c05955 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Fedora_26.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Fedora_26.yml @@ -11,7 +11,6 @@ tftp_service_name: tftp required_packages: - mariadb-server - dnsmasq - - rabbitmq-server - python-devel - MySQL-python - libselinux-python diff --git a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Fedora_27.yml b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Fedora_27.yml index f0d3d5190..892c05955 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Fedora_27.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Fedora_27.yml @@ -11,7 +11,6 @@ tftp_service_name: tftp required_packages: - mariadb-server - dnsmasq - - rabbitmq-server - python-devel - MySQL-python - libselinux-python diff --git a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_RedHat_family.yml b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_RedHat_family.yml index a7f194096..529b9ac31 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_RedHat_family.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_RedHat_family.yml @@ -11,7 +11,6 @@ tftp_service_name: tftp required_packages: - mariadb-server - dnsmasq - - rabbitmq-server - python-devel - MySQL-python - python-iniparse diff --git a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Suse_family.yml b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Suse_family.yml index cf1549059..19fc66a2f 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Suse_family.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Suse_family.yml @@ -17,7 +17,6 @@ required_packages: - python-selinux - mariadb-server - dnsmasq - - rabbitmq-server - python-devel - python-MySQL-python - python-iniparse diff --git a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Ubuntu_16.04.yml b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Ubuntu_16.04.yml index 2dafa300c..e0e82a68f 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Ubuntu_16.04.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_Ubuntu_16.04.yml @@ -4,7 +4,6 @@ init_dest_dir: /lib/systemd/system/ init_ext: .service required_packages: - mysql-server - - rabbitmq-server - python-dev - python-mysqldb - python-configparser diff --git a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_openSUSE_Leap_15.0.yml b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_openSUSE_Leap_15.0.yml index f726b7266..845de1286 100644 --- a/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_openSUSE_Leap_15.0.yml +++ b/playbooks/roles/bifrost-ironic-install/defaults/required_defaults_openSUSE_Leap_15.0.yml @@ -17,7 +17,6 @@ required_packages: - python-selinux - mariadb-server - dnsmasq - - rabbitmq-server - python-devel - python-iniparse - libffi-devel diff --git a/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml b/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml index 7fae68ebb..25944c1e0 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/bootstrap.yml @@ -42,43 +42,6 @@ service: name={{ mysql_service_name }} state=started enabled=yes when: ironic.database.host == 'localhost' -# NOTE(hwoarang): The erlang SUSE package forces epmd to listen on localhost -# address which breaks rabbitmq-server when listening on a different address. -# https://build.opensuse.org/package/view_file/devel:languages:erlang:Factory/erlang/README.SUSE?expand=1 -- name: "Make epmd listen to all addresses on SUSE" - block: - - blockinfile: - dest: "/etc/systemd/system/epmd.socket.d/port.conf" - content: | - [Socket] - ListenStream= - ListenStream=0.0.0.0:4369 - create: yes - marker: "# {mark} ANSIBLE MANAGED BLOCK" - - - systemd: daemon_reload=yes - - - service: name={{ item }} state=stopped enabled=no - with_items: - - epmd.socket - - epmd - - when: ansible_os_family == 'Suse' -- name: "Start rabbitmq-server" - service: name=rabbitmq-server state=started enabled=yes - -# NOTE(cinerama): on some systems, rabbit may not be ready when we want to -# make changes to users if we don't wait first -# TODO(TheJulia): This needs to be changed to a variable, however -# should update this playbook all at once with new variable structures. -- name: "Wait for rabbitmq" - wait_for: port=5672 delay=5 - -- name: "Ensure guest user is removed from rabbitmq" - rabbitmq_user: - user: "guest" - state: absent - force: yes - name: "Create ironic user in RabbitMQ" rabbitmq_user: user: "ironic" @@ -89,6 +52,7 @@ write_priv: ".*" read_priv: ".*" no_log: true + when: use_rabbitmq - name: "Set mysql_username if environment variable mysql_user is set" set_fact: diff --git a/playbooks/roles/bifrost-ironic-install/tasks/main.yml b/playbooks/roles/bifrost-ironic-install/tasks/main.yml index d43b098d1..72ee4199e 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/main.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/main.yml @@ -51,6 +51,11 @@ - "../defaults/required_defaults_{{ ansible_distribution | regex_replace(' ', '_') }}_{{ ansible_distribution_version }}.yml" - "../defaults/dummy-defaults.yml" +- name: "Install RabbitMQ if required" + import_role: + name: bifrost-rabbitmq + when: use_rabbitmq + - name: "Install Ironic deps" include: install.yml when: skip_package_install | bool != True diff --git a/playbooks/roles/bifrost-ironic-install/tasks/start.yml b/playbooks/roles/bifrost-ironic-install/tasks/start.yml index c9e463cc3..2bf19a458 100644 --- a/playbooks/roles/bifrost-ironic-install/tasks/start.yml +++ b/playbooks/roles/bifrost-ironic-install/tasks/start.yml @@ -24,8 +24,10 @@ - name: "Start database service" service: name={{ mysql_service_name }} state=started enabled=yes -- name: "Start rabbitmq-server" - service: name=rabbitmq-server state=started enabled=yes +- import_role: + name: bifrost-rabbitmq + tasks_from: start + when: use_rabbitmq - name: "start ironic-inspector" include: inspector_start.yml diff --git a/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 b/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 index f2e406363..425a70a72 100644 --- a/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 +++ b/playbooks/roles/bifrost-ironic-install/templates/ironic-inspector.conf.j2 @@ -15,7 +15,11 @@ debug = {{ inspector_debug | bool }} log_dir = {{ inspector_log_dir }} {% endif %} +{% if use_rabbitmq is defined and use_rabbitmq | bool == true %} transport_url = rabbit://ironic:{{ironic_db_password }}@{{ message_queue_host | default('127.0.0.1') }}:{{ message_queue_port | default('5672') }}/{{ rabbit_virtual_host | default('') }} +{% else %} +transport_url = fake:// +{% endif %} [database] connection=mysql+pymysql://{{ ironic_inspector.database.username }}:{{ ironic_inspector.database.password }}@{{ ironic_inspector.database.host }}/{{ ironic_inspector.database.name }}?charset=utf8 diff --git a/playbooks/roles/bifrost-ironic-install/templates/ironic.conf.j2 b/playbooks/roles/bifrost-ironic-install/templates/ironic.conf.j2 index ae8a664bc..28f7782f5 100644 --- a/playbooks/roles/bifrost-ironic-install/templates/ironic.conf.j2 +++ b/playbooks/roles/bifrost-ironic-install/templates/ironic.conf.j2 @@ -22,7 +22,11 @@ enabled_deploy_interfaces = {{ enabled_deploy_interfaces }} enabled_hardware_types = {{ enabled_hardware_types }} +{% if use_rabbitmq is defined and use_rabbitmq | bool == true %} transport_url = rabbit://ironic:{{ironic_db_password }}@{{ message_queue_host | default('127.0.0.1') }}:{{ message_queue_port | default('5672') }}/{{ rabbit_virtual_host | default('') }} +{% else %} +rpc_transport = json-rpc +{% endif %} {% if enable_keystone is defined and enable_keystone | bool == true %} auth_strategy = keystone @@ -119,3 +123,16 @@ region_name = {{ keystone.bootstrap.region_name | default('RegionOne')}} auth_type = none {% endif %} endpoint_override = http://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:6385 + +[json_rpc] +{% if enable_keystone is defined and enable_keystone | bool == true %} +auth_url = {{ ironic.service_catalog.auth_url }} +auth_type = password +project_name = {{ ironic.service_catalog.project_name }} +username = {{ ironic.service_catalog.username }} +password = {{ ironic.service_catalog.password }} +user_domain_id = default +project_domain_id = default +{% else %} +auth_type = none +{% endif %} diff --git a/playbooks/roles/bifrost-keystone-install/README.md b/playbooks/roles/bifrost-keystone-install/README.md index efb4a3838..bec702968 100644 --- a/playbooks/roles/bifrost-keystone-install/README.md +++ b/playbooks/roles/bifrost-keystone-install/README.md @@ -3,7 +3,7 @@ bifrost-keystone-install This role installs keystone for a bifrost/stand-alone ironic deployment with all required substrate to allow for keystone configuration, -including MySQL, RabbitMQ, dnsmasq, and nginx. +including MySQL, dnsmasq, and nginx. Requirements ------------ diff --git a/playbooks/roles/bifrost-keystone-install/defaults/main.yml b/playbooks/roles/bifrost-keystone-install/defaults/main.yml index 7a38fd4d8..e53d5db9d 100644 --- a/playbooks/roles/bifrost-keystone-install/defaults/main.yml +++ b/playbooks/roles/bifrost-keystone-install/defaults/main.yml @@ -6,7 +6,7 @@ keystone_git_folder: /opt/stack/keystone # set to true to skip installing ironic dependencies skip_package_install: False -# set to true to skip generation of configs, ironic db and rabbitmq configuration +# set to true to skip generation of configs and ironic db configuration skip_bootstrap: False # set to true to skip starting ironic services and dependencies skip_start: False diff --git a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Debian_family.yml b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Debian_family.yml index a53386af7..c2ee4d368 100644 --- a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Debian_family.yml +++ b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Debian_family.yml @@ -6,7 +6,6 @@ nginx_user: www-data mysql_service_name: mysql required_packages: - mysql-server - - rabbitmq-server - python-dev - python-mysqldb - python-configparser diff --git a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Debian_jessie.yml b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Debian_jessie.yml index aa172dcda..1c3f8328e 100644 --- a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Debian_jessie.yml +++ b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Debian_jessie.yml @@ -6,7 +6,6 @@ nginx_user: www-data mysql_service_name: mysql required_packages: - mysql-server - - rabbitmq-server - python-dev - python-mysqldb - python-configparser diff --git a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_RedHat_family.yml b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_RedHat_family.yml index 01d8e5e03..063d160a1 100644 --- a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_RedHat_family.yml +++ b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_RedHat_family.yml @@ -11,7 +11,6 @@ mysql_service_name: mariadb tftp_service_name: tftp required_packages: - mariadb-server - - rabbitmq-server - python-devel - MySQL-python - python-iniparse diff --git a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Suse_family.yml b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Suse_family.yml index 5b64f51ba..93b44eacf 100644 --- a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Suse_family.yml +++ b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Suse_family.yml @@ -6,7 +6,6 @@ mysql_service_name: mysql required_packages: - python-selinux - mariadb - - rabbitmq-server - python-devel - python-MySQL-python - python-iniparse diff --git a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Ubuntu_16.04.yml b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Ubuntu_16.04.yml index 7ae226438..c758fcb79 100644 --- a/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Ubuntu_16.04.yml +++ b/playbooks/roles/bifrost-keystone-install/defaults/required_defaults_Ubuntu_16.04.yml @@ -4,7 +4,6 @@ init_dest_dir: /lib/systemd/system/ init_ext: .service required_packages: - mysql-server - - rabbitmq-server - python-dev - python-mysqldb - python-configparser diff --git a/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml b/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml index 736b72189..7661d42e0 100644 --- a/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml +++ b/playbooks/roles/bifrost-keystone-install/tasks/bootstrap.yml @@ -29,36 +29,11 @@ register: keystone_install_prefix environment: "{{ bifrost_venv_env if enable_venv else {} }}" -# NOTE(sean-k-mooney) only the RabbitMQ server and MySQL db are started -# during bootstrapping. all other services are started in the Start phase. +# NOTE(sean-k-mooney) only the MySQL db is started during bootstrapping. +# all other services are started in the Start phase. - name: "Start database service" service: name={{ mysql_service_name }} state=started enabled=yes -- name: "Start rabbitmq-server" - service: name=rabbitmq-server state=started enabled=yes - -# NOTE(cinerama): on some systems, rabbit may not be ready when we want to -# make changes to users if we don't wait first -- name: "Wait for rabbitmq" - wait_for: port="{{ keystone.message_queue.port | default('5672') }}" delay=5 - -- name: "Ensure guest user is removed from rabbitmq" - rabbitmq_user: - user: "guest" - state: absent - force: yes - -- name: "Create keystone user in RabbitMQ" - rabbitmq_user: - user: "{{ keystone.message_queue.username }}" - password: "{{ keystone.message_queue.password }}" - force: yes - state: present - configure_priv: ".*" - write_priv: ".*" - read_priv: ".*" - no_log: true - - name: "Set mysql_username if environment variable mysql_user is set" set_fact: mysql_username: "{{ lookup('env', 'mysql_user') }}" diff --git a/playbooks/roles/bifrost-rabbitmq/defaults/main.yml b/playbooks/roles/bifrost-rabbitmq/defaults/main.yml new file mode 100644 index 000000000..11016d1eb --- /dev/null +++ b/playbooks/roles/bifrost-rabbitmq/defaults/main.yml @@ -0,0 +1,6 @@ +--- +skip_package_install: false +# This seems to be the same for all supported distributions. +rabbitmq_package: rabbitmq-server +rabbitmq_port: 5672 +rabbitmq_service: rabbitmq-server diff --git a/playbooks/roles/bifrost-rabbitmq/tasks/main.yml b/playbooks/roles/bifrost-rabbitmq/tasks/main.yml new file mode 100644 index 000000000..744238940 --- /dev/null +++ b/playbooks/roles/bifrost-rabbitmq/tasks/main.yml @@ -0,0 +1,48 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- name: Install RabbitMQ package + package: + name: "{{ rabbitmq_package }}" + state: present + when: skip_package_install | bool != True + +# NOTE(hwoarang): The erlang SUSE package forces epmd to listen on localhost +# address which breaks rabbitmq-server when listening on a different address. +# https://build.opensuse.org/package/view_file/devel:languages:erlang:Factory/erlang/README.SUSE?expand=1 +- name: "Make epmd listen to all addresses on SUSE" + block: + - blockinfile: + dest: "/etc/systemd/system/epmd.socket.d/port.conf" + content: | + [Socket] + ListenStream= + ListenStream=0.0.0.0:4369 + create: yes + marker: "# {mark} ANSIBLE MANAGED BLOCK" + + - systemd: daemon_reload=yes + + - service: name={{ item }} state=stopped enabled=no + with_items: + - epmd.socket + - epmd + when: ansible_os_family == 'Suse' + +- import_tasks: start.yml + +- name: "Ensure guest user is removed from rabbitmq" + rabbitmq_user: + user: "guest" + state: absent + force: yes diff --git a/playbooks/roles/bifrost-rabbitmq/tasks/start.yml b/playbooks/roles/bifrost-rabbitmq/tasks/start.yml new file mode 100644 index 000000000..57e32cac0 --- /dev/null +++ b/playbooks/roles/bifrost-rabbitmq/tasks/start.yml @@ -0,0 +1,27 @@ +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or +# implied. +# See the License for the specific language governing permissions and +# limitations under the License. +--- +- name: "Start rabbitmq-server" + service: + name: "{{ rabbitmq_service }}" + state: started + enabled: yes + +# NOTE(cinerama): on some systems, rabbit may not be ready when we want to +# make changes to users if we don't wait first +# TODO(TheJulia): This needs to be changed to a variable, however +# should update this playbook all at once with new variable structures. +- name: "Wait for rabbitmq" + wait_for: + port: "{{ rabbitmq_port }}" + delay: 5 diff --git a/releasenotes/notes/json-rpc-e5ccd5a13f6d51aa.yaml b/releasenotes/notes/json-rpc-e5ccd5a13f6d51aa.yaml new file mode 100644 index 000000000..9ede9703f --- /dev/null +++ b/releasenotes/notes/json-rpc-e5ccd5a13f6d51aa.yaml @@ -0,0 +1,4 @@ +features: + - | + Adds support to disable RabbitMQ via the new ``use_rabbitmq`` variable + in favour of JSON RPC (in ironic) and fake transport (in ironic-inspector).