Beginning-Ansible-Concepts-.../chapter05/webservers.yml

42 lines
892 B
YAML
Raw Normal View History

2022-03-21 18:17:54 +01:00
---
- 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