diff --git a/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml b/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml index 0c9878410..889d8d341 100644 --- a/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml +++ b/playbooks/roles/bifrost-create-vm-nodes/tasks/main.yml @@ -32,11 +32,13 @@ apt: update_cache: yes when: ansible_os_family == "Debian" + - name: "Load distribution defaults" include_vars: "{{ item }}" with_first_found: - "../defaults/required_defaults_{{ ansible_distribution }}.yml" - "../defaults/required_defaults_{{ ansible_os_family }}.yml" + - name: "Include OS version-specific defaults" include_vars: "{{ item }}" with_first_found: @@ -45,26 +47,33 @@ # NOTE(cinerama): On Fedora 22, ansible 1.9, ansible_pkg_mgr # defaults to yum, which may not be installed. This can be safely # removed when we start using an ansible release which prefers dnf. + - name: "Check for dnf" stat: path: "/usr/bin/dnf" register: test_dnf + - name: "Adjust ansible_pkg_mgr if dnf exists" set_fact: ansible_pkg_mgr: "dnf" when: ansible_distribution == 'Fedora' and "{{ test_dnf.stat.exists|bool }}" + - name: "Install required packages" action: "{{ ansible_pkg_mgr }} name={{ item }} state=present" with_items: required_packages + - name: "Restart libvirt service" service: name="{{libvirt_service_name}}" state=restarted + - name: "Verify default network is running" shell: virsh net-info default |grep Active|grep -q yes register: virsh_network_status ignore_errors: yes + - name: "Start default network if not running" command: virsh net-start default when: virsh_network_status.rc != 0 + - name: "Create virtual machines" script: create_vm_nodes-for-role.sh environment: @@ -75,19 +84,23 @@ register: task_create_vm_nodes ignore_errors: yes delegate_to: localhost + - name: "Execute `dmesg` to collect debugging output should VM creation fail." command: dmesg when: task_create_vm_nodes.rc != 0 + - name: > "Execute `virsh capabilities` to collect debugging output should VM creation fail." command: virsh capabilities when: task_create_vm_nodes.rc != 0 + - name: "Abort due to failed VM creation" fail: > msg="VM creation step failed, please review dmesg output for additional details" when: task_create_vm_nodes.rc != 0 + - name: > "Set file permissions such that the baremetal csv file at /tmp/baremetal.csv can be read by the user executing Ansible" diff --git a/playbooks/roles/bifrost-openstack-ci-prep/tasks/main.yml b/playbooks/roles/bifrost-openstack-ci-prep/tasks/main.yml index a7aca81d7..ca7fd5ef9 100644 --- a/playbooks/roles/bifrost-openstack-ci-prep/tasks/main.yml +++ b/playbooks/roles/bifrost-openstack-ci-prep/tasks/main.yml @@ -21,15 +21,18 @@ 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 |bool == false + - name: > "Create an empty SSH known_hosts file for Jenkins user if operating in OpenStack CI" diff --git a/playbooks/roles/bifrost-prep-for-install/tasks/git.yml b/playbooks/roles/bifrost-prep-for-install/tasks/git.yml index f6182e637..16abd6fa3 100644 --- a/playbooks/roles/bifrost-prep-for-install/tasks/git.yml +++ b/playbooks/roles/bifrost-prep-for-install/tasks/git.yml @@ -15,9 +15,12 @@ --- - name: "Clone repository" command: git clone {{ git_url }} {{ git_folder }} chdir={{ git_root }} creates={{ git_folder }} + - name: "Check out branch" command: git checkout -f {{ git_branch }} chdir={{ git_folder }} + - name: "Reset local repository" command: git reset --hard {{ git_branch }} chdir={{ git_folder }} + - name: "Resync local repository" command: git pull --ff-only chdir={{ git_folder }} diff --git a/playbooks/roles/bifrost-prep-for-install/tasks/local_path.yaml b/playbooks/roles/bifrost-prep-for-install/tasks/local_path.yaml index 76d93414a..fdc1dc60a 100644 --- a/playbooks/roles/bifrost-prep-for-install/tasks/local_path.yaml +++ b/playbooks/roles/bifrost-prep-for-install/tasks/local_path.yaml @@ -15,13 +15,18 @@ --- - name: "ironic - Copy into place" command: cp -a {{ ironic_git_url }} {{ ironic_git_folder }} chdir={{ git_root }} creates={{ ironic_git_folder }} + - name: "python-ironicclient - Copy into place" command: cp -a {{ ironicclient_git_url }} {{ ironicclient_git_folder }} chdir={{ git_root }} creates={{ ironicclient_git_folder }} + - name: "Shade - Copy into place" command: cp -a {{ shade_git_url }} {{ shade_git_folder }} chdir={{ git_root }} creates={{ shade_git_folder }} + - name: "Disk Image Builder - Copy into place" command: cp -a {{ dib_git_url }} {{ dib_git_folder }} chdir={{ git_root }} creates={{ dib_git_folder }} + - name: "ironic-inspector - Copy into place" command: cp -a {{ ironicinspector_git_url }} {{ ironicinspector_git_folder }} chdir={{ git_root }} creates={{ ironicinspector_git_folder }} + - name: "python-ironic-inspector-client - Copy into place" command: cp -a {{ ironicinspectorclient_git_url }} {{ ironicinspectorclient_git_folder }} chdir={{ git_root }} creates={{ ironicinspectorclient_git_folder }} diff --git a/playbooks/roles/bifrost-prep-for-install/tasks/main.yml b/playbooks/roles/bifrost-prep-for-install/tasks/main.yml index 5b857e55f..2dba6d73e 100644 --- a/playbooks/roles/bifrost-prep-for-install/tasks/main.yml +++ b/playbooks/roles/bifrost-prep-for-install/tasks/main.yml @@ -16,6 +16,7 @@ - name: "Download via GIT" include: git_download.yaml when: ci_testing_zuul | bool == false and copy_from_local_path | bool == false + - name: "Copy from local path" include: local_path.yaml when: ci_testing_zuul | bool == true or copy_from_local_path | bool == true diff --git a/playbooks/test-bifrost.yaml b/playbooks/test-bifrost.yaml index ea5198eb4..a7b52b2f1 100644 --- a/playbooks/test-bifrost.yaml +++ b/playbooks/test-bifrost.yaml @@ -18,6 +18,7 @@ # install and initial deploy. - name: Remove pre-existing leases file file: path=/var/lib/misc/dnsmasq.leases state=absent + - hosts: localhost connection: local name: "Executes install, enrollment, and testing in one playbook" @@ -51,6 +52,7 @@ 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" @@ -75,6 +77,7 @@ environment: http_proxy: "{{ lookup('env','http_proxy') }}" https_proxy: "{{ lookup('env','https_proxy') }}" + - hosts: baremetal name: "Enroll node with Ironic" become: no @@ -82,6 +85,7 @@ roles: - role: ironic-enroll-dynamic - { role: ironic-inspect-node, when: inspect_nodes | default('false') | bool == true } + - hosts: baremetal vars: multinode_testing: "{{ inventory_dhcp | bool == true }}" @@ -93,6 +97,7 @@ - role: bifrost-deploy-nodes-dynamic - role: bifrost-prepare-for-test-dynamic serial: 1 + # The testvm Host group is added by bifrost-prepare-for-test based # on the contents of the CSV file. - hosts: test @@ -105,6 +110,7 @@ max_fail_percentage: 0 roles: - role: bifrost-test-vm + - hosts: baremetal connection: local name: "Unprovisions the test node" @@ -113,6 +119,7 @@ roles: - role: bifrost-unprovision-node-dynamic - role: ironic-delete-dynamic + # The following tasks are intended to test DHCP functionality - hosts: localhost connection: local @@ -132,6 +139,7 @@ pause: seconds: 30 when: inventory_dhcp | bool == true + - hosts: localhost connection: local name: "Executes DHCP test script"