-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathTestenvironment.yml
42 lines (37 loc) · 1.1 KB
/
Testenvironment.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
---
- name: Configuring Test Environment to use repository from Apache web server
hosts: test
become: yes
vars:
Apache_hostname: "ApacheWebServer"
tasks:
- name: Create test.list file
file:
path: "/etc/apt/sources.list.d/test.list"
state: touch
- name: Obtain public IP of Apache WEB SERVER
uri:
url: https://httpbin.org/ip
return_content: yes
delegate_to: "{{ Apache_hostname }}"
register: ip_result
- name: Edit test.list file inside /etc/apt/sources.list.d/ directory
copy:
dest: "/etc/apt/sources.list.d/test.list"
content: |
deb [trusted=yes] http://{{ ip_result.json.origin }}/test-repo/ ./
- name: Update apt Cache
apt:
update_cache: yes
- name: Loop through list to show apt cache policy for each service
ansible.builtin.shell: apt-cache policy {{ item }}
loop:
- docker
- nginx
- apache2
- cowsay
- htop
register: apt_policy_output
- name: Print apt cache policy outputs
debug:
var: apt_policy_output