diff --git a/ansible-role-requirements.yml b/ansible-role-requirements.yml index 53a5e81551..97b649fc09 100644 --- a/ansible-role-requirements.yml +++ b/ansible-role-requirements.yml @@ -73,6 +73,10 @@ src: https://git.openstack.org/openstack/openstack-ansible-os_horizon scm: git version: master +- name: os_ironic + src: https://github.com/openstack/openstack-ansible-ironic + scm: git + version: master - name: os_neutron src: https://git.openstack.org/openstack/openstack-ansible-os_neutron scm: git diff --git a/etc/openstack_deploy/conf.d/ironic.yml.aio b/etc/openstack_deploy/conf.d/ironic.yml.aio new file mode 100644 index 0000000000..774e772bc0 --- /dev/null +++ b/etc/openstack_deploy/conf.d/ironic.yml.aio @@ -0,0 +1,4 @@ +--- +ironic-infra_hosts: + aio1: + ip: 172.29.236.100 diff --git a/etc/openstack_deploy/env.d/ironic.yml b/etc/openstack_deploy/env.d/ironic.yml new file mode 100644 index 0000000000..27aff0bb0b --- /dev/null +++ b/etc/openstack_deploy/env.d/ironic.yml @@ -0,0 +1,67 @@ +--- +# Copyright 2016, 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. + +component_skel: + ironic_api: + belongs_to: + - ironic_all + ironic_conductor: + belongs_to: + - ironic_all + ironic_server: + belongs_to: + - ironic_servers + +container_skel: + ironic_api_container: + belongs_to: + - ironic-infra_containers + contains: + - ironic_api + properties: + service_name: ironic + container_release: trusty + ironic_conductor_container: + belongs_to: + - ironic-infra_containers + contains: + - ironic_conductor + properties: + service_name: ironic + container_release: trusty + ironic_server_container: + belongs_to: + - ironic-server_containers + contains: + - ironic_server + properties: + is_metal: true + service_name: ironic + container_release: trusty + + +physical_skel: + ironic-infra_containers: + belongs_to: + - all_containers + ironic-infra_hosts: + belongs_to: + - hosts + ironic-server_containers: + belongs_to: + - all_containers + ironic-server_hosts: + belongs_to: + - hosts diff --git a/etc/openstack_deploy/user_secrets.yml b/etc/openstack_deploy/user_secrets.yml index beeaed2821..737113a1ef 100644 --- a/etc/openstack_deploy/user_secrets.yml +++ b/etc/openstack_deploy/user_secrets.yml @@ -71,6 +71,11 @@ heat_cfn_service_password: heat_profiler_hmac_key: heat_rabbitmq_password: +## Ironic options +ironic_rabbitmq_password: +ironic_galera_password: +ironic_service_password: + ## Horizon Options horizon_container_mysql_password: horizon_secret_key: diff --git a/playbooks/defaults/repo_packages/openstack_services.yml b/playbooks/defaults/repo_packages/openstack_services.yml index 4e3d0ae749..fbd20d7329 100644 --- a/playbooks/defaults/repo_packages/openstack_services.yml +++ b/playbooks/defaults/repo_packages/openstack_services.yml @@ -105,3 +105,9 @@ nova_git_dest: "/opt/nova_{{ nova_git_install_branch | replace('/', '_') }}" swift_git_repo: https://git.openstack.org/openstack/swift swift_git_install_branch: ee6af69af429e1a278581531e509be92774f668d # HEAD of "master" as of 03.04.2016 swift_git_dest: "/opt/swift_{{ swift_git_install_branch | replace('/', '_') }}" + + +## Ironic service +ironic_git_repo: https://git.openstack.org/openstack/ironic +ironic_git_install_branch: 8d105f60790ce108f65de90fc68e6e8651a87b4d # HEAD of "stable/mitaka" as of 23.03.2016 +ironic_git_dest: "/opt/ironic_{{ ironic_git_install_branch | replace('/', '_') }}" diff --git a/playbooks/inventory/group_vars/hosts.yml b/playbooks/inventory/group_vars/hosts.yml index e7534fd67b..a4fba209e5 100644 --- a/playbooks/inventory/group_vars/hosts.yml +++ b/playbooks/inventory/group_vars/hosts.yml @@ -54,6 +54,7 @@ rabbitmq_servers: "{% for host in groups['rabbitmq_all'] %}{{ hostvars[host]['an rabbitmq_use_ssl: true ## Galera +galera_root_user: "root" galera_wsrep_cluster_address: "{% for host in groups['galera_all'] %}{{ hostvars[host]['ansible_ssh_host'] }}{% if not loop.last %},{% endif %}{% endfor %}" galera_wsrep_address: "{{ ansible_ssh_host }}" @@ -269,6 +270,20 @@ swift_rabbitmq_userid: swift swift_rabbitmq_vhost: /swift +## Ironic +ironic_rabbitmq_vhost: /ironic +ironic_rabbitmq_userid: ironic +ironic_galera_database: ironic +ironic_galera_user: ironic +ironic_service_name: ironic +ironic_service_project_name: service +ironic_service_port: 6385 +ironic_service_proto: http +ironic_service_adminuri_proto: "{{ openstack_service_adminuri_proto | default(ironic_service_proto) }}" +ironic_service_adminuri: "{{ ironic_service_adminuri_proto }}://{{ internal_lb_vip_address }}:{{ ironic_service_port }}" +ironic_service_adminurl: "{{ ironic_service_adminuri }}/v1" + + ## OpenStack Openrc openrc_os_auth_url: "{{ keystone_service_internalurl }}" openrc_os_password: "{{ keystone_auth_admin_password }}" diff --git a/playbooks/os-ironic-install.yml b/playbooks/os-ironic-install.yml new file mode 100644 index 0000000000..b2028edacd --- /dev/null +++ b/playbooks/os-ironic-install.yml @@ -0,0 +1,126 @@ +--- +# Copyright 2016, Rackspace, 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: Installation and setup of Ironic + hosts: ironic_all + user: root + pre_tasks: + - name: Use the lxc-openstack aa profile + lxc_container: + name: "{{ container_name }}" + container_config: + - "lxc.aa_profile=lxc-openstack" + delegate_to: "{{ physical_host }}" + when: not is_metal | bool + register: container_config + tags: + - lxc-aa-profile + - name: Wait for container ssh + wait_for: + port: "22" + delay: "{{ ssh_delay }}" + search_regex: "OpenSSH" + host: "{{ ansible_ssh_host }}" + delegate_to: "{{ physical_host }}" + when: container_config is defined and container_config | changed + register: ssh_wait_check + until: ssh_wait_check | success + retries: 3 + tags: + - ssh-wait + - name: Create DB for Ironic + mysql_db: + login_user: "{{ galera_root_user }}" + login_password: "{{ galera_root_password }}" + login_host: "{{ ironic_galera_address }}" + name: "{{ ironic_galera_database }}" + state: "present" + delegate_to: "{{ groups['galera_all'][0] }}" + run_once: true + tags: + - ironic-db-setup + - name: Grant access to the DB for Ironic + mysql_user: + login_user: "{{ galera_root_user }}" + login_password: "{{ galera_root_password }}" + login_host: "{{ ironic_galera_address }}" + name: "{{ ironic_galera_user }}" + password: "{{ ironic_galera_password }}" + host: "{{ item }}" + state: "present" + priv: "{{ ironic_galera_database }}.*:ALL" + with_items: + - "localhost" + - "%" + delegate_to: "{{ groups['galera_all'][0] }}" + run_once: true + tags: + - ironic-db-setup + - name: Ensure Rabbitmq vhost for Ironic + rabbitmq_vhost: + name: "{{ ironic_rabbitmq_vhost }}" + state: "present" + delegate_to: "{{ groups['rabbitmq_all'][0] }}" + run_once: true + tags: + - ironic-rabbitmq + - ironic-rabbitmq-vhost + - name: Ensure rabbitmq user for Ironic + 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] }}" + run_once: true + tags: + - ironic-rabbitmq + - ironic-rabbitmq-user + - name: Sort the rabbitmq servers + dist_sort: + value_to_lookup: "{{ container_name }}" + ref_list: "{{ groups['ironic_all'] }}" + src_list: "{{ rabbitmq_servers }}" + register: servers + - name: Set rabbitmq servers + set_fact: + rabbitmq_servers: "{{ servers.sorted_list }}" + roles: + - role: "os_ironic" + ironic_venv_tag: "{{ openstack_release }}" + ironic_venv_download_url: "{{ openstack_repo_url }}/venvs/{{ openstack_release }}/{{ ansible_distribution | lower }}/ironic-{{ openstack_release }}.tgz" + tags: + - "os-ironic" + - role: "openstack_openrc" + tags: + - "openstack-openrc" + - role: "rsyslog_client" + rsyslog_client_log_rotate_file: ironic_log_rotate + rsyslog_client_log_dir: "/var/log/ironic" + rsyslog_client_config_name: "99-ironic-rsyslog-client.conf" + tags: + - "ironic-rsyslog-client" + - "rsyslog-client" + - role: "system_crontab_coordination" + tags: + - "system-crontab-coordination" + vars: + ansible_hostname: "{{ container_name }}" + ansible_ssh_host: "{{ container_address }}" + ironic_galera_address: "{{ internal_lb_vip_address }}" + is_metal: "{{ properties.is_metal|default(false) }}" diff --git a/playbooks/setup-openstack.yml b/playbooks/setup-openstack.yml index 3aee004b27..be10a349aa 100644 --- a/playbooks/setup-openstack.yml +++ b/playbooks/setup-openstack.yml @@ -23,3 +23,4 @@ - include: os-ceilometer-install.yml - include: os-aodh-install.yml - include: os-swift-install.yml +- include: os-ironic-install.yml diff --git a/playbooks/utility-install.yml b/playbooks/utility-install.yml index 3fd1dcdfad..ddaad26c6e 100644 --- a/playbooks/utility-install.yml +++ b/playbooks/utility-install.yml @@ -121,6 +121,7 @@ - python-keystoneclient - python-neutronclient - python-novaclient + - python-ironicclient - python-swiftclient - python-memcached - pycrypto diff --git a/playbooks/vars/configs/haproxy_config.yml b/playbooks/vars/configs/haproxy_config.yml index 4dd262e6b9..968591fc89 100644 --- a/playbooks/vars/configs/haproxy_config.yml +++ b/playbooks/vars/configs/haproxy_config.yml @@ -185,3 +185,8 @@ haproxy_service_configs: haproxy_backend_nodes: "{{ groups['aodh_api'] | default([]) }}" haproxy_port: 8042 haproxy_balance_type: http + - service: + haproxy_service_name: ironic_api + haproxy_backend_nodes: "{{ groups['ironic_api'] | default([]) }}" + haproxy_port: 6385 + haproxy_balance_type: http diff --git a/scripts/run-playbooks.sh b/scripts/run-playbooks.sh index b1b7139291..6e4f5c91cf 100755 --- a/scripts/run-playbooks.sh +++ b/scripts/run-playbooks.sh @@ -26,6 +26,7 @@ DEPLOY_OPENSTACK=${DEPLOY_OPENSTACK:-"yes"} DEPLOY_SWIFT=${DEPLOY_SWIFT:-"yes"} DEPLOY_CEILOMETER=${DEPLOY_CEILOMETER:-"yes"} DEPLOY_TEMPEST=${DEPLOY_TEMPEST:-"yes"} +DEPLOY_IRONIC=${DEPLOY_IRONIC:-"no"} COMMAND_LOGS=${COMMAND_LOGS:-"/openstack/log/ansible_cmd_logs/"} ADD_NEUTRON_AGENT_CHECKSUM_RULE=${ADD_NEUTRON_AGENT_CHECKSUM_RULE:-"yes"} @@ -133,6 +134,11 @@ pushd "playbooks" install_bits os-swift-install.yml fi + if [ "${DEPLOY_IRONIC}" == "yes" ]; then + # install all of the ironic Bits + install_bits os-ironic-install.yml + fi + if [ "${DEPLOY_TEMPEST}" == "yes" ]; then # Deploy tempest install_bits os-tempest-install.yml diff --git a/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml b/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml index 37d9b22311..3b288e3391 100644 --- a/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml +++ b/tests/roles/bootstrap-host/tasks/prepare_aio_config.yml @@ -50,6 +50,8 @@ override: "{{ horizon_env_overrides | default({}) }}" - name: infra.yml override: "{{ infra_env_overrides | default({}) }}" + - name: ironic.yml + override: "{{ ironic_env_overrides | default({}) }}" - name: keystone.yml override: "{{ keystone_env_overrides | default({}) }}" - name: memcache.yml @@ -90,6 +92,8 @@ override: "{{ ceilometer_conf_overrides | default({}) }}" - name: swift.yml.aio override: "{{ swift_conf_overrides | default({}) }}" + - name: ironic.yml.aio + override: "{{ ironic_conf_overrides | default({}) }}" tags: - deploy-confd diff --git a/tests/test_inventory.py b/tests/test_inventory.py index 54bd3eb030..feedb0dc27 100644 --- a/tests/test_inventory.py +++ b/tests/test_inventory.py @@ -111,6 +111,18 @@ class TestAnsibleInventoryFormatConstraints(unittest.TestCase): 'identity_hosts', 'infra_containers', 'infra_hosts', + 'ironic-server_hosts', + 'ironic_conductor_container', + 'ironic_api_container', + 'ironic_conductor', + 'ironic-infra_containers', + 'ironic-infra_hosts', + 'ironic_servers', + 'ironic-server_containers', + 'ironic_all', + 'ironic_server', + 'ironic_server_container', + 'ironic_api', 'keystone', 'keystone_all', 'keystone_container',