From 1240dd0cf0fa8768d049902b613ba8956a4f6a37 Mon Sep 17 00:00:00 2001 From: Jesse Pretorius Date: Sat, 16 Jul 2016 20:55:20 +0100 Subject: [PATCH] Move UCA 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. The variable to enable/disable the use of UCA has been standardised to the same as the os_nova role. Change-Id: I442f6dca8345f78848536f2fc923b72be8a6d092 --- defaults/main.yml | 7 +++++-- .../use-uca-by-default-070751b0b388fcbe.yaml | 8 +++----- tasks/neutron_install-apt.yml | 4 ++-- tests/test-install-neutron.yml | 15 +++++++++++++++ vars/ubuntu-14.04.yml | 2 +- vars/ubuntu-16.04.yml | 2 +- 6 files changed, 27 insertions(+), 11 deletions(-) diff --git a/defaults/main.yml b/defaults/main.yml index 52dbf280..9f9792c5 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -38,8 +38,6 @@ neutron_developer_constraints: - "git+{{ neutron_lbaas_git_repo }}@{{ neutron_lbaas_git_install_branch }}#egg=neutron-lbaas" - "git+{{ neutron_vpnaas_git_repo }}@{{ neutron_vpnaas_git_install_branch }}#egg=neutron-vpnaas" -neutron_use_uca: True - # Name of the virtual env to deploy into neutron_venv_tag: untagged neutron_bin: "/openstack/venvs/neutron-{{ neutron_venv_tag }}/bin" @@ -384,6 +382,11 @@ neutron_service_in_ldap: false # neutron_local_ip is used for the VXLAN local tunnel endpoint neutron_local_ip: 127.0.0.1 +# Toggle the use of Ubuntu Cloud Archive +neutron_uca_enable: True +# Ubuntu Cloud Archive mirror URL +uca_apt_repo_url: "http://ubuntu-cloud.archive.canonical.com/ubuntu" + # When running in an AIO, we need to implement an iptables rule in any # neutron_agent containers to that ensure instances can communicate with # the neutron metadata service. This is necessary because in an AIO diff --git a/releasenotes/notes/use-uca-by-default-070751b0b388fcbe.yaml b/releasenotes/notes/use-uca-by-default-070751b0b388fcbe.yaml index f96b65e2..e473f280 100644 --- a/releasenotes/notes/use-uca-by-default-070751b0b388fcbe.yaml +++ b/releasenotes/notes/use-uca-by-default-070751b0b388fcbe.yaml @@ -1,6 +1,4 @@ --- -other: - - Neutron now makes use of ubuntu cloud archive by - default. This can be disabled by setting - ``neutron_use_uca`` to ``False`` in your user - variables. +upgrade: + - Neutron now makes use of Ubuntu Cloud Archive by default. This can be + disabled by setting ``neutron_uca_enable`` to ``False``. diff --git a/tasks/neutron_install-apt.yml b/tasks/neutron_install-apt.yml index 08c69ecb..5d4bda73 100644 --- a/tasks/neutron_install-apt.yml +++ b/tasks/neutron_install-apt.yml @@ -18,14 +18,14 @@ pkg: ubuntu-cloud-keyring state: latest register: add_uca_keys - when: neutron_use_uca | bool + when: neutron_uca_enable | bool - name: Add Ubuntu Cloud Archive Repository apt_repository: repo: "{{ uca_repo }}" state: present register: add_uca_repo - when: neutron_use_uca | bool + when: neutron_uca_enable | bool #TODO(evrardjp): Replace the next 2 tasks by a standard apt with cache #when https://github.com/ansible/ansible-modules-core/pull/1517 is merged diff --git a/tests/test-install-neutron.yml b/tests/test-install-neutron.yml index 1c140c8d..202083dd 100644 --- a/tests/test-install-neutron.yml +++ b/tests/test-install-neutron.yml @@ -91,6 +91,21 @@ when: inventory_hostname == groups['neutron_all'][0] tags: - mysql-db-setup + - 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 }}" post_tasks: diff --git a/vars/ubuntu-14.04.yml b/vars/ubuntu-14.04.yml index c20b8cef..bcf88281 100644 --- a/vars/ubuntu-14.04.yml +++ b/vars/ubuntu-14.04.yml @@ -13,10 +13,10 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Ubuntu Cloud Archive variables # There are no UCA packages for Trusty beyond Mitaka, so the selected # release here has to remain at Mitaka. uca_openstack_release: mitaka -uca_apt_repo_url: "http://ubuntu-cloud.archive.canonical.com/ubuntu" uca_repo_dist: "{{ ansible_lsb.codename }}-updates/{{ uca_openstack_release }}" uca_repo: "deb {{ uca_apt_repo_url }} {{ uca_repo_dist }} main" diff --git a/vars/ubuntu-16.04.yml b/vars/ubuntu-16.04.yml index a6e8b50d..62cda1e6 100644 --- a/vars/ubuntu-16.04.yml +++ b/vars/ubuntu-16.04.yml @@ -13,8 +13,8 @@ # See the License for the specific language governing permissions and # limitations under the License. +# Ubuntu Cloud Archive variables uca_openstack_release: newton -uca_apt_repo_url: "http://ubuntu-cloud.archive.canonical.com/ubuntu" uca_repo_dist: "{{ ansible_lsb.codename }}-updates/{{ uca_openstack_release }}" uca_repo: "deb {{ uca_apt_repo_url }} {{ uca_repo_dist }} main"