diff --git a/defaults/main.yml b/defaults/main.yml index fcb2fdf..639b554 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -37,6 +37,11 @@ repo_build_release_tag: "untagged" # in Newton. # repo_build_pip_extra_index: "https://pypi.python.org/simple" +# Toggle the use of Ubuntu Cloud Archive +repo_build_uca_enable: True +# Ubuntu Cloud Archive mirror URL +uca_apt_repo_url: "http://ubuntu-cloud.archive.canonical.com/ubuntu" + repo_build_timeout: 120 repo_build_concurrency: "{{ ansible_processor_count if ansible_processor_count > 0 else 5}}" repo_build_venv_build_dir: "/tmp/openstack-venv-builder" diff --git a/releasenotes/notes/repo-build-use-uca-by-default-bde8ded7d72cd42c.yaml b/releasenotes/notes/repo-build-use-uca-by-default-bde8ded7d72cd42c.yaml new file mode 100644 index 0000000..58b69b3 --- /dev/null +++ b/releasenotes/notes/repo-build-use-uca-by-default-bde8ded7d72cd42c.yaml @@ -0,0 +1,4 @@ +--- +upgrade: + - The ``repo_build`` role now makes use of Ubuntu Cloud Archive by default. + This can be disabled by setting ``repo_build_uca_enable`` to ``False``. diff --git a/tasks/install-apt.yml b/tasks/install-apt.yml index 6c2679e..a019151 100644 --- a/tasks/install-apt.yml +++ b/tasks/install-apt.yml @@ -13,6 +13,20 @@ # See the License for the specific language governing permissions and # limitations under the License. +- name: Add Ubuntu Cloud Archive keyring + apt: + pkg: ubuntu-cloud-keyring + state: latest + register: add_uca_keys + when: repo_build_uca_enable | bool + +- name: Add Ubuntu Cloud Archive Repository + apt_repository: + repo: "{{ uca_repo }}" + state: present + register: add_uca_repo + when: repo_build_uca_enable | bool + - name: Drop lxc-net override file template: src: manual-init.override.j2 @@ -36,7 +50,8 @@ - name: Update apt if needed apt: update_cache: yes - when: "ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}" + when: ("ansible_date_time.epoch|float - apt_cache_stat.stat.mtime > {{cache_timeout}}" or + add_uca_keys | changed or add_uca_repo | changed) tags: - repo-build-apt-packages diff --git a/tests/test-repo-build.yml b/tests/test-repo-build.yml index ee95736..7d33903 100644 --- a/tests/test-repo-build.yml +++ b/tests/test-repo-build.yml @@ -16,6 +16,26 @@ - name: Build repo hosts: repo_all user: root + pre_tasks: + - 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: + - ansible_pkg_mgr == 'apt' + - 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: + - ansible_pkg_mgr == 'apt' + - nodepool.stat.exists | bool roles: - "repo_server" - "{{ rolename | basename }}" diff --git a/vars/ubuntu-14.04.yml b/vars/ubuntu-14.04.yml new file mode 100644 index 0000000..a06b444 --- /dev/null +++ b/vars/ubuntu-14.04.yml @@ -0,0 +1,45 @@ +--- +# Copyright 2016, Rackspace US, Inc. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +## APT Cache options +cache_timeout: 600 + +# 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_repo_dist: "{{ ansible_lsb.codename }}-updates/{{ uca_openstack_release }}" +uca_repo: "deb {{ uca_apt_repo_url }} {{ uca_repo_dist }} main" + +repo_build_packages: + - build-essential + - cmake + - git + - liberasurecode-dev # required to build pyeclib + - libffi-dev # required to build xattr + - libjpeg-dev # required to build pillow + - libkrb5-dev # required to build pykerberos + - libldap2-dev # required to build python-ldap + - libmariadbclient-dev # required to build MySQL-python + - libpq-dev # required to build psycopg2 + - libsasl2-dev # required to build python-ldap + - libsqlite3-dev # required to build pysqlite + - libssl-dev # required to build cryptography + - libvirt-dev # required to build libvirt-python + - libxslt1-dev # required to build lxml + - lxc-dev # required to build lxc-python2 + - pkg-config + - python-dev + - swig diff --git a/vars/debian.yml b/vars/ubuntu-16.04.yml similarity index 87% rename from vars/debian.yml rename to vars/ubuntu-16.04.yml index 824e8fb..d2e22e6 100644 --- a/vars/debian.yml +++ b/vars/ubuntu-16.04.yml @@ -16,6 +16,11 @@ ## APT Cache options cache_timeout: 600 +# Ubuntu Cloud Archive variables +uca_openstack_release: newton +uca_repo_dist: "{{ ansible_lsb.codename }}-updates/{{ uca_openstack_release }}" +uca_repo: "deb {{ uca_apt_repo_url }} {{ uca_repo_dist }} main" + repo_build_packages: - build-essential - cmake