From b40dd35bdcd69e92e742df4ce74b86601a2eee29 Mon Sep 17 00:00:00 2001 From: Michael Davies Date: Fri, 27 Nov 2015 12:59:56 +1030 Subject: [PATCH] General cleanup, incl. copyright headers --- defaults/main.yml | 39 +++++++++++++--------- handlers/main.yml | 5 +++ local_install.sh | 4 +++ meta/main.yml | 13 ++++++++ tasks/ironic_conductor_post_install.yml | 16 --------- tasks/ironic_conductor_pre_install.yml | 43 +++++++++++++++++++++++++ tasks/ironic_db_setup.yml | 3 +- tasks/ironic_install.yml | 8 +++-- tasks/ironic_pre_install.yml | 27 ++++++++++++++++ tasks/ironic_upstart_init.yml | 4 +-- tasks/main.yml | 1 + tasks/python_ironicclient_install.yml | 7 ++-- tests/ansible.cfg | 1 + tests/inventory | 5 ++- tests/local_install.yml | 17 +++++++++- 15 files changed, 150 insertions(+), 43 deletions(-) create mode 100644 tasks/ironic_conductor_pre_install.yml diff --git a/defaults/main.yml b/defaults/main.yml index 22e2a6dc..8b021be2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -1,5 +1,19 @@ --- -# defaults file for os_ironic +# Copyright 2015, 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. + +# Defaults file for openstack-ansible-ironic # Verbosity Options debug: False @@ -23,16 +37,12 @@ ironic_system_log_folder: "/var/log/{{ ironic_system_user_name }}" # Ironic API ironic_api_program_name: ironic-api - # Ironic Conductor ironic_conductor_program_name: ironic-conductor - - # Python Ironic Client python_ironic_client_program_name: ironic - ironic_service_names: - "{{ ironic_api_program_name }}" - "{{ ironic_conductor_program_name }}" @@ -47,8 +57,9 @@ ironic_database_password: gu1d0 database_root_user: root database_root_password: sp4m3ggs -# If you want to regenerate the ironic users SSH keys, on each run, set this var to True -# Otherwise keys will be generated on the first run and not regenerated each run. +# If you want to regenerate the ironic users SSH keys, on each run, set this +# var to True. Otherwise keys will be generated on the first run and not +# regenerated each run. ironic_recreate_keys: False ironic_bin: "{{ ironic_venv_bin }}" @@ -60,6 +71,9 @@ ironic_common_apt_packages: - python-pip - git +ironic_common_pip_packages: + - virtualenvwrapper + ironic_conductor_apt_packages: - libmysqlclient-dev - libxml2-dev @@ -76,17 +90,10 @@ ironic_conductor_apt_packages: - open-iscsi - ipmitool -ironic_pip_packages: - - virtualenvwrapper - - six - - tox +ironic_conductor_pip_packages: - mysql-python - - python_ironicclient -ironicclient_pip_packages: - - python_ironicclient - -## Ironic service +## 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('/', '_') }}" diff --git a/handlers/main.yml b/handlers/main.yml index 797046bd..e9577b87 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -21,3 +21,8 @@ with_items: ironic_service_names failed_when: false +- name: Restart tftpd-hpa + service: + name: "tftpd-hpa" + state: restarted + failed_when: false diff --git a/local_install.sh b/local_install.sh index d0c467ab..50614636 100755 --- a/local_install.sh +++ b/local_install.sh @@ -15,6 +15,10 @@ ROLE_NAME=$(basename $(pwd)) +# Note(mrda): In testing we often cycle machines, so this just helps our +# testing efforts. Don't do this in production. +export ANSIBLE_HOST_KEY_CHECKING=False + pushd tests ansible-playbook -i inventory local_install.yml -e rolename=${ROLE_NAME} popd diff --git a/meta/main.yml b/meta/main.yml index f30d0223..3530b157 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,4 +1,17 @@ --- +# Copyright 2015, 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. galaxy_info: author: OpenStack description: Baremetal provisioning for Openstack diff --git a/tasks/ironic_conductor_post_install.yml b/tasks/ironic_conductor_post_install.yml index fc927750..b4212f70 100644 --- a/tasks/ironic_conductor_post_install.yml +++ b/tasks/ironic_conductor_post_install.yml @@ -13,19 +13,6 @@ # See the License for the specific language governing permissions and # limitations under the License. -- name: Install apt packages - apt: - pkg: "{{ item }}" - state: latest - register: install_packages - until: install_packages|success - retries: 5 - delay: 2 - with_items: ironic_conductor_apt_packages - tags: - - ironic-install - - ironic-apt-packages - - name: Create /tftpboot file: path: "/tftpboot" @@ -84,6 +71,3 @@ when: not chain32_exists and chain32_stat.stat.exists tags: - tftpd-hpa - - - diff --git a/tasks/ironic_conductor_pre_install.yml b/tasks/ironic_conductor_pre_install.yml new file mode 100644 index 00000000..37600464 --- /dev/null +++ b/tasks/ironic_conductor_pre_install.yml @@ -0,0 +1,43 @@ +--- +# Copyright 2015, 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: Install ironic-conductor specific apt packages + apt: + pkg: "{{ item }}" + state: latest + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + with_items: ironic_conductor_apt_packages + tags: + - ironic-install + - ironic-conductor + - ironic-apt-packages + +- name: Install ironic-conductor specific pip dependencies + pip: + name: "{{ item }}" + state: present + extra_args: "{{ pip_install_options|default('') }}" + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + with_items: ironic_conductor_pip_packages + tags: + - ironic-install + - ironic-conductor + - ironic-pip-packages diff --git a/tasks/ironic_db_setup.yml b/tasks/ironic_db_setup.yml index 64e7e0d8..b49b6af0 100644 --- a/tasks/ironic_db_setup.yml +++ b/tasks/ironic_db_setup.yml @@ -44,9 +44,8 @@ sudo: yes sudo_user: "{{ ironic_system_user_name }}" notify: - - restart ironic-conductor + - Restart ironic services when: ironic_checkout.changed tags: - ironic-db-setup - ironic-conductor - diff --git a/tasks/ironic_install.yml b/tasks/ironic_install.yml index 0f5ea832..113feee8 100644 --- a/tasks/ironic_install.yml +++ b/tasks/ironic_install.yml @@ -15,15 +15,17 @@ - name: Install Ironic (python system library) when: ironic_checkout.changed and not ironic_venv_enabled - pip: name="file://{{ ironic_git_dest }}" + pip: + name: "file://{{ ironic_git_dest }}" tags: - ironic-api - ironic-conductor - name: Install Ironic (openstack venv) when: ironic_checkout.changed and ironic_venv_enabled - pip: name="file://{{ ironic_git_dest }}" virtualenv="/openstack/venvs/ironic-{{ ironic_venv_tag }}" + pip: + name: "file://{{ ironic_git_dest }}" + virtualenv: "/openstack/venvs/ironic-{{ ironic_venv_tag }}" tags: - ironic-api - ironic-conductor - diff --git a/tasks/ironic_pre_install.yml b/tasks/ironic_pre_install.yml index 6c40786d..ae105456 100644 --- a/tasks/ironic_pre_install.yml +++ b/tasks/ironic_pre_install.yml @@ -123,3 +123,30 @@ tags: - ironic-api - ironic-conductor + +- name: Install common dependencies via apt + apt: + pkg: "{{ item }}" + state: latest + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + with_items: ironic_common_apt_packages + tags: + - ironic-install + - ironic-apt-packages + +- name: Install common dependencies via pip + pip: + name: "{{ item }}" + state: present + extra_args: "{{ pip_install_options|default('') }}" + register: install_packages + until: install_packages|success + retries: 5 + delay: 2 + with_items: ironic_common_pip_packages + tags: + - ironic-install + - ironic-pip-packages diff --git a/tasks/ironic_upstart_init.yml b/tasks/ironic_upstart_init.yml index 4cf7ca5e..db7f4647 100644 --- a/tasks/ironic_upstart_init.yml +++ b/tasks/ironic_upstart_init.yml @@ -21,7 +21,7 @@ system_group: "{{ ironic_system_group_name }}" service_home: "{{ ironic_system_home_folder }}" # TODO(mrda): define groups -# when: inventory_hostname in groups['ironic_api_metadata'] +# when: inventory_hostname in groups['tbd'] - include: ironic_upstart_common_init.yml vars: @@ -31,5 +31,5 @@ system_group: "{{ ironic_system_group_name }}" service_home: "{{ ironic_system_home_folder }}" # TODO(mrda): define groups -# when: inventory_hostname in groups['ironic_cert'] +# when: inventory_hostname in groups['tbd'] diff --git a/tasks/main.yml b/tasks/main.yml index 59197a34..652521c4 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -15,6 +15,7 @@ - include: ironic_pre_install.yml - include: ironic_get_source.yml + - include: ironic_conductor_pre_install.yml - include: ironic_install.yml - include: python_ironicclient_install.yml - include: ironic_conductor_post_install.yml diff --git a/tasks/python_ironicclient_install.yml b/tasks/python_ironicclient_install.yml index 10df330d..174fae87 100644 --- a/tasks/python_ironicclient_install.yml +++ b/tasks/python_ironicclient_install.yml @@ -15,12 +15,15 @@ - name: Install Python-Ironicclient (python system library) when: python_ironicclient_checkout.changed and not ironic_venv_enabled - pip: name="file://{{ python_ironicclient_git_dest }}" + pip: + name: "file://{{ python_ironicclient_git_dest }}" tags: - ironic-client - name: Install Python-Ironicclient (openstack venv) when: python_ironicclient_checkout.changed and ironic_venv_enabled - pip: name="file://{{ python_ironicclient_git_dest }}" virtualenv="/openstack/venvs/ironic-{{ ironic_venv_tag }}" + pip: + name: "file://{{ python_ironicclient_git_dest }}" + virtualenv: "/openstack/venvs/ironic-{{ ironic_venv_tag }}" tags: - ironic-client diff --git a/tests/ansible.cfg b/tests/ansible.cfg index 6c8a3443..5211bc11 100644 --- a/tests/ansible.cfg +++ b/tests/ansible.cfg @@ -1,2 +1,3 @@ [defaults] roles_path = ../.. + diff --git a/tests/inventory b/tests/inventory index d0e07048..1713a491 100644 --- a/tests/inventory +++ b/tests/inventory @@ -1,5 +1,8 @@ [all] localhost ansible_connection=local ansible_user=root +# Note(mrda): 'ironicinstallhost' will need to externally resolve to where +# you want to do an 'allinone' install, and the root account will need to have +# your ssh public_key in it's /root/.ssh/authorized_keys file [installhost] -installhost ansible_user=root ansible_ssh_port=22 ansible_ssh_host=192.168.1.21 +installhost ansible_user=root ansible_ssh_port=22 ansible_ssh_host=ironicinstallhost diff --git a/tests/local_install.yml b/tests/local_install.yml index e5aa3468..d1af40b5 100644 --- a/tests/local_install.yml +++ b/tests/local_install.yml @@ -1,4 +1,19 @@ -- name: Do things with the openstack-ironic-role role +--- +# Copyright 2015, 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: Perform an all-in-one install using the openstack-ansible-ironic role remote_user: root hosts: installhost roles: