diff --git a/playbooks/install.yaml b/playbooks/install.yaml index 64796a286..12e5df785 100644 --- a/playbooks/install.yaml +++ b/playbooks/install.yaml @@ -5,4 +5,5 @@ sudo: yes gather_facts: yes roles: + - { role: bifrost-prep-for-install, when: skip_install is not defined } - ironic-install diff --git a/playbooks/roles/bifrost-configdrives-dynamic/tasks/ssh_public_key_path.yaml b/playbooks/roles/bifrost-configdrives-dynamic/tasks/ssh_public_key_path.yaml index 07fda8df6..ccfaff6e2 100644 --- a/playbooks/roles/bifrost-configdrives-dynamic/tasks/ssh_public_key_path.yaml +++ b/playbooks/roles/bifrost-configdrives-dynamic/tasks/ssh_public_key_path.yaml @@ -12,26 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. --- -# TODO(TheJulia) This seems like it needs to be refactored if we are -# needing to determine if the host is a CI host. Since we have specific -# logic for identifying the SSH key, it is necessary for now. -# Possible refactor path, fact collection role that feeds the variables -# into the inventory if they are not already defined, which seems -# to make the most sense in the long run. -- name: "Set ci_testing_zuul if it appears we are running in upstream OpenStack CI" - set_fact: - ci_testing_zuul: true - when: "'bare-trusty' in ansible_hostname" -- name: "Determine if OpenStack CI is missing an SSH key" - stat: path={{ssh_public_key_path}} - register: test_ssh_public_key_path - when: ci_testing_zuul is defined -- name: "Create an SSH key for Jenkins user if operating in OpenStack CI" - shell: ssh-keygen -f ~/.ssh/id_rsa -N "" - when: ci_testing_zuul is defined and test_ssh_public_key_path.stat.exists == false -- name: "Create an empty ssh known_hosts file for Jenkins user if operating in OpenStack CI" - shell: touch ~/.ssh/known_hosts && chmod 600 ~/.ssh/known_hosts - when: ci_testing_zuul is defined and test_ssh_public_key_path.stat.exists == false - name: "Defined ssh_public_key_path - Check to see if there is a file where the ssh_public_key_path is defined" local_action: stat path={{ ssh_public_key_path }} register: test_ssh_public_key_path diff --git a/playbooks/roles/bifrost-configdrives/tasks/ssh_public_key_path.yaml b/playbooks/roles/bifrost-configdrives/tasks/ssh_public_key_path.yaml index 1147d21c9..ccfaff6e2 100644 --- a/playbooks/roles/bifrost-configdrives/tasks/ssh_public_key_path.yaml +++ b/playbooks/roles/bifrost-configdrives/tasks/ssh_public_key_path.yaml @@ -12,16 +12,6 @@ # See the License for the specific language governing permissions and # limitations under the License. --- -- name: "Determine if OpenStack CI is missing an SSH key" - stat: path={{ssh_public_key_path}} - register: test_ssh_public_key_path - when: ci_testing_zuul is defined -- name: "Create an SSH key for Jenkins user if operating in OpenStack CI" - shell: ssh-keygen -f ~/.ssh/id_rsa -N "" - when: ci_testing_zuul is defined and test_ssh_public_key_path.stat.exists == false -- name: "Create an empty ssh known_hosts file for Jenkins user if operating in OpenStack CI" - shell: touch ~/.ssh/known_hosts && chmod 600 ~/.ssh/known_hosts - when: ci_testing_zuul is defined and test_ssh_public_key_path.stat.exists == false - name: "Defined ssh_public_key_path - Check to see if there is a file where the ssh_public_key_path is defined" local_action: stat path={{ ssh_public_key_path }} register: test_ssh_public_key_path diff --git a/playbooks/roles/bifrost-openstack-ci-prep/README.md b/playbooks/roles/bifrost-openstack-ci-prep/README.md new file mode 100644 index 000000000..c44533913 --- /dev/null +++ b/playbooks/roles/bifrost-openstack-ci-prep/README.md @@ -0,0 +1,90 @@ +bifrost-openstack-ci-prep +========================= + +This role is intended to be utilized in order to set the installation +environment and various job settings that are specific to OpenStack CI +such that the Bifrost CI job is able to complete seccessfully. + +Requirements +------------ + +This role requires: + +- Ansible 1.9 + + +Role Variables +-------------- + +ssh_public_key_path: The path to where the SSH public key can be located. + If missing, it is created. + +ironic_git_folder: The folder where the ironic codebase has been cloned to. + +ironicclient_git_folder: The folder where the python-ironicclient code base + has been cloned to. + +shade_git_folder: The folder where the shade code base has been cloned to. + +ansible_env.ZUUL_CHANGES: The list of changes from Zuul that need to be + applied to the cloned repositories before testing + can proceed. + +Dependencies +------------ + +None at this time. + +Example Playbook +---------------- + +In this example below, specific facts based on environment variables are +utilized to engage the role, which first calls bifrost-prep-for-install +which clones the repositories and resets their state to a known state. + +The ci_testing_zuul fact is set in the pre_tasks below to allow for activation +of the logic to properly handle an OpenStack CI environment node. + +- hosts: localhost + connection: local + name: "Prepare for installation" + sudo: no + gather_facts: yes + pre_tasks: + - name: "Set ci_testing_zuul if it appears we are running in upstream OpenStack CI" + set_fact: + ci_testing: true + ci_testing_zuul: true + ironic_git_url: /opt/git/openstack/ironic + ironicclient_git_url: /opt/git/openstack/python-ironicclient + shade_git_url: /opt/git/openstack-infra/shade + when: lookup('env', 'ZUUL_BRANCH') != "" + - name: "Set ci_testing_zuul_changes if ZUUL_CHANGES is set" + set_fact: + ci_testing_zuul_changes: true + when: lookup('env', 'ZUUL_CHANGES') != "" + roles: + - { role: bifrost-prep-for-install, when: skip_install is not defined } + - { role: bifrost-openstack-ci-prep, when: ci_testing_zuul is defined } + + +License +------- + +Copyright (c) 2015 Hewlett-Packard Development Company, L.P. + +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. + +Author Information +------------------ + diff --git a/playbooks/roles/bifrost-openstack-ci-prep/defaults/main.yml b/playbooks/roles/bifrost-openstack-ci-prep/defaults/main.yml new file mode 100644 index 000000000..5c7ca92ce --- /dev/null +++ b/playbooks/roles/bifrost-openstack-ci-prep/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for bifrost-openstack-ci-prep diff --git a/playbooks/roles/ironic-install/files/parse_zuul_changes.py b/playbooks/roles/bifrost-openstack-ci-prep/files/parse_zuul_changes.py similarity index 100% rename from playbooks/roles/ironic-install/files/parse_zuul_changes.py rename to playbooks/roles/bifrost-openstack-ci-prep/files/parse_zuul_changes.py diff --git a/playbooks/roles/bifrost-openstack-ci-prep/meta/main.yml b/playbooks/roles/bifrost-openstack-ci-prep/meta/main.yml new file mode 100644 index 000000000..583a90eb0 --- /dev/null +++ b/playbooks/roles/bifrost-openstack-ci-prep/meta/main.yml @@ -0,0 +1,116 @@ +--- +galaxy_info: + author: Ironic Developers + description: Prepare and set CI node settings for OpenStack CI tests. + company: OpenStack + license: Apache + min_ansible_version: 1.9 + # + # Below are all platforms currently available. Just uncomment + # the ones that apply to your role. If you don't see your + # platform on this list, let us know and we'll get it added! + # + platforms: + #- name: EL + # versions: + # - all + # - 5 + # - 6 + # - 7 + #- name: GenericUNIX + # versions: + # - all + # - any + #- name: Fedora + # versions: + # - all + # - 16 + # - 17 + # - 18 + # - 19 + # - 20 + #- name: SmartOS + # versions: + # - all + # - any + #- name: opensuse + # versions: + # - all + # - 12.1 + # - 12.2 + # - 12.3 + # - 13.1 + # - 13.2 + #- name: Amazon + # versions: + # - all + # - 2013.03 + # - 2013.09 + #- name: GenericBSD + # versions: + # - all + # - any + #- name: FreeBSD + # versions: + # - all + # - 8.0 + # - 8.1 + # - 8.2 + # - 8.3 + # - 8.4 + # - 9.0 + # - 9.1 + # - 9.1 + # - 9.2 + #- name: Ubuntu + # versions: + # - all + # - lucid + # - maverick + # - natty + # - oneiric + # - precise + # - quantal + # - raring + # - saucy + - trusty + #- name: SLES + # versions: + # - all + # - 10SP3 + # - 10SP4 + # - 11 + # - 11SP1 + # - 11SP2 + # - 11SP3 + #- name: GenericLinux + # versions: + # - all + # - any + #- name: Debian + # versions: + # - all + # - etch + # - lenny + # - squeeze + # - wheezy + # + # Below are all categories currently available. Just as with + # the platforms above, uncomment those that apply to your role. + # + categories: + - cloud + - cloud:openstack + #- cloud:gce + #- cloud:rax + #- clustering + #- database + #- database:nosql + #- database:sql + #- development + #- monitoring + #- networking + #- packaging + #- system + #- web +dependencies: [] diff --git a/playbooks/roles/bifrost-openstack-ci-prep/tasks/main.yml b/playbooks/roles/bifrost-openstack-ci-prep/tasks/main.yml new file mode 100644 index 000000000..2c5acb31e --- /dev/null +++ b/playbooks/roles/bifrost-openstack-ci-prep/tasks/main.yml @@ -0,0 +1,42 @@ +# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. +# +# 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: "Shade - Apply CI changes if necessary" + script: parse_zuul_changes.py {{ shade_git_folder }} https://review.openstack.org openstack-infra/shade "{{ lookup('env', 'ZUUL_CHANGES') }}" + when: ci_testing_zuul_changes is defined and skip_install | bool != true +- name: "python-ironicclient - Apply CI changes if necessary" + script: parse_zuul_changes.py {{ ironicclient_git_folder }} https://review.openstack.org openstack/python-ironicclient "{{ lookup('env', 'ZUUL_CHANGES') }}" + when: ci_testing_zuul_changes is defined and skip_install | bool != True +- name: "Ironic - Apply CI changes if necessary" + script: parse_zuul_changes.py {{ ironic_git_folder }} https://review.openstack.org openstack/ironic "{{ lookup('env', 'ZUUL_CHANGES') }}" + when: ci_testing_zuul_changes is defined and skip_install | bool != True +# NOTE(TheJulia): Override the stored fact values for username/password when operating +# in OpenStack CI. +- name: "Set facts for OpenStack CI" + set_fact: + mysql_username: "openstack_citest" + mysql_password: "openstack_citest" + disable_dnsmasq_dns: True + when: ci_testing_zuul_changes is defined +- name: "Determine if OpenStack CI is missing an SSH key" + stat: path={{ssh_public_key_path}} + register: test_ssh_public_key_path + when: ci_testing_zuul is defined +- name: "Create an SSH key for Jenkins user if operating in OpenStack CI" + shell: ssh-keygen -f ~/.ssh/id_rsa -N "" + when: ci_testing_zuul is defined and test_ssh_public_key_path.stat.exists == false +- name: "Create an empty ssh known_hosts file for Jenkins user if operating in OpenStack CI" + shell: touch ~/.ssh/known_hosts && chmod 600 ~/.ssh/known_hosts + when: ci_testing_zuul is defined and test_ssh_public_key_path.stat.exists == false diff --git a/playbooks/roles/bifrost-openstack-ci-prep/vars/main.yml b/playbooks/roles/bifrost-openstack-ci-prep/vars/main.yml new file mode 100644 index 000000000..542ca224f --- /dev/null +++ b/playbooks/roles/bifrost-openstack-ci-prep/vars/main.yml @@ -0,0 +1,2 @@ +--- +# vars file for bifrost-openstack-ci-prep diff --git a/playbooks/roles/bifrost-prep-for-install/README.md b/playbooks/roles/bifrost-prep-for-install/README.md new file mode 100644 index 000000000..9adb50b02 --- /dev/null +++ b/playbooks/roles/bifrost-prep-for-install/README.md @@ -0,0 +1,87 @@ +bifrost-prep-for-install +======================== + +This role performs the intial file downloads to allow a user to install +bifrost. It does not require internet access, as new URLs or local +filesystem clones of repositories can be defined. + +Requirements +------------ + +This role requires: + +- Ansible 1.9 + +Internet access was originally a requirement for installation, however access +is no longer required. See doc/source/offline-install.rst for details on +installing without it. + +Role Variables +-------------- + +git_root: The base folder that git repos should be located in. Defaults to + "/tmp". + +ironicclient_git_url: URL for ironicclient, defaults to: + https://git.openstack.org/openstack/python-ironicclient + +shade_git_url: URL for shade, defaults to: + https://git.openstack.org/openstack-infra/shade + +ironic_git_url: URL for ironic, defaults to: + https://git.openstack.org/openstack/ironic + +ironicclient_git_folder: The folder to clone ironicclient to if missing, + defaults to: "{{ git_root}}/ironicclient.git" + +ironic_git_folder: The folder to clone ironic to if missing, default to: + "{{ git_root}}/ironic.git" + +shade_git_folder: The folder to clone shade to if missing, defaults to: + "{{ git_root}}/shade.git" + +ironicclient_git_branch: Branch to install, defaults to "master". + +ironic_git_branch: Branch to install, defaults to "master". + +shade_git_branch: Branch to install, defaults to "master". + +Dependencies +------------ + +None at this time. + +Example Playbook +---------------- + +- hosts: localhost + connection: local + name: "Install Ironic" + sudo: yes + gather_facts: yes + roles: + - { role: bifrost-prep-for-install, when: skip_install is not defined } + - role: ironic-install + cleaning: false + testing: true + +License +------- + +Copyright (c) 2015 Hewlett-Packard Development Company, L.P. + +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. + +Author Information +------------------ + diff --git a/playbooks/roles/bifrost-prep-for-install/defaults/main.yml b/playbooks/roles/bifrost-prep-for-install/defaults/main.yml new file mode 100644 index 000000000..74a06ff16 --- /dev/null +++ b/playbooks/roles/bifrost-prep-for-install/defaults/main.yml @@ -0,0 +1,16 @@ +--- +# git_root is the folder where to place downloaded git repos +git_root: /tmp +# *_git_url can be overridden by local clones for offline installs +dib_git_url: https://git.openstack.org/openstack/diskimage-builder +ironicclient_git_url: https://git.openstack.org/openstack/python-ironicclient +shade_git_url: https://git.openstack.org/openstack-infra/shade +ironic_git_url: https://git.openstack.org/openstack/ironic +# *_git_folder can be overridden by local clones for offline installs +ironicclient_git_folder: "{{ git_root}}/ironicclient.git" +ironic_git_folder: "{{ git_root}}/ironic.git" +shade_git_folder: "{{ git_root}}/shade.git" +# *_git_branch can be overridden for stable branch testing +ironicclient_git_branch: master +ironic_git_branch: master +shade_git_branch: master diff --git a/playbooks/roles/bifrost-prep-for-install/meta/main.yml b/playbooks/roles/bifrost-prep-for-install/meta/main.yml new file mode 100644 index 000000000..47aad5263 --- /dev/null +++ b/playbooks/roles/bifrost-prep-for-install/meta/main.yml @@ -0,0 +1,16 @@ +--- +galaxy_info: + author: Ironic Developers + description: Install Ironic for Bifrost + company: OpenStack + license: Apache + min_ansible_version: 1.9 + platforms: + - name: Ubuntu + versions: + - trusty + - utopic + categories: + - cloud + - cloud:openstack +dependencies: [] diff --git a/playbooks/roles/bifrost-prep-for-install/tasks/main.yml b/playbooks/roles/bifrost-prep-for-install/tasks/main.yml new file mode 100644 index 000000000..a5cc546c9 --- /dev/null +++ b/playbooks/roles/bifrost-prep-for-install/tasks/main.yml @@ -0,0 +1,39 @@ +# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. +# +# 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: "Downloading Ironic" + command: git clone {{ ironic_git_url }} {{ ironic_git_folder }} chdir={{ git_root }} creates={{ ironic_git_folder }} +- name: "Ironic - checking out branch" + command: git checkout -f {{ ironic_git_branch }} chdir={{ ironic_git_folder }} +- name: "Ironic - resetting branch" + command: git reset --hard {{ ironic_git_branch }} chdir={{ ironic_git_folder }} +- name: "Ironic - resyncing to current branch" + command: git pull --ff-only chdir={{ ironic_git_folder }} +- name: "python-ironicclient - Retrieving library from git.openstack.org" + command: git clone {{ ironicclient_git_url }} {{ ironicclient_git_folder }} chdir={{ git_root }} creates={{ ironicclient_git_folder }} +- name: "python-ironicclient - Checking out branch" + command: git checkout -f {{ ironicclient_git_branch}} chdir={{ironicclient_git_folder}} +- name: "python-ironicclient - Resetting local repository" + command: git reset --hard {{ ironicclient_git_branch }} chdir={{ ironicclient_git_folder }} +- name: "python-ironicclient - Resyncing local repository" + command: git pull --ff-only chdir={{ ironicclient_git_folder }} +- name: "Shade - Retrieving library from git.openstack.org" + command: git clone {{ shade_git_url }} {{ shade_git_folder }} chdir={{ git_root }} creates={{ shade_git_folder }} +- name: "Shade - Checking out branch" + command: git checkout -f {{ shade_git_branch }} chdir={{ shade_git_folder }} +- name: "Shade - Resetting local repository" + command: git reset --hard {{ shade_git_branch }} chdir={{ shade_git_folder }} +- name: "Shade - Resyncing local repository" + command: git pull --ff-only chdir={{ shade_git_folder }} diff --git a/playbooks/roles/ironic-enroll/tasks/main.yml b/playbooks/roles/ironic-enroll/tasks/main.yml index d3dc31b17..1d2f09443 100644 --- a/playbooks/roles/ironic-enroll/tasks/main.yml +++ b/playbooks/roles/ironic-enroll/tasks/main.yml @@ -21,9 +21,6 @@ - name: "Error if file does not exist." fail: msg="The variable defined for baremetal_csv_file is not to a file. Please define a file and try again." when: test_baremetal_csv_file.stat.isreg == false -- name: "Report the contents of the baremetal_csv_file if we are running in OpenStack CI" - command: cat "{{ baremetal_csv_file }}" - when: ci_testing_zuul is defined - name: "If testing, enroll virtual machines." include: virtual_enroll.yaml when: testing == true diff --git a/playbooks/roles/ironic-install/defaults/main.yml b/playbooks/roles/ironic-install/defaults/main.yml index 3bdc2f991..39f0a3384 100644 --- a/playbooks/roles/ironic-install/defaults/main.yml +++ b/playbooks/roles/ironic-install/defaults/main.yml @@ -42,3 +42,9 @@ dib_git_url: https://git.openstack.org/openstack/diskimage-builder ironicclient_git_url: https://git.openstack.org/openstack/python-ironicclient shade_git_url: https://git.openstack.org/openstack-infra/shade ironic_git_url: https://git.openstack.org/openstack/ironic +mysql_username: "root" +mysql_password: "" +disable_dnsmasq_dns: False +ironic_git_folder: /tmp/ironic.git +ironicclient_git_folder: /tmp/ironicclient.git +shade_git_folder: /tmp/shade.git diff --git a/playbooks/roles/ironic-install/tasks/ironicclient_source_install.yml b/playbooks/roles/ironic-install/tasks/ironicclient_source_install.yml deleted file mode 100644 index 2b5d0b6df..000000000 --- a/playbooks/roles/ironic-install/tasks/ironicclient_source_install.yml +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. -# -# 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: "python-ironicclient - Retrieving library from git.openstack.org" - command: git clone {{ ironicclient_git_url }} chdir=/opt/stack creates=/opt/stack/python-ironicclient -- name: "python-ironicclient - Checking out master branch" - command: git checkout -f master chdir=/opt/stack/python-ironicclient -- name: "python-ironicclient - Resetting local repository" - command: git reset --hard master chdir=/opt/stack/python-ironicclient -- name: "python-ironicclient - Resyncing local repository" - command: git pull --ff-only chdir=/opt/stack/python-ironicclient -- name: "python-ironicclient - Apply CI changes if necessary" - script: parse_zuul_changes.py /opt/stack/python-ironicclient https://review.openstack.org openstack/python-ironicclient "{{ lookup('env', 'ZUUL_CHANGES') }}" - when: ci_testing_zuul_changes is defined -- name: "python-ironicclient - Installing patched python-ironicclient library." - command: pip install --force-reinstall /opt/stack/python-ironicclient diff --git a/playbooks/roles/ironic-install/tasks/main.yml b/playbooks/roles/ironic-install/tasks/main.yml index 0f806919b..4e6aa67f1 100644 --- a/playbooks/roles/ironic-install/tasks/main.yml +++ b/playbooks/roles/ironic-install/tasks/main.yml @@ -31,21 +31,11 @@ with_items: - pxelinux when: ansible_distribution_version|version_compare('14.10', '>=') and ansible_distribution == 'Ubuntu' +# NOTE: Creation no longer be required..., - name: "Ensuring /opt/stack is present" file: name=/opt/stack state=directory owner=root group=root -- name: "Downloading Ironic" - command: git clone {{ ironic_git_url }} chdir=/opt/stack creates=/opt/stack/ironic -- name: "Ironic - checking out master branch" - command: git checkout -f master chdir=/opt/stack/ironic -- name: "Ironic - resetting master branch" - command: git reset --hard master chdir=/opt/stack/ironic -- name: "Ironic - resyncing to current master branch" - command: git pull --ff-only chdir=/opt/stack/ironic/ -- name: "Ironic - Apply CI changes if necessary" - script: parse_zuul_changes.py /opt/stack/ironic https://review.openstack.org openstack/ironic "{{ lookup('env', 'ZUUL_CHANGES') }}" - when: ci_testing_zuul_changes is defined - name: "Ironic Client - Install from source if configured to do so." - include: ironicclient_source_install.yml + command: pip install --force-reinstall {{ ironicclient_git_folder }} when: skip_install is not defined and ((ironicclient_source_install is defined and ironicclient_source_install == true) or ci_testing == true) - name: "Ironic Client - Install from pip" pip: name=python-ironicclient state=present @@ -54,7 +44,7 @@ pip: name=proliantutils state=present when: skip_install is not defined - name: "Shade - Install from source if configured to do so" - include: shade_source_install.yml + command: pip install --force-reinstall {{ shade_git_folder }} when: skip_install is not defined and ((shade_source_install is defined and shade_source_install == true) or ci_testing == true) - name: "Shade - Installing patched shade library." pip: name=shade state=latest @@ -82,21 +72,12 @@ rabbitmq_user: user=ironic password={{ ironic_db_password }} force=yes state=present configure_priv=.* write_priv=.* read_priv=.* no_log: true - name: "MySQL - Creating DB" - mysql_db: login_user=root login_password={{ mysql_password }} name=ironic state=present encoding=utf8 + mysql_db: login_user={{ mysql_username }} login_password={{ mysql_password }} name=ironic state=present encoding=utf8 register: test_created_db - when: ci_testing_zuul is not defined - name: "MySQL - Creating user for Ironic" - mysql_user: login_user=root login_password={{ mysql_password }} name=ironic password={{ ironic_db_password }} priv=ironic.*:ALL state=present - when: ci_testing_zuul is not defined -- name: "MySQL - Creating DB - OpenStack CI" - mysql_db: login_user=openstack_citest login_password=openstack_citest name=ironic state=present encoding=utf8 - register: test_created_db - when: ci_testing_zuul is defined -- name: "MySQL - Creating user for Ironic - OpenStack CI" - mysql_user: login_user=openstack_citest login_password=openstack_citest name=ironic password={{ ironic_db_password }} priv=ironic.*:ALL state=present - when: ci_testing_zuul is defined + mysql_user: login_user={{ mysql_username }} login_password={{ mysql_password }} name=ironic password={{ ironic_db_password }} priv=ironic.*:ALL state=present - name: "Install Ironic using pip" - pip: name=/opt/stack/ironic state=latest + pip: name={{ ironic_git_folder }} state=latest when: skip_install is not defined - name: "Ensure /etc/ironic exists" file: name=/etc/ironic state=directory @@ -105,7 +86,7 @@ - name: "Place Ironic IPA Agent PXE configuration file" template: src=agent_config.template.j2 dest=/etc/ironic/agent_config.template - name: "Copy policy.json to /etc/ironic" - copy: src=/opt/stack/ironic/etc/ironic/policy.json dest=/etc/ironic/ + copy: src="{{ ironic_git_folder }}/etc/ironic/policy.json" dest=/etc/ironic/ - name: "Creating Ironic DB Schema" command: ironic-dbsync --config-file /etc/ironic/ironic.conf create_schema when: test_created_db.changed == true diff --git a/playbooks/roles/ironic-install/tasks/shade_source_install.yml b/playbooks/roles/ironic-install/tasks/shade_source_install.yml deleted file mode 100644 index 7b547b986..000000000 --- a/playbooks/roles/ironic-install/tasks/shade_source_install.yml +++ /dev/null @@ -1,28 +0,0 @@ -# Copyright (c) 2015 Hewlett-Packard Development Company, L.P. -# -# 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: "Shade - Retrieving library from git.openstack.org" - command: git clone {{ shade_git_url }} chdir=/opt/stack creates=/opt/stack/shade -- name: "Shade - Checking out master branch" - command: git checkout -f master chdir=/opt/stack/shade -- name: "Shade - Resetting local repository" - command: git reset --hard master chdir=/opt/stack/shade -- name: "Shade - Resyncing local repository" - command: git pull --ff-only chdir=/opt/stack/shade -- name: "Shade - Apply CI changes if necessary" - script: parse_zuul_changes.py /opt/stack/shade https://review.openstack.org openstack-infra/shade "{{ lookup('env', 'ZUUL_CHANGES') }}" - when: ci_testing_zuul_changes is defined -- name: "Shade - Installing patched shade library." - command: pip install --force-reinstall /opt/stack/shade diff --git a/playbooks/roles/ironic-install/templates/dnsmasq.conf.j2 b/playbooks/roles/ironic-install/templates/dnsmasq.conf.j2 index 9a45b6010..7de48e779 100644 --- a/playbooks/roles/ironic-install/templates/dnsmasq.conf.j2 +++ b/playbooks/roles/ironic-install/templates/dnsmasq.conf.j2 @@ -7,7 +7,7 @@ # Listen on this specific port instead of the standard DNS port # (53). Setting this to zero completely disables DNS function, # leaving only DHCP and/or TFTP. -{% if ci_testing_zuul is defined %} +{% if disable_dnsmasq_dns %} port=0 {% else %} port=53 diff --git a/playbooks/test-bifrost-dynamic.yaml b/playbooks/test-bifrost-dynamic.yaml index 7fe78edd6..5a1568d29 100644 --- a/playbooks/test-bifrost-dynamic.yaml +++ b/playbooks/test-bifrost-dynamic.yaml @@ -9,31 +9,39 @@ - hosts: localhost connection: local name: "Executes install, enrollment, and testing in one playbook" - sudo: yes + sudo: no gather_facts: yes pre_tasks: - name: "Set ci_testing_zuul if it appears we are running in upstream OpenStack CI" set_fact: ci_testing: true ci_testing_zuul: true + ironic_git_url: /opt/git/openstack/ironic + ironicclient_git_url: /opt/git/openstack/python-ironicclient + shade_git_url: /opt/git/openstack-infra/shade when: lookup('env', 'ZUUL_BRANCH') != "" - name: "Set ci_testing_zuul_changes if ZUUL_CHANGES is set" set_fact: ci_testing_zuul_changes: true when: lookup('env', 'ZUUL_CHANGES') != "" - - name: "Set ci_testing_zuul if it appears we are running in upstream OpenStack CI" - set_fact: - ci_testing_zuul: true - when: "'bare-trusty' in ansible_hostname" - name: "Override the ipv4_gateway setting" set_fact: ipv4_gateway: "192.168.122.1" - - name: "Collect process list if running in OpenStack CI" + roles: + - { role: bifrost-prep-for-install, when: skip_install is not defined } + - { role: bifrost-openstack-ci-prep, when: ci_testing_zuul is defined } +- hosts: localhost + connection: local + name: "Executes install, enrollment, and testing in one playbook" + sudo: yes + gather_facts: yes + pre_tasks: + - name: "Collect process list if running in a CI System" command: ps aux - when: ci_testing_zuul is defined - - name: "Collect list of listening network sockets if running in OpenStack CI" + when: ci_testing is defined + - name: "Collect list of listening network sockets if running in a CI system" shell: netstat -apn|grep LISTEN - when: ci_testing_zuul is defined + when: ci_testing is defined roles: - role: bifrost-create-vm-nodes - role: ironic-install diff --git a/playbooks/test-bifrost.yaml b/playbooks/test-bifrost.yaml index b2e07ccee..de02af614 100644 --- a/playbooks/test-bifrost.yaml +++ b/playbooks/test-bifrost.yaml @@ -9,10 +9,13 @@ set_fact: baremetal_csv_file: "/tmp/baremetal.csv" when: baremetal_csv_file is not defined - - name: "Set ci_testing_zuul if it appears we are running in upstream OpenStack CI" + - name: "Set OpenStack CI settings if it appears we are running in upstream OpenStack CI" set_fact: ci_testing: true ci_testing_zuul: true + ironic_git_folder: /opt/git/openstack/ironic + ironicclient_git_folder: /opt/git/openstack/python-ironicclient + shade_git_folder: /opt/git/openstack-infra/shade when: lookup('env', 'ZUUL_BRANCH') != "" - name: "Set ci_testing_zuul_changes if ZUUL_CHANGES is set" set_fact: @@ -26,6 +29,8 @@ when: ci_testing_zuul is defined roles: - role: bifrost-create-vm-nodes + - { role: bifrost-prep-for-install, when: skip_install is not defined } + - { role: bifrost-openstack-ci-prep, when: ci_testing_zuul is defined } - role: ironic-install cleaning: false testing: true