diff --git a/ansible/test-image-centos-cloud.yml b/ansible/test-image-centos-cloud.yml index 8ad51a645..aefb6cc02 100644 --- a/ansible/test-image-centos-cloud.yml +++ b/ansible/test-image-centos-cloud.yml @@ -8,7 +8,6 @@ project_name: "{{ lookup('env', 'OS_PROJECT_NAME') }}" project_domain_name: "{{ lookup('env', 'OS_PROJECT_DOMAIN_NAME') }}" user_domain_name: "{{ lookup('env', 'OS_USER_DOMAIN_NAME') }}" - image_download_dir: "{{ ansible_user_dir }}/images" tasks: - name: Ensure OpenStack shade module is installed pip: @@ -17,13 +16,13 @@ - name: Ensure image download directory exists file: - path: "{{ image_download_dir }}" + path: "{{ image_cache_path }}" state: directory - name: Ensure CentOS 7 cloud image is downloaded get_url: url: http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2 - dest: "{{ image_download_dir }}/CentOS-7-x86_64-GenericCloud.qcow2" + dest: "{{ image_cache_path }}/CentOS-7-x86_64-GenericCloud.qcow2" - name: Ensure test deployment image is registered with Glance os_image: @@ -32,4 +31,4 @@ container_format: bare disk_format: qcow2 state: present - filename: "{{ image_download_dir }}/CentOS-7-x86_64-GenericCloud.qcow2" + filename: "{{ image_cache_path }}/CentOS-7-x86_64-GenericCloud.qcow2" diff --git a/ansible/test-image.yml b/ansible/test-image.yml index 27e3f2fa3..bcd973894 100644 --- a/ansible/test-image.yml +++ b/ansible/test-image.yml @@ -1,6 +1,6 @@ --- - name: Ensure user images are built and registered with Glance - hosts: seed[0] + hosts: seed vars: openstack_auth: auth_url: "{{ lookup('env', 'OS_AUTH_URL') }}" @@ -14,6 +14,7 @@ image_os_element: centos7 image_base_elements: - dhcp-all-interfaces + - enable-serial-console image_is_whole_disk: True image_whole_disk_elements: - vm @@ -22,6 +23,7 @@ - grub2 image_extra_elements: [] image_elements: "{{ image_base_elements + (image_whole_disk_elements if image_is_whole_disk|bool else image_partition_elements) + image_extra_elements }}" + shade_venv: "{{ ansible_env['PWD'] }}/shade-venv" tasks: - name: Ensure diskimage-builder package is installed yum: @@ -29,10 +31,16 @@ state: installed become: True + - name: Ensure pip is installed + pip: + name: pip + state: latest + virtualenv: "{{ shade_venv }}" + - name: Ensure OpenStack shade module is installed pip: name: shade - become: True + virtualenv: "{{ shade_venv }}" - name: Ensure image build directory exists file: @@ -53,6 +61,12 @@ chdir: "{{ image_build_dir }}" creates: "{{ image_build_dir }}/{{ image_name }}.qcow2" + # Note that setting this via a play or task variable seems to not + # evaluate the Jinja variable reference, so we use set_fact. + - name: Update the Ansible python interpreter fact to point to the shade virtualenv + set_fact: + ansible_python_interpreter: "{{ shade_venv }}/bin/python" + - name: Ensure test deployment ramdisk and kernel images are registered with Glance os_image: auth: "{{ openstack_auth }}" diff --git a/ansible/test-infra.yml b/ansible/test-infra.yml index 89498b2fd..cb543c47f 100644 --- a/ansible/test-infra.yml +++ b/ansible/test-infra.yml @@ -1,5 +1,5 @@ --- -- hosts: seed[0] +- hosts: seed vars: openstack_auth: auth_url: "{{ lookup('env', 'OS_AUTH_URL') }}" @@ -8,24 +8,42 @@ project_name: "{{ lookup('env', 'OS_PROJECT_NAME') }}" project_domain_name: "{{ lookup('env', 'OS_PROJECT_DOMAIN_NAME') }}" user_domain_name: "{{ lookup('env', 'OS_USER_DOMAIN_NAME') }}" - image_download_dir: "{{ ansible_user_dir }}/images" + shade_venv: "{{ ansible_env['PWD'] }}/shade-venv" + test_image_cache_path: "{{ ansible_env['PWD'] }}/images" tasks: + - name: Ensure pip is installed + pip: + name: pip + state: latest + virtualenv: "{{ shade_venv }}" + - name: Ensure OpenStack shade module is installed pip: name: shade - become: True + virtualenv: "{{ shade_venv }}" - name: Ensure image download directory exists file: - path: "{{ image_download_dir }}" + path: "{{ test_image_cache_path }}" state: directory + - name: Ensure unzip package is installed + yum: + name: unzip + state: installed + - name: Ensure Ironic CoreOS IPA deploy images are downloaded unarchive: src: http://tarballs.openstack.org/ironic-python-agent/coreos/ipa-coreos-stable-newton.tar.gz - dest: "{{ image_download_dir }}" + dest: "{{ test_image_cache_path }}" remote_src: yes + # Note that setting this via a play or task variable seems to not + # evaluate the Jinja variable reference, so we use set_fact. + - name: Update the Ansible python interpreter fact to point to the shade virtualenv + set_fact: + ansible_python_interpreter: "{{ shade_venv }}/bin/python" + - name: Ensure Ironic CoreOS IPA deploy images are registered with Glance os_image: auth: "{{ openstack_auth }}" @@ -33,7 +51,7 @@ container_format: "{{ item.format }}" disk_format: "{{ item.format }}" state: present - filename: "{{ image_download_dir }}/imagebuild/coreos/UPLOAD/{{ item.filename }}" + filename: "{{ test_image_cache_path }}/imagebuild/coreos/UPLOAD/{{ item.filename }}" with_items: - { name: ipa.initrd, filename: coreos_production_pxe_image-oem-stable-newton.cpio.gz, format: ari } - { name: ipa.vmlinuz, filename: coreos_production_pxe-stable-newton.vmlinuz, format: aki } @@ -52,7 +70,8 @@ auth: "{{ openstack_auth }}" name: provision-subnet network_name: provision-net - cidr: "{{ provision_net_cidr }}" - allocation_pool_start: "{{ provision_net_allocation_pool_start | default(omit) }}" - allocation_pool_end: "{{ provision_net_allocation_pool_end | default(omit) }}" + cidr: "{{ provision_wl_net_name | net_cidr }}" + gateway_ip: "{{ provision_wl_net_name | net_gateway | default(omit) }}" + allocation_pool_start: "{{ provision_wl_net_name | net_allocation_pool_start | default(omit) }}" + allocation_pool_end: "{{ provision_wl_net_name | net_allocation_pool_end | default(omit) }}" state: present diff --git a/ansible/test-keypair.yml b/ansible/test-keypair.yml index ee001cb6b..6455b3d7b 100644 --- a/ansible/test-keypair.yml +++ b/ansible/test-keypair.yml @@ -1,6 +1,6 @@ --- - name: Ensure user SSH keypair is registered with Nova - hosts: seed[0] + hosts: seed vars: openstack_auth: auth_url: "{{ lookup('env', 'OS_AUTH_URL') }}" @@ -9,16 +9,29 @@ project_name: "{{ lookup('env', 'OS_PROJECT_NAME') }}" project_domain_name: "{{ lookup('env', 'OS_PROJECT_DOMAIN_NAME') }}" user_domain_name: "{{ lookup('env', 'OS_USER_DOMAIN_NAME') }}" - public_key_file: "{{ ansible_user_dir }}/.ssh/id_rsa.pub" + public_key_path: "{{ ssh_public_key_path }}" + shade_venv: "{{ ansible_env['PWD'] }}/shade-venv" tasks: + - name: Ensure pip is installed + pip: + name: pip + state: latest + virtualenv: "{{ shade_venv }}" + - name: Ensure OpenStack shade module is installed pip: name: shade - become: True + virtualenv: "{{ shade_venv }}" + + # Note that setting this via a play or task variable seems to not + # evaluate the Jinja variable reference, so we use set_fact. + - name: Update the Ansible python interpreter fact to point to the shade virtualenv + set_fact: + ansible_python_interpreter: "{{ shade_venv }}/bin/python" - name: Ensure a test SSH key pair is registered with Nova os_keypair: auth: "{{ openstack_auth }}" name: test - public_key_file: "{{ public_key_file }}" + public_key: "{{ lookup('file', public_key_path) }}" state: present