mirror of
https://github.com/Apress/Beginning-Ansible-Concepts-and-Application.git
synced 2024-11-09 17:07:44 +01:00
42 lines
892 B
YAML
42 lines
892 B
YAML
|
---
|
||
|
- hosts: webservers
|
||
|
become: true
|
||
|
tasks:
|
||
|
- name: Ensure nginx is installed
|
||
|
apt:
|
||
|
name: nginx
|
||
|
state: present
|
||
|
|
||
|
- name: Push website content to the web root
|
||
|
copy:
|
||
|
src: index.html
|
||
|
dest: /var/www/html/
|
||
|
mode: u=rw,g=r,o=r
|
||
|
|
||
|
- name: index.html also known as main.html
|
||
|
file:
|
||
|
state: link
|
||
|
src: /var/www/html/index.html
|
||
|
dest: /var/www/html/main.html
|
||
|
|
||
|
- name: Update the website content
|
||
|
lineinfile:
|
||
|
path: /var/www/html/index.html
|
||
|
line: "Just re-decorating a little!"
|
||
|
|
||
|
- name: Firewall - Allow SSH connections
|
||
|
ufw:
|
||
|
rule: allow
|
||
|
name: OpenSSH
|
||
|
|
||
|
- name: Firewall - Allow website connections
|
||
|
ufw:
|
||
|
rule: allow
|
||
|
name: "Nginx Full"
|
||
|
|
||
|
- name: Firewall - Deny everything else
|
||
|
ufw:
|
||
|
state: enabled
|
||
|
policy: deny
|
||
|
|