From 92aecc57bc3b99a459de1c792756279a56b7af0f Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Sat, 16 Jul 2016 20:47:20 +0100 Subject: [PATCH] Move UCA enable and repo URL var to role defaults In order to expose the var in role documentation and to allow the use of dynamically set facts to override the value in CI environments the variables are moved from the role vars to the role defaults. The test preparation implements an override of the URL for OpenStack-CI to make use of the local mirrors. Change-Id: Iffa32adb971f281e7e274209ee500b1756fbf0a1 --- defaults/main.yml | 7 +++++++ tests/test-install-neutron.yml | 15 +++++++++++++++ tests/test-install-nova.yml | 15 +++++++++++++++ vars/ubuntu-14.04.yml | 6 +++--- vars/ubuntu-16.04.yml | 4 +--- 5 files changed, 41 insertions(+), 6 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 65a2b8d0..296ac44d 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -303,10 +303,17 @@ nova_scheduler_program_name: nova-scheduler # If you want to regenerate the nova users SSH keys, on each run, set this var to True # Otherwise keys will be generated on the first run and not regenerated each run. nova_recreate_keys: False + +# Toggle the use of Ubuntu Cloud Archive +nova_uca_enable: True +# Ubuntu Cloud Archive mirror URL +uca_apt_repo_url: "http://ubuntu-cloud.archive.canonical.com/ubuntu" + # Nova Ceph rbd # Enble and define nova_libvirt_images_rbd_pool to use rbd as nova backend #nova_libvirt_images_rbd_pool: vms nova_ceph_client: '{{ cinder_ceph_client }}' +# TODO(odyssey4me) - the uuid should be removed, there should be no defaults for secrets nova_ceph_client_uuid: 517a4663-3927-44bc-9ea7-4a90e1cd4c66 ## General Nova configuration diff --git a/tests/test-install-neutron.yml b/tests/test-install-neutron.yml index 27b8330a..8750f74d 100644 --- a/tests/test-install-neutron.yml +++ b/tests/test-install-neutron.yml @@ -97,6 +97,21 @@ - "%" delegate_to: "10.100.102.101" when: inventory_hostname == groups['neutron_all'][0] + - name: Check if this is an OpenStack-CI nodepool instance + stat: + path: /etc/nodepool/provider + register: nodepool + delegate_to: localhost + - name: Determine the existing Ubuntu repo URL (only on OpenStack-CI) + shell: 'awk "/^deb .*ubuntu\/? {{ ansible_distribution_release }} main/ {print \$2; exit}" /etc/apt/sources.list' + register: ubuntu_repo_url + changed_when: false + when: nodepool.stat.exists | bool + delegate_to: localhost + - name: Set Ubuntu Cloud Archive repo URL based on discovered information + set_fact: + uca_apt_repo_url: "{{ ubuntu_repo_url.stdout | netorigin }}/ubuntu-cloud-archive" + when: nodepool.stat.exists | bool roles: - role: "os_neutron" vars_files: diff --git a/tests/test-install-nova.yml b/tests/test-install-nova.yml index 18ef38b0..76e97999 100644 --- a/tests/test-install-nova.yml +++ b/tests/test-install-nova.yml @@ -93,6 +93,21 @@ - "localhost" - "%" when: inventory_hostname == groups['nova_all'][0] + - name: Check if this is an OpenStack-CI nodepool instance + stat: + path: /etc/nodepool/provider + register: nodepool + delegate_to: localhost + - name: Determine the existing Ubuntu repo URL (only on OpenStack-CI) + shell: 'awk "/^deb .*ubuntu\/? {{ ansible_distribution_release }} main/ {print \$2; exit}" /etc/apt/sources.list' + register: ubuntu_repo_url + changed_when: false + when: nodepool.stat.exists | bool + delegate_to: localhost + - name: Set Ubuntu Cloud Archive repo URL based on discovered information + set_fact: + uca_apt_repo_url: "{{ ubuntu_repo_url.stdout | netorigin }}/ubuntu-cloud-archive" + when: nodepool.stat.exists | bool roles: - role: "{{ rolename | basename }}" vars_files: diff --git a/vars/ubuntu-14.04.yml b/vars/ubuntu-14.04.yml index 8c5ee412..2016946c 100644 --- a/vars/ubuntu-14.04.yml +++ b/vars/ubuntu-14.04.yml @@ -53,11 +53,11 @@ nova_compute_kvm_packages: - multipath-tools # Ubuntu Cloud Archive variables -nova_uca_enable: True +# There are no UCA packages for Trusty beyond Mitaka, so the selected +# release here has to remain at Mitaka. uca_openstack_release: mitaka -uca_repo_url: "http://ubuntu-cloud.archive.canonical.com/ubuntu" uca_repo_dist: "{{ ansible_lsb.codename }}-updates/{{ uca_openstack_release }}" -uca_repo: "deb {{ uca_repo_url }} {{ uca_repo_dist }} main" +uca_repo: "deb {{ uca_apt_repo_url }} {{ uca_repo_dist }} main" # nova powervm virt driver nova_compute_powervm_packages: diff --git a/vars/ubuntu-16.04.yml b/vars/ubuntu-16.04.yml index bf5d47b5..e31edceb 100644 --- a/vars/ubuntu-16.04.yml +++ b/vars/ubuntu-16.04.yml @@ -53,11 +53,9 @@ nova_compute_kvm_packages: - multipath-tools # Ubuntu Cloud Archive variables -nova_uca_enable: True uca_openstack_release: newton -uca_repo_url: "http://ubuntu-cloud.archive.canonical.com/ubuntu" uca_repo_dist: "{{ ansible_lsb.codename }}-updates/{{ uca_openstack_release }}" -uca_repo: "deb {{ uca_repo_url }} {{ uca_repo_dist }} main" +uca_repo: "deb {{ uca_apt_repo_url }} {{ uca_repo_dist }} main" # nova powervm virt driver nova_compute_powervm_packages: