bifrost/playbooks/test-bifrost-create-vm.yaml
Pavlo Shchelokovskyy 3aaed64e88 Use JSON baremetal data in testing
To move bifrost testing to *_ipmitool drivers + virtualbmc, we need
the baremetal data file to support ipmi port setting, as in the case of
virtualbmc, all test VM nodes use the same local IPMI address with
different port per-node.

Unfortunately, the CSV baremetal inventory format that is used in our
testing procedures does not support setting IPMI ports.

As the CSV format is considered a legacy format, let's move testing to use
JSON-formatted baremetal data instead of fixing the legacy format parser.

Changes are mostly to 'bifrost-create-vm-nodes' role and it's callers.
Some level of backward compatibility is provided:
- baremetal_csv_file var is still accepted, and its value is used as
  path to write data, although the data will nevertheless be in JSON format.

An extra helper script is added to reduce the number of nodes in
inventory when testing DHCP.
Also the script in 'bifrost-test-dhcp' role is changed to support
loading data from JSON.

This change officially deprecates using CSV formatted baremetal inventory
files.
Handling CSV baremetal inventory files will be removed in the Queens
release.

Change-Id: If2dcf43857195611ef342fe602330878378b021b
Partial-Bug: #1659876
2017-03-06 17:06:30 +02:00

40 lines
1.5 KiB
YAML

# Create a default VM
---
- hosts: localhost
connection: local
name: "Executes install, enrollment, and testing in one playbook"
become: yes
gather_facts: yes
pre_tasks:
- name: "Warn if baremetal_csv_file is defined"
debug:
msg: >
"WARNING - 'baremetal_csv_file' variable is defined.
Its use is deprecated. The file created will be in JSON format.
Use 'baremetal_json_file' variable instead."
when: baremetal_csv_file is defined
- name: "Re-set baremetal json to csv file if defined"
set_fact:
baremetal_json_file: "{{ baremetal_csv_file }}"
when: baremetal_csv_file is defined
- name: "Set default baremetal.json file if not already defined"
set_fact:
baremetal_json_file: "/tmp/baremetal.json"
when: baremetal_json_file is not defined
- name: "Set ci_testing flag if a list of changes are found in the environment variables"
set_fact:
ci_testing: true
when: lookup('env', 'ZUUL_CHANGES') | length > 0
- 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: "Collect process list if running in OpenStack CI"
command: ps aux
when: ci_testing_zuul is defined
- name: "Collect list of listening network sockets if running in OpenStack CI"
shell: netstat -apn|grep LISTEN
when: ci_testing_zuul is defined
roles:
- role: bifrost-create-vm-nodes