diff --git a/playbooks/ceph-install.yml b/playbooks/ceph-install.yml index fb06381c4d..088a71c193 100644 --- a/playbooks/ceph-install.yml +++ b/playbooks/ceph-install.yml @@ -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: diff --git a/playbooks/common-playbooks/cinder.yml b/playbooks/common-playbooks/cinder.yml index 18cda91272..ca8a991d5c 100644 --- a/playbooks/common-playbooks/cinder.yml +++ b/playbooks/common-playbooks/cinder.yml @@ -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 %} diff --git a/playbooks/common-playbooks/glance.yml b/playbooks/common-playbooks/glance.yml index 4902c3dcf7..f16fa1eef4 100644 --- a/playbooks/common-playbooks/glance.yml +++ b/playbooks/common-playbooks/glance.yml @@ -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" diff --git a/playbooks/common-playbooks/neutron.yml b/playbooks/common-playbooks/neutron.yml index 9732a7e266..a9c7402ce4 100644 --- a/playbooks/common-playbooks/neutron.yml +++ b/playbooks/common-playbooks/neutron.yml @@ -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 }}" diff --git a/playbooks/common-playbooks/nova.yml b/playbooks/common-playbooks/nova.yml index a31635b43e..20fa5ea519 100644 --- a/playbooks/common-playbooks/nova.yml +++ b/playbooks/common-playbooks/nova.yml @@ -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 diff --git a/playbooks/common-tasks/package-cache-proxy.yml b/playbooks/common-tasks/package-cache-proxy.yml index f13f230ea9..d302e1e8f0 100644 --- a/playbooks/common-tasks/package-cache-proxy.yml +++ b/playbooks/common-tasks/package-cache-proxy.yml @@ -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 diff --git a/playbooks/containers-lxc-create.yml b/playbooks/containers-lxc-create.yml index c35f119c76..41974a051d 100644 --- a/playbooks/containers-lxc-create.yml +++ b/playbooks/containers-lxc-create.yml @@ -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: diff --git a/playbooks/containers-nspawn-create.yml b/playbooks/containers-nspawn-create.yml index 5eff4e59ca..33af98e0d1 100644 --- a/playbooks/containers-nspawn-create.yml +++ b/playbooks/containers-nspawn-create.yml @@ -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: diff --git a/playbooks/etcd-install.yml b/playbooks/etcd-install.yml index 8c47e0065a..762fa019e7 100644 --- a/playbooks/etcd-install.yml +++ b/playbooks/etcd-install.yml @@ -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 diff --git a/playbooks/galera-install.yml b/playbooks/galera-install.yml index 72d29b7f71..b7a0d2b3c3 100644 --- a/playbooks/galera-install.yml +++ b/playbooks/galera-install.yml @@ -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 diff --git a/playbooks/haproxy-install.yml b/playbooks/haproxy-install.yml index 793706a5f3..73d3d69687 100644 --- a/playbooks/haproxy-install.yml +++ b/playbooks/haproxy-install.yml @@ -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 diff --git a/playbooks/memcached-install.yml b/playbooks/memcached-install.yml index aaefa22cfe..aa37e616b7 100644 --- a/playbooks/memcached-install.yml +++ b/playbooks/memcached-install.yml @@ -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" diff --git a/playbooks/openstack-hosts-setup.yml b/playbooks/openstack-hosts-setup.yml index 485478735e..4979b6352f 100644 --- a/playbooks/openstack-hosts-setup.yml +++ b/playbooks/openstack-hosts-setup.yml @@ -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: diff --git a/playbooks/os-aodh-install.yml b/playbooks/os-aodh-install.yml index ebf3992fd6..311f63c6af 100644 --- a/playbooks/os-aodh-install.yml +++ b/playbooks/os-aodh-install.yml @@ -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" diff --git a/playbooks/os-barbican-install.yml b/playbooks/os-barbican-install.yml index 7f66fc59bb..3f433894a1 100644 --- a/playbooks/os-barbican-install.yml +++ b/playbooks/os-barbican-install.yml @@ -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" diff --git a/playbooks/os-ceilometer-install.yml b/playbooks/os-ceilometer-install.yml index f9fcc92f63..745a9b37aa 100644 --- a/playbooks/os-ceilometer-install.yml +++ b/playbooks/os-ceilometer-install.yml @@ -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" diff --git a/playbooks/os-designate-install.yml b/playbooks/os-designate-install.yml index 0e59866539..ed3b81dacd 100644 --- a/playbooks/os-designate-install.yml +++ b/playbooks/os-designate-install.yml @@ -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" diff --git a/playbooks/os-gnocchi-install.yml b/playbooks/os-gnocchi-install.yml index bb70103477..247ffa234c 100644 --- a/playbooks/os-gnocchi-install.yml +++ b/playbooks/os-gnocchi-install.yml @@ -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 }}" diff --git a/playbooks/os-heat-install.yml b/playbooks/os-heat-install.yml index 2f52f50736..aabcde88b0 100644 --- a/playbooks/os-heat-install.yml +++ b/playbooks/os-heat-install.yml @@ -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" diff --git a/playbooks/os-horizon-install.yml b/playbooks/os-horizon-install.yml index 07888fcfb9..bc53893888 100644 --- a/playbooks/os-horizon-install.yml +++ b/playbooks/os-horizon-install.yml @@ -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" diff --git a/playbooks/os-ironic-install.yml b/playbooks/os-ironic-install.yml index cb0382fc4a..6c8696877d 100644 --- a/playbooks/os-ironic-install.yml +++ b/playbooks/os-ironic-install.yml @@ -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" diff --git a/playbooks/os-keystone-install.yml b/playbooks/os-keystone-install.yml index 03e08e84d7..7d1d9a3722 100644 --- a/playbooks/os-keystone-install.yml +++ b/playbooks/os-keystone-install.yml @@ -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) diff --git a/playbooks/os-octavia-install.yml b/playbooks/os-octavia-install.yml index 317105955e..061bf6bc4e 100644 --- a/playbooks/os-octavia-install.yml +++ b/playbooks/os-octavia-install.yml @@ -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" diff --git a/playbooks/os-sahara-install.yml b/playbooks/os-sahara-install.yml index 65b5bc76ef..09dc410b5c 100644 --- a/playbooks/os-sahara-install.yml +++ b/playbooks/os-sahara-install.yml @@ -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" diff --git a/playbooks/os-swift-install.yml b/playbooks/os-swift-install.yml index e5c77b37b8..87c11de9d4 100644 --- a/playbooks/os-swift-install.yml +++ b/playbooks/os-swift-install.yml @@ -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 diff --git a/playbooks/os-tacker-install.yml b/playbooks/os-tacker-install.yml index c9a1d74ae6..5b6af6708e 100644 --- a/playbooks/os-tacker-install.yml +++ b/playbooks/os-tacker-install.yml @@ -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" diff --git a/playbooks/os-trove-install.yml b/playbooks/os-trove-install.yml index cb8daee5e5..d62e712503 100644 --- a/playbooks/os-trove-install.yml +++ b/playbooks/os-trove-install.yml @@ -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" diff --git a/playbooks/rabbitmq-install.yml b/playbooks/rabbitmq-install.yml index 26f56e05eb..54166b2279 100644 --- a/playbooks/rabbitmq-install.yml +++ b/playbooks/rabbitmq-install.yml @@ -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({}) }}" diff --git a/playbooks/repo-use.yml b/playbooks/repo-use.yml index 5332095431..6e3ea5d9d4 100644 --- a/playbooks/repo-use.yml +++ b/playbooks/repo-use.yml @@ -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 diff --git a/playbooks/rsyslog-install.yml b/playbooks/rsyslog-install.yml index 24a0b1c408..03a1b706e4 100644 --- a/playbooks/rsyslog-install.yml +++ b/playbooks/rsyslog-install.yml @@ -29,7 +29,6 @@ static: no when: - hostvars['localhost']['resolvconf_enabled'] | bool - - include: common-tasks/package-cache-proxy.yml roles: - role: "rsyslog_server" tags: diff --git a/playbooks/unbound-install.yml b/playbooks/unbound-install.yml index 6f2ecd2704..ee50b20c82 100644 --- a/playbooks/unbound-install.yml +++ b/playbooks/unbound-install.yml @@ -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: diff --git a/playbooks/utility-install.yml b/playbooks/utility-install.yml index 019cddff75..b58fa142fb 100644 --- a/playbooks/utility-install.yml +++ b/playbooks/utility-install.yml @@ -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"