From 20863aa73400c8543a346537cca6e09dcd53f959 Mon Sep 17 00:00:00 2001 From: Dmitry Tantsur Date: Thu, 17 Sep 2020 12:41:39 +0200 Subject: [PATCH] Cleanup test-bifrost.yaml Remove variables that can be calculated, move global variables like testing to the top level. Remove collecting information that should rather be collected by CI jobs themselves. Change-Id: Ib73a09529c8ad1640db4542d68ea3f76d6c7ea24 --- .../defaults/main.yml | 4 +++- .../defaults/main.yml | 4 +++- playbooks/test-bifrost-create-vm.yaml | 9 +------ playbooks/test-bifrost.yaml | 24 ++++--------------- 4 files changed, 12 insertions(+), 29 deletions(-) diff --git a/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml b/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml index 1d3c13260..9e5e97322 100644 --- a/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml +++ b/playbooks/roles/bifrost-configdrives-dynamic/defaults/main.yml @@ -12,10 +12,12 @@ ssh_public_key_path: "{{ lookup('env', 'HOME') }}/.ssh/id_rsa.pub" # TODO(TheJulia): Remove this default. node_default_network_interface: eth0 +testing: false + # Basic networking defaults # TODO(TheJulia): Require these to be supplied some other way. ipv4_subnet_mask: 255.255.255.0 -ipv4_gateway: 192.168.1.1 +ipv4_gateway: "{{ '192.168.122.1' if testing | bool else '192.168.1.1' }}" ipv4_nameserver: 8.8.8.8 network_mtu: 1500 diff --git a/playbooks/roles/bifrost-prepare-for-test-dynamic/defaults/main.yml b/playbooks/roles/bifrost-prepare-for-test-dynamic/defaults/main.yml index 3b827daad..6fc9d27cb 100644 --- a/playbooks/roles/bifrost-prepare-for-test-dynamic/defaults/main.yml +++ b/playbooks/roles/bifrost-prepare-for-test-dynamic/defaults/main.yml @@ -1,7 +1,9 @@ --- node_ssh_pause: 10 wait_timeout: 900 -multinode_testing: false + +inventory_dhcp: false +multinode_testing: "{{ inventory_dhcp | bool }}" # Ensure that Ansible is using python interpreter and dependencies inside the bifrost virtual environment bifrost_venv_dir: "{{ lookup('env', 'VENV') or '/opt/stack/bifrost' }}" diff --git a/playbooks/test-bifrost-create-vm.yaml b/playbooks/test-bifrost-create-vm.yaml index aa9fe050b..f525fadda 100644 --- a/playbooks/test-bifrost-create-vm.yaml +++ b/playbooks/test-bifrost-create-vm.yaml @@ -10,17 +10,10 @@ set_fact: baremetal_json_file: "/tmp/baremetal.json" when: baremetal_json_file is not defined - - name: "Set ci_testing flag if running in the CI" + - name: "Set variables if running in the CI" set_fact: - ci_testing: true copy_from_local_path: true git_url_root: "{{ lookup('env', 'WORKSPACE') }}" when: lookup('env', 'ZUUL_BRANCH') | length > 0 - - name: "Collect process list if running in OpenStack CI" - command: ps aux - when: ci_testing | default(false)| bool - - name: "Collect list of listening network sockets if running in OpenStack CI" - shell: netstat -apn|grep LISTEN # noqa 306 - when: ci_testing | default(false)| bool roles: - role: bifrost-create-vm-nodes diff --git a/playbooks/test-bifrost.yaml b/playbooks/test-bifrost.yaml index 8b03ed890..8bc670fea 100644 --- a/playbooks/test-bifrost.yaml +++ b/playbooks/test-bifrost.yaml @@ -12,15 +12,15 @@ become: no gather_facts: yes pre_tasks: - - name: "Set ci_testing and other variables if it appears we are running in upstream OpenStack CI" + - name: "Set testing to true" set_fact: - ci_testing: true + testing: true + - name: "Set variables if running in the CI" + set_fact: + cirros_deploy_image_upstream_url: file:///opt/cache/files/cirros-0.5.1-x86_64-disk.img copy_from_local_path: true git_url_root: "{{ lookup('env', 'WORKSPACE') }}" when: lookup('env', 'ZUUL_BRANCH') | length > 0 - - name: "Override the ipv4_gateway setting" - set_fact: - ipv4_gateway: "192.168.122.1" roles: - role: bifrost-prep-for-install when: not (skip_install | default(false) | bool) @@ -33,21 +33,9 @@ name: "Executes install, enrollment, and testing in one playbook" become: yes gather_facts: yes - pre_tasks: - - name: "Collect process list if running in a CI System" - command: ps aux - when: ci_testing | default(false)| bool - - name: "Collect list of listening network sockets if running in a CI system" - shell: netstat -apn|grep LISTEN # noqa 306 - when: ci_testing | default(false)| bool - - name: "Use a cached cirros image" - set_fact: - cirros_deploy_image_upstream_url: file:///opt/cache/files/cirros-0.5.1-x86_64-disk.img - when: ci_testing | default(false)| bool roles: - role: bifrost-keystone-install - role: bifrost-ironic-install - 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. @@ -109,8 +97,6 @@ - hosts: baremetal name: "Create configuration drive files and deploy machines" - vars: - multinode_testing: "{{ inventory_dhcp | bool }}" become: no connection: local roles: