Ensure package cache is updated appropriately

When the repo container is removed, the apt cache config
is still in place and causes problems. This is due to the
tasks running to remove the cache configuration not
executing early enough in the deployment.

This patch re-orders the tasks so that the removal can
be done and the cache is updated afterwards to confirm
a working state.

It also makes the configuration happen on all hosts, then
all containers, at the right timings to ensure that if the
container is removed, the proxy config will also be removed
automatically.

Change-Id: I0d1bf9617594d9a5c7c2ea3335c80cc2478df985
This commit is contained in:
Jesse Pretorius 2018-03-15 18:13:57 +00:00
parent 882d98c94b
commit 1d731cdd89
32 changed files with 25 additions and 58 deletions

View File

@ -29,7 +29,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
#TODO: mgariepy, revisit to use include_role when https://github.com/ansible/ansible/issues/20077 is fixed
- name: install the ceph stable repository key
rpm_key:
@ -133,7 +132,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
#TODO: mgariepy, revisit to use include_role when https://github.com/ansible/ansible/issues/20077 is fixed
- name: install the ceph stable repository key
rpm_key:

View File

@ -73,9 +73,6 @@
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- name: Configure package proxy cache
include: ../common-tasks/package-cache-proxy.yml
- name: Add volume group block device to cinder
shell: |
{% if item.value.volume_group is defined %}

View File

@ -60,9 +60,6 @@
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- name: Configure package proxy cache
include: ../common-tasks/package-cache-proxy.yml
roles:
- role: "os_glance"

View File

@ -68,9 +68,6 @@
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- name: Configure package proxy cache
include: ../common-tasks/package-cache-proxy.yml
- name: Create the neutron provider networks facts
provider_networks:
provider_networks: "{{ provider_networks }}"

View File

@ -79,9 +79,6 @@
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- name: Configure package proxy cache
include: ../common-tasks/package-cache-proxy.yml
- name: Add nbd devices to the compute
shell: |
for i in /dev/nbd*;do

View File

@ -17,16 +17,17 @@
uri:
url: "{{ repo_pkg_cache_url }}/acng-report.html"
method: "HEAD"
timeout: 3
register: proxy_check
failed_when: false
tags:
- common-proxy
- name: Drop apt package manager proxy
- name: Add apt package manager proxy
copy:
content: 'Acquire::http { Proxy "{{ repo_pkg_cache_url }}"; };'
dest: "/etc/apt/apt.conf.d/00apt-cacher-proxy"
register: apt_proxy_dropped
register: _apt_proxy_added
when:
- repo_pkg_cache_enabled | bool
- proxy_check.status == 200
@ -34,24 +35,26 @@
tags:
- common-proxy
- name: Update apt when proxy is added
- name: Remove apt package manager proxy
file:
dest: "/etc/apt/apt.conf.d/00apt-cacher-proxy"
state: "absent"
register: _apt_proxy_removed
when:
- repo_pkg_cache_enabled | bool
- proxy_check.status != 200
- ansible_os_family == 'Debian'
tags:
- common-proxy
- name: Update apt when proxy is added/removed
apt:
update_cache: yes
retries: 5
delay: 2
when:
- apt_proxy_dropped | changed
tags:
- common-proxy
- name: Remove apt package manager proxy
file:
dest: "/etc/apt/apt.conf.d/00apt-cacher-proxy"
state: "absent"
when:
- repo_pkg_cache_enabled | bool
- proxy_check.status != 200
- ansible_os_family == 'Debian'
- (_apt_proxy_added is mapping and _apt_proxy_added | changed) or
(_apt_proxy_removed is mapping and _apt_proxy_removed | changed)
tags:
- common-proxy

View File

@ -57,6 +57,7 @@
gather_facts: true
user: root
pre_tasks:
- include: common-tasks/package-cache-proxy.yml
- include: common-tasks/set-upper-constraints.yml
- include: common-tasks/set-pip-upstream-url.yml
roles:

View File

@ -46,6 +46,7 @@
gather_facts: true
user: root
pre_tasks:
- include: common-tasks/package-cache-proxy.yml
- include: common-tasks/set-upper-constraints.yml
- include: common-tasks/set-pip-upstream-url.yml
roles:

View File

@ -23,7 +23,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
roles:
- role: "etcd"
etcd_install_type: server

View File

@ -33,7 +33,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
environment: "{{ deployment_environment_variables | default({}) }}"
tags:
- galera

