Merge "Move RabbitMQ handling into a separate role and support disabling it"
This commit is contained in:
commit
c21c32d5cb
@ -23,6 +23,8 @@ transform_boot_image: false
|
|||||||
# virtual machines for the hardware instead of real hardware.
|
# virtual machines for the hardware instead of real hardware.
|
||||||
testing: false
|
testing: false
|
||||||
ci_testing: false
|
ci_testing: false
|
||||||
|
# Use Rabbit MQ as a message bus.
|
||||||
|
use_rabbitmq: true
|
||||||
|
|
||||||
# set to true to skip installing ironic dependencies
|
# set to true to skip installing ironic dependencies
|
||||||
skip_package_install: False
|
skip_package_install: False
|
||||||
|
@ -10,7 +10,6 @@ mysql_service_name: mysql
|
|||||||
tftp_service_name: tftpd-hpa
|
tftp_service_name: tftpd-hpa
|
||||||
required_packages:
|
required_packages:
|
||||||
- mysql-server
|
- mysql-server
|
||||||
- rabbitmq-server
|
|
||||||
- python-dev
|
- python-dev
|
||||||
- python-mysqldb
|
- python-mysqldb
|
||||||
- python-configparser
|
- python-configparser
|
||||||
|
@ -8,7 +8,6 @@ nginx_user: www-data
|
|||||||
mysql_service_name: mysql
|
mysql_service_name: mysql
|
||||||
required_packages:
|
required_packages:
|
||||||
- mysql-server
|
- mysql-server
|
||||||
- rabbitmq-server
|
|
||||||
- python-dev
|
- python-dev
|
||||||
- python-mysqldb
|
- python-mysqldb
|
||||||
- python-configparser
|
- python-configparser
|
||||||
|
@ -11,7 +11,6 @@ tftp_service_name: tftp
|
|||||||
required_packages:
|
required_packages:
|
||||||
- mariadb-server
|
- mariadb-server
|
||||||
- dnsmasq
|
- dnsmasq
|
||||||
- rabbitmq-server
|
|
||||||
- python-devel
|
- python-devel
|
||||||
- MySQL-python
|
- MySQL-python
|
||||||
- libselinux-python
|
- libselinux-python
|
||||||
|
@ -11,7 +11,6 @@ tftp_service_name: tftp
|
|||||||
required_packages:
|
required_packages:
|
||||||
- mariadb-server
|
- mariadb-server
|
||||||
- dnsmasq
|
- dnsmasq
|
||||||
- rabbitmq-server
|
|
||||||
- python-devel
|
- python-devel
|
||||||
- MySQL-python
|
- MySQL-python
|
||||||
- libselinux-python
|
- libselinux-python
|
||||||
|
@ -11,7 +11,6 @@ tftp_service_name: tftp
|
|||||||
required_packages:
|
required_packages:
|
||||||
- mariadb-server
|
- mariadb-server
|
||||||
- dnsmasq
|
- dnsmasq
|
||||||
- rabbitmq-server
|
|
||||||
- python-devel
|
- python-devel
|
||||||
- MySQL-python
|
- MySQL-python
|
||||||
- libselinux-python
|
- libselinux-python
|
||||||
|
@ -11,7 +11,6 @@ tftp_service_name: tftp
|
|||||||
required_packages:
|
required_packages:
|
||||||
- mariadb-server
|
- mariadb-server
|
||||||
- dnsmasq
|
- dnsmasq
|
||||||
- rabbitmq-server
|
|
||||||
- python-devel
|
- python-devel
|
||||||
- MySQL-python
|
- MySQL-python
|
||||||
- python-iniparse
|
- python-iniparse
|
||||||
|
@ -17,7 +17,6 @@ required_packages:
|
|||||||
- python-selinux
|
- python-selinux
|
||||||
- mariadb-server
|
- mariadb-server
|
||||||
- dnsmasq
|
- dnsmasq
|
||||||
- rabbitmq-server
|
|
||||||
- python-devel
|
- python-devel
|
||||||
- python-MySQL-python
|
- python-MySQL-python
|
||||||
- python-iniparse
|
- python-iniparse
|
||||||
|
@ -4,7 +4,6 @@ init_dest_dir: /lib/systemd/system/
|
|||||||
init_ext: .service
|
init_ext: .service
|
||||||
required_packages:
|
required_packages:
|
||||||
- mysql-server
|
- mysql-server
|
||||||
- rabbitmq-server
|
|
||||||
- python-dev
|
- python-dev
|
||||||
- python-mysqldb
|
- python-mysqldb
|
||||||
- python-configparser
|
- python-configparser
|
||||||
|
@ -17,7 +17,6 @@ required_packages:
|
|||||||
- python-selinux
|
- python-selinux
|
||||||
- mariadb-server
|
- mariadb-server
|
||||||
- dnsmasq
|
- dnsmasq
|
||||||
- rabbitmq-server
|
|
||||||
- python-devel
|
- python-devel
|
||||||
- python-iniparse
|
- python-iniparse
|
||||||
- libffi-devel
|
- libffi-devel
|
||||||
|
@ -42,43 +42,6 @@
|
|||||||
service: name={{ mysql_service_name }} state=started enabled=yes
|
service: name={{ mysql_service_name }} state=started enabled=yes
|
||||||
when: ironic.database.host == 'localhost'
|
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"
|
- name: "Create ironic user in RabbitMQ"
|
||||||
rabbitmq_user:
|
rabbitmq_user:
|
||||||
user: "ironic"
|
user: "ironic"
|
||||||
@ -89,6 +52,7 @@
|
|||||||
write_priv: ".*"
|
write_priv: ".*"
|
||||||
read_priv: ".*"
|
read_priv: ".*"
|
||||||
no_log: true
|
no_log: true
|
||||||
|
when: use_rabbitmq
|
||||||
|
|
||||||
- name: "Set mysql_username if environment variable mysql_user is set"
|
- name: "Set mysql_username if environment variable mysql_user is set"
|
||||||
set_fact:
|
set_fact:
|
||||||
|
@ -51,6 +51,11 @@
|
|||||||
- "../defaults/required_defaults_{{ ansible_distribution | regex_replace(' ', '_') }}_{{ ansible_distribution_version }}.yml"
|
- "../defaults/required_defaults_{{ ansible_distribution | regex_replace(' ', '_') }}_{{ ansible_distribution_version }}.yml"
|
||||||
- "../defaults/dummy-defaults.yml"
|
- "../defaults/dummy-defaults.yml"
|
||||||
|
|
||||||
|
- name: "Install RabbitMQ if required"
|
||||||
|
import_role:
|
||||||
|
name: bifrost-rabbitmq
|
||||||
|
when: use_rabbitmq
|
||||||
|
|
||||||
- name: "Install Ironic deps"
|
- name: "Install Ironic deps"
|
||||||
include: install.yml
|
include: install.yml
|
||||||
when: skip_package_install | bool != True
|
when: skip_package_install | bool != True
|
||||||
|
@ -24,8 +24,10 @@
|
|||||||
- name: "Start database service"
|
- name: "Start database service"
|
||||||
service: name={{ mysql_service_name }} state=started enabled=yes
|
service: name={{ mysql_service_name }} state=started enabled=yes
|
||||||
|
|
||||||
- name: "Start rabbitmq-server"
|
- import_role:
|
||||||
service: name=rabbitmq-server state=started enabled=yes
|
name: bifrost-rabbitmq
|
||||||
|
tasks_from: start
|
||||||
|
when: use_rabbitmq
|
||||||
|
|
||||||
- name: "start ironic-inspector"
|
- name: "start ironic-inspector"
|
||||||
include: inspector_start.yml
|
include: inspector_start.yml
|
||||||
|
@ -15,7 +15,11 @@ debug = {{ inspector_debug | bool }}
|
|||||||
log_dir = {{ inspector_log_dir }}
|
log_dir = {{ inspector_log_dir }}
|
||||||
{% endif %}
|
{% 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('') }}
|
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]
|
[database]
|
||||||
connection=mysql+pymysql://{{ ironic_inspector.database.username }}:{{ ironic_inspector.database.password }}@{{ ironic_inspector.database.host }}/{{ ironic_inspector.database.name }}?charset=utf8
|
connection=mysql+pymysql://{{ ironic_inspector.database.username }}:{{ ironic_inspector.database.password }}@{{ ironic_inspector.database.host }}/{{ ironic_inspector.database.name }}?charset=utf8
|
||||||
|
@ -22,7 +22,11 @@ enabled_deploy_interfaces = {{ enabled_deploy_interfaces }}
|
|||||||
|
|
||||||
enabled_hardware_types = {{ enabled_hardware_types }}
|
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('') }}
|
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 %}
|
{% if enable_keystone is defined and enable_keystone | bool == true %}
|
||||||
auth_strategy = keystone
|
auth_strategy = keystone
|
||||||
@ -119,3 +123,16 @@ region_name = {{ keystone.bootstrap.region_name | default('RegionOne')}}
|
|||||||
auth_type = none
|
auth_type = none
|
||||||
{% endif %}
|
{% endif %}
|
||||||
endpoint_override = http://{{ hostvars[inventory_hostname]['ansible_' + ans_network_interface]['ipv4']['address'] }}:6385
|
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 %}
|
||||||
|
@ -3,7 +3,7 @@ bifrost-keystone-install
|
|||||||
|
|
||||||
This role installs keystone for a bifrost/stand-alone ironic deployment
|
This role installs keystone for a bifrost/stand-alone ironic deployment
|
||||||
with all required substrate to allow for keystone configuration,
|
with all required substrate to allow for keystone configuration,
|
||||||
including MySQL, RabbitMQ, dnsmasq, and nginx.
|
including MySQL, dnsmasq, and nginx.
|
||||||
|
|
||||||
Requirements
|
Requirements
|
||||||
------------
|
------------
|
||||||
|
@ -6,7 +6,7 @@ keystone_git_folder: /opt/stack/keystone
|
|||||||
|
|
||||||
# set to true to skip installing ironic dependencies
|
# set to true to skip installing ironic dependencies
|
||||||
skip_package_install: False
|
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
|
skip_bootstrap: False
|
||||||
# set to true to skip starting ironic services and dependencies
|
# set to true to skip starting ironic services and dependencies
|
||||||
skip_start: False
|
skip_start: False
|
||||||
|
@ -6,7 +6,6 @@ nginx_user: www-data
|
|||||||
mysql_service_name: mysql
|
mysql_service_name: mysql
|
||||||
required_packages:
|
required_packages:
|
||||||
- mysql-server
|
- mysql-server
|
||||||
- rabbitmq-server
|
|
||||||
- python-dev
|
- python-dev
|
||||||
- python-mysqldb
|
- python-mysqldb
|
||||||
- python-configparser
|
- python-configparser
|
||||||
|
@ -6,7 +6,6 @@ nginx_user: www-data
|
|||||||
mysql_service_name: mysql
|
mysql_service_name: mysql
|
||||||
required_packages:
|
required_packages:
|
||||||
- mysql-server
|
- mysql-server
|
||||||
- rabbitmq-server
|
|
||||||
- python-dev
|
- python-dev
|
||||||
- python-mysqldb
|
- python-mysqldb
|
||||||
- python-configparser
|
- python-configparser
|
||||||
|
@ -11,7 +11,6 @@ mysql_service_name: mariadb
|
|||||||
tftp_service_name: tftp
|
tftp_service_name: tftp
|
||||||
required_packages:
|
required_packages:
|
||||||
- mariadb-server
|
- mariadb-server
|
||||||
- rabbitmq-server
|
|
||||||
- python-devel
|
- python-devel
|
||||||
- MySQL-python
|
- MySQL-python
|
||||||
- python-iniparse
|
- python-iniparse
|
||||||
|
@ -6,7 +6,6 @@ mysql_service_name: mysql
|
|||||||
required_packages:
|
required_packages:
|
||||||
- python-selinux
|
- python-selinux
|
||||||
- mariadb
|
- mariadb
|
||||||
- rabbitmq-server
|
|
||||||
- python-devel
|
- python-devel
|
||||||
- python-MySQL-python
|
- python-MySQL-python
|
||||||
- python-iniparse
|
- python-iniparse
|
||||||
|
@ -4,7 +4,6 @@ init_dest_dir: /lib/systemd/system/
|
|||||||
init_ext: .service
|
init_ext: .service
|
||||||
required_packages:
|
required_packages:
|
||||||
- mysql-server
|
- mysql-server
|
||||||
- rabbitmq-server
|
|
||||||
- python-dev
|
- python-dev
|
||||||
- python-mysqldb
|
- python-mysqldb
|
||||||
- python-configparser
|
- python-configparser
|
||||||
|
@ -29,36 +29,11 @@
|
|||||||
register: keystone_install_prefix
|
register: keystone_install_prefix
|
||||||
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
|
environment: "{{ bifrost_venv_env if enable_venv else {} }}"
|
||||||
|
|
||||||
# NOTE(sean-k-mooney) only the RabbitMQ server and MySQL db are started
|
# NOTE(sean-k-mooney) only the MySQL db is started during bootstrapping.
|
||||||
# during bootstrapping. all other services are started in the Start phase.
|
# all other services are started in the Start phase.
|
||||||
- name: "Start database service"
|
- name: "Start database service"
|
||||||
service: name={{ mysql_service_name }} state=started enabled=yes
|
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"
|
- name: "Set mysql_username if environment variable mysql_user is set"
|
||||||
set_fact:
|
set_fact:
|
||||||
mysql_username: "{{ lookup('env', 'mysql_user') }}"
|
mysql_username: "{{ lookup('env', 'mysql_user') }}"
|
||||||
|
6
playbooks/roles/bifrost-rabbitmq/defaults/main.yml
Normal file
6
playbooks/roles/bifrost-rabbitmq/defaults/main.yml
Normal file
@ -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
|
48
playbooks/roles/bifrost-rabbitmq/tasks/main.yml
Normal file
48
playbooks/roles/bifrost-rabbitmq/tasks/main.yml
Normal file
@ -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
|
27
playbooks/roles/bifrost-rabbitmq/tasks/start.yml
Normal file
27
playbooks/roles/bifrost-rabbitmq/tasks/start.yml
Normal file
@ -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
|
4
releasenotes/notes/json-rpc-e5ccd5a13f6d51aa.yaml
Normal file
4
releasenotes/notes/json-rpc-e5ccd5a13f6d51aa.yaml
Normal file
@ -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).
|
Loading…
Reference in New Issue
Block a user