From 069116859a133b16d4385d103720b76763efc539 Mon Sep 17 00:00:00 2001 From: Michael Davies Date: Tue, 19 Jan 2016 06:59:45 +0000 Subject: [PATCH] Syncing as work on osa integration continues --- defaults/main.yml | 30 ++++++++++------------ meta/main.yml | 6 ++++- tasks/ironic_db_setup.yml | 26 +++++++++---------- tasks/ironic_messaging_setup.yml | 37 +++++++++++++++++++++++++++ tasks/ironic_pre_install.yml | 5 ++++ tasks/python_ironicclient_install.yml | 4 +-- templates/ironic-upstart-init.j2 | 2 +- templates/ironic.conf.j2 | 14 +++++----- 8 files changed, 84 insertions(+), 40 deletions(-) create mode 100644 tasks/ironic_messaging_setup.yml diff --git a/defaults/main.yml b/defaults/main.yml index 43367412..bfaa4389 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -46,17 +46,16 @@ ironic_service_names: - "{{ ironic_conductor_program_name }}" # Is this Ironic installation working standalone? -ironic_standalone: True +ironic_standalone: False # Database ironic_galera_user: ironic ironic_galera_database: ironic -ironic_galera_address: localhost ironic_galera_password: gu1d0 # TBD(mrda): need to handle this a little better :) -database_root_user: root -database_root_password: sp4m3ggs +#database_root_user: root +#database_root_password: sp4m3ggs # Integrated Openstack configuration ironic_openstack_driver_list: agent_ipmitool @@ -64,7 +63,7 @@ ironic_openstack_auth_strategy: keystone ironic_openstack_api_url: '' # Not required when we have keystone ironic_openstack_dhcp_provider: neutron ironic_openstack_sync_power_state_interval: 60 -ironic_openstack_db_connection_string: "mysql://{{ ironic_database_user }}:{{ ironic_database_password }}@localhost/ironic" +ironic_openstack_db_connection_string: "mysql://{{ ironic_galera_user }}:{{ ironic_galera_password }}@{{ ironic_galera_address }}/ironic" # Standalone Ironic configuration ironic_standalone_driver_list: pxe_amt # for testing with a NUC @@ -72,7 +71,7 @@ ironic_standalone_auth_strategy: noauth ironic_standalone_api_url: "api_url=http://{{ ansible_default_ipv4['address'] }}:6385/" ironic_standalone_dhcp_provider: none ironic_standalone_sync_power_state_interval: -1 -ironic_standalone_db_connection_string: "mysql://{{ ironic_database_user }}:{{ ironic_database_password }}@localhost/ironic" +ironic_standalone_db_connection_string: "mysql://{{ ironic_galera_user }}:{{ ironic_galera_password }}@{{ ironic_galera_address }}/ironic" # Common configuration ironic_node_name: ironic @@ -95,16 +94,15 @@ ironic_common_pip_packages: - virtualenvwrapper ironic_pip_packages: + - mysql-python - ironic python_ironicclient_pip_packages: - python_ironicclient ironic_conductor_apt_packages: - - libmysqlclient-dev - libxml2-dev - rabbitmq-server - - mysql-server - isc-dhcp-server - tftpd-hpa - syslinux @@ -119,13 +117,13 @@ ironic_conductor_apt_packages: ironic_conductor_pip_packages: - mysql-python -## ironic service -ironic_git_repo: https://git.openstack.org/openstack/ironic -ironic_git_install_branch: c6e8e2a33c65b6269a0b1b4f5e63620c68bdc3fb # HEAD sha as of 13 Nov 2015 -ironic_git_dest: "/opt/ironic_{{ ironic_git_install_branch | replace('/', '_') }}" +## RabbitMQ info +ironic_rabbitmq_userid: ironic +ironic_rabbitmq_vhost: /ironic +ironic_rabbitmq_password: ch4rl0tt3 # TODO(mrda): Manage secrets + +# Auth +ironic_service_user_name: "ironic" +ironic_service_password: "4nn3" # TODO(mrda): Manage secrets -## python-ironicclient -python_ironicclient_git_repo: https://git.openstack.org/openstack/python-ironicclient -python_ironicclient_git_install_branch: b66f5e8dd60c023d6d216c3bbc5ec22d837623c3 # HEAD sha as of 13 Nov 2015 -python_ironicclient_git_dest: "/opt/python-ironicclient_{{ python_ironicclient_git_install_branch | replace('/', '_') }}" diff --git a/meta/main.yml b/meta/main.yml index 3530b157..e07e35eb 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -26,4 +26,8 @@ galaxy_info: - cloud - baremetal - system -dependencies: [] +dependencies: + - pip_lock_down + - apt_package_pinning + - galera_client + - openstack_openrc diff --git a/tasks/ironic_db_setup.yml b/tasks/ironic_db_setup.yml index 7dd6fa8a..7e15501e 100644 --- a/tasks/ironic_db_setup.yml +++ b/tasks/ironic_db_setup.yml @@ -28,7 +28,7 @@ mysql_user: login_user: "{{ galera_root_user }}" login_password: "{{ galera_root_password }}" - login_host: "{{ ironic_database_address }}" + login_host: "{{ ironic_galera_address }}" name: "{{ ironic_galera_user }}" password: "{{ ironic_galera_password }}" host: "{{ item }}" @@ -36,21 +36,21 @@ priv: "{{ ironic_galera_database }}.*:ALL" with_items: - "localhost" + - "{{ ironic_galera_address }}" - "%" - when: ironic_db.changed == True tags: - ironic-db-setup -- name: Create database schema - command: "{{ ironic_bin }}/ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema" - sudo: yes - sudo_user: "{{ ironic_system_user_name }}" - notify: - - Restart ironic services - when: ironic_db.changed == True - tags: - - ironic-db-setup - - ironic-conductor +#- name: Create database schema +## command: "{{ ironic_bin }}/ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema" +# sudo: yes +# sudo_user: "{{ ironic_system_user_name }}" +# notify: +# - Restart ironic services +# when: ironic_db.changed == True +# tags: +# - ironic-db-setup +# - ironic-conductor - name: Update database schema command: "{{ ironic_bin }}/ironic-dbsync --config-file /etc/ironic/ironic.conf upgrade" @@ -58,7 +58,7 @@ sudo_user: "{{ ironic_system_user_name }}" notify: - Restart ironic services - when: ironic_db.changed == False +# when: ironic_db.changed == False tags: - ironic-db-setup - ironic-conductor diff --git a/tasks/ironic_messaging_setup.yml b/tasks/ironic_messaging_setup.yml new file mode 100644 index 00000000..a45e49dd --- /dev/null +++ b/tasks/ironic_messaging_setup.yml @@ -0,0 +1,37 @@ +--- +# Copyright 2014, Rackspace US, Inc. +# +# 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: Ensure Rabbitmq vhost + rabbitmq_vhost: + name: "{{ ironic_rabbitmq_vhost }}" + state: "present" + delegate_to: "{{ groups['rabbitmq_all'][0] }}" + tags: + - ironic-rabbitmq + - ironic-rabbitmq-vhost + +- name: Ensure rabbitmq user + rabbitmq_user: + user: "{{ ironic_rabbitmq_userid }}" + password: "{{ ironic_rabbitmq_password }}" + vhost: "{{ ironic_rabbitmq_vhost }}" + configure_priv: ".*" + read_priv: ".*" + write_priv: ".*" + state: "present" + delegate_to: "{{ groups['rabbitmq_all'][0] }}" + tags: + - ironic-rabbitmq + - ironic-rabbitmq-user diff --git a/tasks/ironic_pre_install.yml b/tasks/ironic_pre_install.yml index ae105456..7d7fcb3e 100644 --- a/tasks/ironic_pre_install.yml +++ b/tasks/ironic_pre_install.yml @@ -150,3 +150,8 @@ tags: - ironic-install - ironic-pip-packages + +- include: ironic_messaging_setup.yml + when: > + inventory_hostname == groups['ironic_all'][0] + diff --git a/tasks/python_ironicclient_install.yml b/tasks/python_ironicclient_install.yml index 967a5adb..60a2ee86 100644 --- a/tasks/python_ironicclient_install.yml +++ b/tasks/python_ironicclient_install.yml @@ -13,7 +13,7 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Install pip packages (venv) +- name: Install python-ironicclient pip packages (venv) pip: name: "{{ item }}" state: present @@ -32,7 +32,7 @@ - ironicclient-install - ironicclient-pip-packages -- name: Install pip packages (no venv) +- name: Install python-ironicclient pip packages (no venv) pip: name: "{{ item }}" state: present diff --git a/templates/ironic-upstart-init.j2 b/templates/ironic-upstart-init.j2 index 3a3f36d4..405973e7 100644 --- a/templates/ironic-upstart-init.j2 +++ b/templates/ironic-upstart-init.j2 @@ -13,7 +13,7 @@ respawn limit 10 5 # Set the RUNBIN environment variable env RUNBIN="{{ ironic_bin }}/{{ program_name }}" -env RUNOPTS="--config-file /etc/ironic/ironic.conf" +env RUNOPTS="-v -d --config-file /etc/ironic/ironic.conf" # Change directory to service users home chdir "{{ service_home }}" diff --git a/templates/ironic.conf.j2 b/templates/ironic.conf.j2 index 3233f668..06138586 100644 --- a/templates/ironic.conf.j2 +++ b/templates/ironic.conf.j2 @@ -534,7 +534,7 @@ host={{ ironic_node_name }} # URL of Ironic API service. If not set ironic can get the # current value from the keystone service catalog. (string # value) -{{ ironic_api_url }} +api_url={{ ironic_api_url }} # Seconds between conductor heart beats. (integer value) #heartbeat_interval=10 @@ -1689,25 +1689,25 @@ auth_strategy={{ ironic_auth_strategy }} # The RabbitMQ broker port where a single node is used. # (integer value) -#rabbit_port=5672 +rabbit_port={{ rabbitmq_port }} # RabbitMQ HA cluster host:port pairs. (list value) -#rabbit_hosts=$rabbit_host:$rabbit_port +rabbit_hosts={{ rabbitmq_servers }} # Connect over SSL for RabbitMQ. (boolean value) -#rabbit_use_ssl=false +rabbit_use_ssl={{ rabbitmq_use_ssl }} # The RabbitMQ userid. (string value) -#rabbit_userid=guest +rabbit_userid={{ ironic_rabbitmq_userid }} # The RabbitMQ password. (string value) -#rabbit_password=guest +rabbit_password={{ ironic_rabbitmq_password }} # The RabbitMQ login method. (string value) #rabbit_login_method=AMQPLAIN # The RabbitMQ virtual host. (string value) -#rabbit_virtual_host=/ +rabbit_virtual_host={{ ironic_rabbitmq_vhost }} # How frequently to retry connecting with RabbitMQ. (integer # value)