Created
December 21, 2018 16:35
-
-
Save patsevanton/0c373871b730d77e5c4ba012cc5041ce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
check_raw.yml | |
--- | |
- hosts: all | |
name: test | |
gather_facts: False | |
vars: | |
http_proxy: 'http://172.16.149.1:3128' | |
https_proxy: 'http://172.16.149.1:3128' | |
tasks: | |
- name: Check http::proxy in /etc/apt/apt.conf | |
raw: grep -Fxq 'Acquire::http::proxy "{{http_proxy}}";' /etc/apt/apt.conf | |
register: need_http_proxy | |
failed_when: false | |
changed_when: false | |
environment: {} | |
tags: facts | |
- name: Add http_proxy to /etc/apt/apt.conf if http_proxy is defined | |
raw: echo 'Acquire::http::proxy "{{http_proxy}}";' >> /etc/apt/apt.conf | |
environment: {} | |
when: | |
need_http_proxy.rc | |
- name: Check https::proxy in /etc/apt/apt.conf | |
raw: grep -Fxq 'Acquire::https::proxy "{{https_proxy}}";' /etc/apt/apt.conf | |
register: need_https_proxy | |
failed_when: false | |
changed_when: false | |
environment: {} | |
tags: facts | |
- name: Add https_proxy to /etc/apt/apt.conf if https_proxy is defined | |
raw: echo 'Acquire::https::proxy "{{https_proxy}}";' >> /etc/apt/apt.conf | |
environment: {} | |
when: | |
need_https_proxy.rc | |
ansible-playbook check_raw.yml --ask-pass |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment