-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathplay.yml
59 lines (50 loc) · 1.19 KB
/
play.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
---
- name: Complete playbook
hosts: client02.local.com
become: yes
vars_files:
- vars.yml
tasks:
- name: Install packages
yum:
name: "{{ packages }}"
state: latest
- name: Copy the configuration template
template:
src: templates/httpd.conf.j2
dest: /etc/httpd/conf/httpd.conf
- name: Start the services
service:
name: "{{ item }}"
state: started
enabled: yes
with_items:
- "{{ servs.web_service }}"
- "{{ servs.firewall_service }}"
- name: Allow http in firewall
firewalld:
service: http
state: enabled
permanent: yes
immediate: yes
- name: Copy the index html
copy:
content: "This is a complete playbook"
dest: /var/www/html/index.html
notify: restart_httpd
handlers:
- name: restart_httpd
service:
name: httpd
state: restarted
- name: Test the website
hosts: localhost
tasks:
- name: Test the URL
uri:
url: http://192.168.0.7
return_content: yes
register: web_content
- name: Display the web content
debug:
var: web_content