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
+2
View File
@@ -0,0 +1,2 @@
skip_list:
- 'fqcn-builtins'
+3
View File
@@ -0,0 +1,3 @@
{
"ansible.python.interpreterPath": "/bin/python3"
}
+2
View File
@@ -0,0 +1,2 @@
[ZoneTransfer]
ZoneId=3
+5
View File
@@ -0,0 +1,5 @@
[defaults]
inventory = inventory/testserver.ini
host_key_checking = False
stdout_callback = yaml
callback_enabled = timer
+10
View File
@@ -0,0 +1,10 @@
server {
listen 80 default_server;
listen [::]:80 default_server ipv6only=on;
root /usr/share/nginx/html;
index index.html index.htm;
server_name localhost;
location / {
try_files $uri $uri/ =404;
}
}
+7
View File
@@ -0,0 +1,7 @@
[webservers]
testserver ansible_port=22
[webservers:vars]
ansible_user = tim
ansible_host = 192.168.62.160
ansible_private_key_file = keys/id_ed25519
+7
View File
@@ -0,0 +1,7 @@
-----BEGIN OPENSSH PRIVATE KEY-----
b3BlbnNzaC1rZXktdjEAAAAABG5vbmUAAAAEbm9uZQAAAAAAAAABAAAAMwAAAAtzc2gtZW
QyNTUxOQAAACC1SsPDzw0Rioh/4VF0hXqwQrJmEghsQvJMiuHHU7FkOAAAAJgiWNTXIljU
1wAAAAtzc2gtZWQyNTUxOQAAACC1SsPDzw0Rioh/4VF0hXqwQrJmEghsQvJMiuHHU7FkOA
AAAEBznmj4u1JoKTg8mSR8NAmdJWOcNSD6zM7flg22nbwCb7VKw8PPDRGKiH/hUXSFerBC
smYSCGxC8kyK4cdTsWQ4AAAAE3RpbUBTQ0hJTExJTkctTC1XMTEBAg==
-----END OPENSSH PRIVATE KEY-----
+1
View File
@@ -0,0 +1 @@
ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAILVKw8PPDRGKiH/hUXSFerBCsmYSCGxC8kyK4cdTsWQ4 tim@SCHILLING-L-W11
+10
View File
@@ -0,0 +1,10 @@
<html>
<head>
<title>Welcome to ansible</title>
</head>
<body>
<h1>Nginx, configured by Ansible</h1>
<p>If you can see this, Ansible successfully installed nginx.</p>
<p>Running on {{ inventory_hostname }}</p>
</body>
</html>
+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
...