-
Notifications
You must be signed in to change notification settings - Fork 0
/
Patches_and_installation2.txt
80 lines (64 loc) · 2.18 KB
/
Patches_and_installation2.txt
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
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
Patches and installation.
Story by Janathan Lozada De La Matta.
Next we will install NGINX
using the role in Ansible Lightbulb.
- name: Ensure nginx packages are present
yum:
name: nginx, python-pip, python-devel, devel
state: present
notify: restart-nginx-service
- name: Ensure uwsgi package is present
pip:
name: uwsgi
state: present
notify: restart-nginx-service
- name: Ensure latest default.conf is present
template:
src: templates/nginx.conf.j2
dest: /etc/nginx/nginx.conf
backup: yes
notify: restart-nginx-service
- name: Ensure latest index.html is present
template:
src: templates/index.html.j2
dest: /usr/share/nginx/html/index.html
- name: Ensure nginx service is started and enabled
service:
name: nginx
state: started
enabled: yes
- name: Ensure proper response from localhost can be received
uri:
url: "http://localhost:80/"
return_content: yes
register: response
until: 'nginx_test_message in response.content'
retries: 10
delay: 1
And the handler that restarts the nginx service:
# handlers file for nginx-example
- name: restart-nginx-service
service:
name: nginx
state: restarted
In this role, we install the RPMs nginx, python-pip, py-
thon-devel, and devel and install uwsgi with pip. next, we
use the template module to copy over the nginx.conf and
index.html for the page to display. After that, we make sure
the service is enabled on boot and started. Then we use the
URI module to check the connection to the page.
Here is a playbook showing an example of updating, re-
starting, and installing an RPM. Then continue installing nginx.
This can be done with any other roles/applications you want.
- hosts: all
roles:
- centos-update
- nginx-simple
This was just a simple example of how to update, reboot,
and continue. For simplicity, I added the packages without
variables.
Once you start working with a large number of
hosts, you will need to change a few settings:
• async & poll
• serial
• forks