State after Chapter 1

This commit is contained in:
Tim Schilling
2024-11-19 08:46:20 +01:00
commit f4324b427d
10 changed files with 78 additions and 0 deletions
+31
View File
@@ -0,0 +1,31 @@
---
- name: Configure webserver with nginx
hosts: webservers
become: true
tasks:
- name: Ensure nginx is installed
package:
name: nginx
update_cache: yes
- name: Copy nginx config file
copy:
src: nginx.conf
dest: /etc/nginx/sites-available/default
- name: Enable Configuration
file:
src: /etc/nginx/sites-available/default
dest: /etc/nginx/sites-enabled/default
state: link
- name: Copy index.html
template:
src: index.html.j2
dest: /usr/share/nginx/html/index.html
- name: Restart nginx
service:
name: nginx
state: restarted
...