Diabled Cows, Added full inventory, Added update playbook, Refactoring for Conformity

This commit is contained in:
Tim Schilling
2024-11-19 15:38:18 +01:00
parent 85c4ebba71
commit 34a7651d08
4 changed files with 39 additions and 18 deletions
+5
View File
@@ -3,3 +3,8 @@ inventory = inventory/testserver.ini
host_key_checking = False
stdout_callback = yaml
callback_enabled = timer
nocows = 1
[inventory]
enable_plugins = host_list, script, auto, yaml, ini, toml
+7 -4
View File
@@ -1,7 +1,10 @@
[webservers]
testserver ansible_port=22
[linuxservers]
Tim-TT-[01:03].kitl.bayern
[webservers:vars]
[linuxserver:vars]
ansible_user = tim
ansible_host = 192.168.62.160
ansible_port = 22
ansible_private_key_file = keys/id_ed25519
[webserver]
linuxerver
+13
View File
@@ -0,0 +1,13 @@
---
- name: Update Server
hosts: linuxservers
become: true
tasks:
- name: Update and Upgrade System
apt:
update_cache: true
upgrade: true
- name: Reboot System
reboot:
...
+11 -11
View File
@@ -6,27 +6,27 @@
tasks:
- name: Ensure nginx is installed
package:
name: nginx
update_cache: true
name: nginx
update_cache: true
- name: Copy nginx config file
copy:
src: nginx.conf
dest: /etc/nginx/sites-available/default
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
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
src: index.html.j2
dest: /usr/share/nginx/html/index.html
- name: Restart nginx
service:
name: nginx
state: restarted
name: nginx
state: restarted
...