Change the common proxy cache manage tasks to be stateful
In certain situation the proxy cache manager may be down, misconfigured, or otherwise not available. To ensure a consistent environment and give the deployer a better build experience, especially in the case of an AIO, the proxy cache common task has been changed to test for cache availability and add/remove the cache files based on that test. Change-Id: Ibd0186d67a844ec7b79f423adfb8104d13f72ca5 Closes-Bug: #1632826 Signed-off-by: Kevin Carter <kevin.carter@rackspace.com>
This commit is contained in:
parent
4b5fc5cf86
commit
52d7ae8397
@ -13,11 +13,28 @@
|
|||||||
# See the License for the specific language governing permissions and
|
# See the License for the specific language governing permissions and
|
||||||
# limitations under the License.
|
# limitations under the License.
|
||||||
|
|
||||||
|
- name: test proxy URL for connectivity
|
||||||
|
uri:
|
||||||
|
url: "{{ repo_pkg_cache_url }}/acng-report.html"
|
||||||
|
method: "HEAD"
|
||||||
|
register: proxy_check
|
||||||
|
failed_when: false
|
||||||
|
|
||||||
- name: Drop apt package manager proxy
|
- name: Drop apt package manager proxy
|
||||||
copy:
|
copy:
|
||||||
content: 'Acquire::http { Proxy "{{ repo_pkg_cache_url }}"; };'
|
content: 'Acquire::http { Proxy "{{ repo_pkg_cache_url }}"; };'
|
||||||
dest: "/etc/apt/apt.conf.d/00apt-cacher-proxy"
|
dest: "/etc/apt/apt.conf.d/00apt-cacher-proxy"
|
||||||
when:
|
when:
|
||||||
|
- proxy_check.status == 200
|
||||||
|
- ansible_os_family == 'Debian'
|
||||||
|
- repo_pkg_cache_enabled | bool
|
||||||
|
|
||||||
|
- name: Remove apt package manager proxy
|
||||||
|
file:
|
||||||
|
dest: "/etc/apt/apt.conf.d/00apt-cacher-proxy"
|
||||||
|
state: "absent"
|
||||||
|
when:
|
||||||
|
- proxy_check.status != 200
|
||||||
- ansible_os_family == 'Debian'
|
- ansible_os_family == 'Debian'
|
||||||
- repo_pkg_cache_enabled | bool
|
- repo_pkg_cache_enabled | bool
|
||||||
|
|
||||||
@ -25,6 +42,8 @@
|
|||||||
lineinfile:
|
lineinfile:
|
||||||
line: 'proxy={{ repo_pkg_cache_url }}'
|
line: 'proxy={{ repo_pkg_cache_url }}'
|
||||||
dest: "/etc/yum.conf"
|
dest: "/etc/yum.conf"
|
||||||
|
state: "{{ (proxy_check.status == 200) | ternary('present', 'absent') }}"
|
||||||
when:
|
when:
|
||||||
- ansible_os_family == 'RedHat'
|
- ansible_os_family == 'RedHat'
|
||||||
- repo_pkg_cache_enabled | bool
|
- repo_pkg_cache_enabled | bool
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user