Skip to content

Commit cf5e3ae

Browse files
authored
Update nginx.yml
1 parent 00b15a6 commit cf5e3ae

File tree

1 file changed

+23
-20
lines changed

1 file changed

+23
-20
lines changed

ansible/playbooks/nginx.yml

Lines changed: 23 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,25 @@
1-
---
2-
- hosts: all
1+
- name: install nginx
2+
hosts: all
33
become: yes
44
tasks:
5-
- name: ensure nginx is at the latest version
6-
apt:
7-
name: nginx
8-
state: latest
9-
- name: copy the content of the web site
10-
shell: echo "hi there, Ansible is Cool" > "/var/www/html/index.html"
11-
- name: start nginx
12-
service:
13-
name: nginx
14-
state: restarted
15-
# - name: stop nginx
16-
# service:
17-
# name: nginx
18-
# state: stopped
19-
# - name: ensure nginx is not installed
20-
# apt:
21-
# name: nginx
22-
# state: absent
5+
- name: run apt-get update
6+
apt:
7+
update_cache: yes
8+
- name: install nginx
9+
apt:
10+
name: nginx
11+
state: present
12+
- name: start service
13+
systemd:
14+
name: nginx
15+
state: restarted
16+
#- name: stop nginx
17+
# systemd:
18+
# name: nginx
19+
# state: stopped
20+
#- name: uninstall nginx
21+
# apt:
22+
# name: nginx
23+
# state: absent
24+
# purge: true
25+
# autoremove: true

0 commit comments

Comments
 (0)