bifrost/playbooks/test-bifrost-dynamic.yaml
Julia Kreger 15e1c3f22e Ansible 2.0 compatibility
These changes allow the various playbooks to be executed by
Ansible 1.9.x and 2.0. This was necessary as 2.0 has a number
of changes to the YAML processor, and certain ways of doing
things have naturally had to change.

- Removed pass-through variable when a role is explicitly defined
  with variables passed through to it as updated yaml parser fails
  to handle appropriately.
- Defined a default dib_packages variable of an empty string.
- Changed stray boolean compare to use an is defined check as
  the the parser in Ansible 2.0 does not equate undefined to
  false.
- Explicitly defined the testing_user for the syntax check
  as the check fails without it.
- Revised MySQL module syntax usage to be compatible between
  Ansible 1.9.x and 2.0 development branches.
- Updated some conditionals making string compares with lookups
  which is apparently problematic in Ansible 2.0.

Depends-On: I9d5fa719793896cce00a69dafba738755b45b068
Depends-On: I23e902c8637e142fba23d71467225d48ee265253
Change-Id: I4fec7f44dd9d591388f345b3f449cb44b8e50744
Closes-Bug: 1469862
2015-10-02 12:58:11 +00:00

96 lines
4.0 KiB
YAML

# Example command line to use:
# Create a VM:
# ansible-playbook -vvvv -i inventory/localhost test-bifrost-create-vm.yaml
# Set BIFROST_INVENTORY_SOURCE
# export BIFROST_INVENTORY_SOURCE=/tmp/baremetal.csv
# Execute the installation and VM startup test.
# ansible-playbook -vvvv -i inventory/bifrost_inventory.py test-bifrost-dynamic.yaml -e use_cirros=true -e testing_user=cirros
---
- hosts: localhost
connection: local
name: "Executes install, enrollment, and testing in one playbook"
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: "{{ lookup('env', 'WORKSPACE') }}/openstack/ironic"
ironicclient_git_url: "{{ lookup('env', 'WORKSPACE') }}/openstack/python-ironicclient"
shade_git_url: "{{ lookup('env', 'WORKSPACE') }}/openstack-infra/shade"
dib_git_url: "/opt/git/openstack/diskimage-builder"
# TODO(TheJulia) Fix the above paths to be consistent, because the NV job gets the dib
# folder cloned, while the gate job does not. Likely need to work out a semi-hybrid
# solution.
when: lookup('env', 'ZUUL_BRANCH') | length > 0
- name: "Set ci_testing_zuul_changes if ZUUL_CHANGES is set"
set_fact:
ci_testing_zuul_changes: true
when: lookup('env', 'ZUUL_CHANGES') | length > 0
- name: "Override the ipv4_gateway setting"
set_fact:
ipv4_gateway: "192.168.122.1"
roles:
- { role: bifrost-prep-for-install, when: skip_install is not defined }
- { role: bifrost-openstack-ci-prep, when: ci_testing_zuul is defined }
environment:
http_proxy: "{{ lookup('env','http_proxy') }}"
https_proxy: "{{ lookup('env','https_proxy') }}"
- 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 is defined
- name: "Collect list of listening network sockets if running in a CI system"
shell: netstat -apn|grep LISTEN
when: ci_testing is defined
roles:
- role: bifrost-create-vm-nodes
- role: bifrost-ironic-install
cleaning: false
testing: true
# NOTE(TheJulia): While the next step creates a ramdisk, some elements
# do not support ramdisk-image-create as they invoke steps to cleanup
# the ramdisk which causes ramdisk-image-create to believe it failed.
- { role: bifrost-create-dib-image, dib_imagename: "{{ http_boot_folder }}/ipa", build_ramdisk: false, dib_os_element: "{{ ipa_dib_os_element|default('debian') }}", dib_elements: "ironic-agent {{ ipa_extra_dib_elements | default('') }}", when: create_ipa_image | bool == true }
- { role: bifrost-create-dib-image, dib_imagetype: "qcow2", dib_imagename: "{{deploy_image}}", dib_os_element: "debian", dib_elements: "vm serial-console simple-init {{ extra_dib_elements|default('') }}", when: create_image_via_dib == true and transform_boot_image == false }
environment:
http_proxy: "{{ lookup('env','http_proxy') }}"
https_proxy: "{{ lookup('env','https_proxy') }}"
- hosts: baremetal
name: "Enroll node with Ironic"
sudo: no
connection: local
roles:
- role: ironic-enroll-dynamic
- hosts: baremetal
name: "Creat configuration drive files and deploy machines."
sudo: no
connection: local
roles:
- role: bifrost-configdrives-dynamic
- role: bifrost-deploy-nodes-dynamic
- role: bifrost-prepare-for-test-dynamic
# The testvm Host group is added by bifrost-prepare-for-test based
# on the contents of the CSV file.
- hosts: test
name: "Tests connectivity to the VM"
sudo: no
gather_facts: no
remote_user: "{{ testing_user }}"
roles:
- role: bifrost-test-vm
- hosts: baremetal
connection: local
name: "Unprovisions the test node"
sudo: no
gather_facts: no
roles:
- role: bifrost-unprovision-node-dynamic
- role: ironic-delete-dynamic