mirror of
https://github.com/Apress/Beginning-Ansible-Concepts-and-Application.git
synced 2024-09-19 14:17:29 +02:00
41 lines
892 B
YAML
41 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
|
|
|