Add steps needed when using OVB with a testenv broker

This continues the work to merge the OVB playbook in tripleo-ci with
the OVB playbook here. This should again be a no-op change, with the
only new behavior turned on by setting use_testenv_broker=true.

This change completes the differences between the two playbooks before
the undercloud is installed. There are also slight differences in what
we do after the undercloud is installed in the
baremetal-quickstart-extras playbook. Those will be addressed in the
final patch of this series.

Change-Id: Id24b8c4866f46dcb37a98b682f54101a341f9adb
This commit is contained in:
John Trowbridge 2017-10-17 15:05:25 -04:00
parent d77ea8c6d8
commit 550be2b780
3 changed files with 79 additions and 14 deletions

View File

@ -3,7 +3,8 @@
hosts: undercloud hosts: undercloud
gather_facts: yes gather_facts: yes
roles: roles:
- validate-ipmi - { role: validate-ipmi,
when: not use_testenv_broker|default(false)|bool }
- name: Deploy the undercloud - name: Deploy the undercloud
hosts: undercloud hosts: undercloud

View File

@ -1,5 +1,9 @@
--- ---
- include: ovb-create-stack.yml - include: ovb-create-stack.yml
when: not use_testenv_broker|default(false)|bool
- include: prepare-slave.yml
when: use_testenv_broker|default(false)|bool
- name: Setup the undercloud - name: Setup the undercloud
hosts: undercloud hosts: undercloud
@ -8,32 +12,50 @@
ansible_user: root ansible_user: root
roles: roles:
- undercloud-setup - undercloud-setup
tasks:
- name: Add eth2 interface from eth2.conf
command: os-net-config -c {{ working_dir }}/eth2.conf -v
when:
- network_isolation|bool
- use_testenv_broker|default(false)|bool
# Small playbook with logic for when to build images or not. # Small playbook with logic for when to build images or not.
# The logic there can be completely overridden by setting the # The logic there can be completely overridden by setting the
# to_build variable. # to_build variable.
- include: to-build-or-not-to-build.yml - include: to-build-or-not-to-build.yml
- name: Inventory the undercloud instance - name: Inventory the undercloud instance
hosts: localhost hosts: localhost
gather_facts: yes gather_facts: yes
roles: roles:
- tripleo-inventory - tripleo-inventory
- name: Fetch the overcloud images - name: Run DLRN gate role and install repo
hosts: undercloud
vars:
artg_compressed_gating_repo: "${HOME}/gating_repo.tar.gz"
artg_repos_dir: "{{ repo_clone_dir|default('/opt/stack/new') }}"
ib_create_web_repo: "{{ to_build|bool }}"
roles:
- { role: build-test-packages, when: build_test_packages|default(false)|bool }
- { role: install-built-repo, when: compressed_gating_repo is defined }
tags:
- build
- name: Get images for quickstart
hosts: undercloud hosts: undercloud
gather_facts: no gather_facts: no
vars:
ib_repo_image_inject: "{{ not to_build|bool }}"
ib_repo_run_live: false
modify_image_vc_ram: 4096
modify_image_vc_cpu: 4
modify_image_vc_verbose: true
roles: roles:
- fetch-images - { role: fetch-images, when: not to_build|bool }
- { role: repo-setup, repo_inject_image_path: "$HOME/overcloud-full.qcow2", repo_run_live: false, when: not to_build|bool }
- name: Build test packages using DLRN - { role: repo-setup, repo_inject_image_path: "$HOME/ironic-python-agent.initramfs", repo_run_live: false, initramfs_image: true, when: not to_build|bool }
hosts: undercloud - { role: install-built-repo, ib_repo_image_path: "$HOME/overcloud-full.qcow2", when: compressed_gating_repo is defined and not to_build|bool }
roles: - { role: install-built-repo, ib_repo_image_path: "$HOME/ironic-python-agent.initramfs", initramfs_image: true, when: compressed_gating_repo is defined and not to_build|bool }
- {role: build-test-packages, when: build_test_packages|default(false)|bool }
- name: Install the built package on the undercloud
hosts: undercloud
gather_facts: no
roles:
- {role: install-built-repo, when: build_test_packages|default(false)|bool }

View File

@ -0,0 +1,42 @@
# Playbook included in OVB setups that use a testenv broker to create the
# OVB stack.
- name: Local setup for quickstart
hosts: localhost
connection: local
tasks:
- name: Host setup
shell: >
echo "127.0.0.1 $(hostname) $(hostname).openstacklocal" | sudo tee -a /etc/hosts;
echo "127.0.0.2 undercloud undercloud.openstacklocal" | sudo tee -a /etc/hosts;
if [ ! -e ${HOME}/.ssh/id_rsa.pub ] ; then
if [[ -e ${HOME}/.ssh/id_rsa ]]; then
ssh-keygen -y -f ${HOME}/.ssh/id_rsa > ${HOME}/.ssh/id_rsa.pub;
else
ssh-keygen -N "" -f ${HOME}/.ssh/id_rsa;
fi
fi;
sudo mkdir -p /root/.ssh;
cat ~/.ssh/id_rsa.pub | sudo tee -a /root/.ssh/authorized_keys | tee -a ~/.ssh/authorized_keys;
sudo yum remove -y puppet hiera puppetlabs-release rdo-release centos-release-[a-z]*;
sudo rm -rf /etc/puppet /etc/hiera.yaml;
sudo cp {{tripleo_root}}/tripleo-ci/test-environments/overcloud-cacert.pem /etc/pki/ca-trust/source/anchors/;
sudo update-ca-trust extract;
cp -f {{ lookup('env', 'TE_DATAFILE') }} ~/instackenv.json;
- name: Create eth2.conf file
blockinfile:
dest: "{{ working_dir }}/eth2.conf"
content: |
network_config:
- type: interface
name: eth2
use_dhcp: false
addresses:
- ip_netmask: 10.0.0.1/24
- ip_netmask: 2001:db8:fd00:1000::1/64
create: yes
- name: Install ipmitool if not installed
yum: name=ipmitool state=latest
become: true