View File

@ -71,8 +71,6 @@
rsyslog_client_config_name: "99-haproxy-rsyslog-client.conf"
tags:
- rsyslog
post_tasks:
- include: common-tasks/package-cache-proxy.yml
environment: "{{ deployment_environment_variables | default({}) }}"
tags:
- haproxy

View File

@ -28,7 +28,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
roles:
- role: "memcached_server"
- role: "rsyslog_client"

View File

@ -48,6 +48,8 @@
(ansible_os_family == 'RedHat' and ansible_distribution_major_version == '7') or
(ansible_os_family == 'Suse' and ansible_distribution_major_version == '42')
msg: "The only supported platforms for this release are Ubuntu 16.04 LTS (Xenial), CentOS 7 (WIP) and openSUSE Leap 42.X (WIP)"
- include: common-tasks/package-cache-proxy.yml
- include: common-tasks/set-upper-constraints.yml
- include: common-tasks/set-pip-upstream-url.yml
roles:

View File

@ -46,7 +46,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
roles:
- role: "os_aodh"
- role: "openstack_openrc"

View File

@ -46,7 +46,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
roles:
- role: "os_barbican"
- role: "openstack_openrc"

View File

@ -38,7 +38,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
roles:
- role: "os_ceilometer"
- role: "openstack_openrc"

View File

@ -62,7 +62,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
roles:
- role: "os_designate"
- role: "openstack_openrc"

View File

@ -44,7 +44,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
roles:
- role: "ceph_client"
openstack_service_system_user: "{{ gnocchi_system_user_name }}"

View File

@ -59,7 +59,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
roles:
- role: "os_heat"
- role: "rsyslog_client"

View File

@ -36,7 +36,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
roles:
- role: "os_horizon"
- role: "rsyslog_client"

View File

@ -41,7 +41,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
roles:
- role: "os_ironic"
- role: "openstack_openrc"

View File

@ -99,9 +99,6 @@
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- name: Configure package proxy cache
include: common-tasks/package-cache-proxy.yml
# todo(cloudnull): this task is being run only if/when keystone is installed on a physical host.
# This is not being run within a container because it is an unsupported action due to this
# issue: (https://bugs.launchpad.net/ubuntu/+source/lxc/+bug/1279041)

View File

@ -47,7 +47,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
roles:
- role: "os_octavia"
- role: "openstack_openrc"

View File

@ -57,7 +57,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
roles:
- role: "os_sahara"
- role: "openstack_openrc"

View File

@ -35,7 +35,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
# If we're using ceilometer then swift needs a rabbitmq/vhost & usera
- include: common-tasks/rabbitmq-vhost-user.yml

View File

@ -42,7 +42,6 @@
login_host: "{{ tacker_galera_address }}"
db_name: "{{ tacker_galera_database }}"
when: inventory_hostname == groups['tacker_all'][0]
- include: common-tasks/package-cache-proxy.yml
roles:
- role: "os_tacker"
- role: "openstack_openrc"

View File

@ -62,7 +62,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
roles:
- role: "os_trove"
- role: "openstack_openrc"

View File

@ -28,7 +28,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
roles:
- role: "system_crontab_coordination"
environment: "{{ deployment_environment_variables | default({}) }}"

View File

@ -17,12 +17,12 @@
# is done upfront. This would mean that the openstack_hosts role
# can run once and for all directly after the
# lxc-container-create playbook.
- name: Configure all nodes to use repo
- name: Configure all nodes to use the repo container for python/apt packages
hosts: all:!repo_all
pre_tasks:
- include: common-tasks/package-cache-proxy.yml
roles:
- pip_install
environment: "{{ deployment_environment_variables | default({}) }}"
tags:
- always

View File

@ -29,7 +29,6 @@
static: no
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
roles:
- role: "rsyslog_server"
tags:

View File

@ -21,7 +21,6 @@
pre_tasks:
- include: common-tasks/os-log-dir-setup.yml
- include: "common-tasks/os-{{ container_tech | default('lxc') }}-container-setup.yml"
- include: common-tasks/package-cache-proxy.yml
roles:
- role: "unbound"
tags:

View File

@ -30,8 +30,6 @@
when:
- hostvars['localhost']['resolvconf_enabled'] | bool
- include: common-tasks/package-cache-proxy.yml
- name: Create log directory (not is_metal)
file:
dest: "/var/log/utility"