Initial commit

This commit is contained in:
DerLinkman
2024-02-02 21:24:08 +01:00
commit b03f7a47e0
7 changed files with 94 additions and 0 deletions

3
.gitignore vendored Normal file
View File

@@ -0,0 +1,3 @@
ansible.cfg
hosts
proxmox.*

View File

@@ -0,0 +1,19 @@
---
- name: Add SSH Keys on Hosts
hosts: all
vars_files:
- vars/public-keys.env
tasks:
- name: Get SSH Keys
ansible.builtin.shell: cat /root/.ssh/authorized_keys
register: key_output
- name: Add SSH Keys
with_items:
- "{{ ssh_keys }}"
ansible.builtin.shell: |
cat <<EOF >> /root/.ssh/authorized_keys
### Managed with Ansible {{ ansible_date_time.day }}-{{ ansible_date_time.month }}-{{ ansible_date_time.year }} ###
{{ item }}
EOF
when: key_output.stdout.find('{{ item }}') == -1

View File

@@ -0,0 +1,4 @@
---
ssh_keys:
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABgQDGrrd0B5UIj2bkpqLbj1NVAKGzh0T4X20jZGaXYLA18MHK7LqAunTZb231JwdjhrzHPy826/fwn7NU/GKAZJkk3tEi1nXI8bFUGbtCMDGh6VGTWujGzhVHnNDh+jh2t5uJe0E8Scnrn9sD4lFeMeihbBdjv6GHYYFWVkKXZ0kgLnD+wjZkQLTIgLlHocb/gPODjDWsArto5fc9YOZoPgM9XkveojXWMbPLspcD6CMysOObMwdthW0eRDoI380Ol2Pe/fT0x5bSBwUTCBRrhQUO/p3KlwYQe/sO9t//Z5vBF3XBkLCm5Y7O/Mx5FpAPjHQPHT8E9m0k863pcSWwoT/QaU1f5xQl/2RGPS8GgWmKFzHuVM/sMmVGbp7S6YMTgPh6GTWggeYCjruPZNnjUt3V2cPLe97I8dPrc/GP+dHPc5uF5w8bMyZOC21yndCwocmPOM3LYyxTggbtZctr7WXGx6Zqc1HQ+EL8iPteIiCWYT7wwW3sol3LUY/HgB2nChU= root@ansible-semaphore
- ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQCgNIBhFlWa82Q0f2EnPcpHsP5JmmGpxyWVUhfpWV3KLvNkl63aGBRZW1gEoda1P5j/ESkwHntVeen8vHjqlQ/ZB9Bs3XtWwsvtS8gfyCoRqgQVQ31T52KVT3QL8/ep0RYwG+3VbE9yvQgeELJETzpXWoyY9+RrPG1gMdArML5cO1NCizShsxNKgHe75+GjCdEe3HMUuCcfJ23JqxPqgA5HoGW1mGsbI1LnLn1fqgmywSKET5LpkKHtHjrXFtQi2NKEnZ3RNxgh60v4amvMKLsxBk1vAn40X+ZeLJwNMpMHep2IzvO67inlj9iWaY5VXjZznLXzd85zhTO3eDv+yAp9 linkman-pc-2022

View File

@@ -0,0 +1,12 @@
---
- name: check if system reboot is required
hosts: all
tasks:
- name: check if system reboot is required
stat:
path: /var/run/reboot-required
register: reboot_required
- name: reboot machine
reboot:
reboot_timeout: 3600
when: reboot_required.stat.exists

15
update-os/update.yaml Normal file
View File

@@ -0,0 +1,15 @@
---
- name: Update Systems
hosts: all
tasks:
- name: Run Apt Update and upgrade where needed
apt:
update_cache: yes
upgrade: yes
when: ansible_distribution == 'Debian'
- name: Run APK update and upgrade
apk:
update_cache: yes
upgrade: true
when: ansible_distribution == 'Alpine'

View File

@@ -0,0 +1,25 @@
---
- name: Update to Debian 12
hosts: all
tasks:
- name: Run Pre Update and Upgrade before Dist Upgrade
apt:
update_cache: yes
upgrade: yes
when: ansible_distribution == 'Debian'
- name: Replace "bullseye" with "bookworm" in sources.list
replace:
backup: yes
path: /etc/apt/sources.list
regexp: 'bullseye'
replace: 'bookworm'
when: ansible_distribution == 'Debian'
- name: Replace "bullseye" with "bookworm" in sources.list.d/docker
replace:
backup: yes
path: /etc/apt/sources.list.d/docker.list
regexp: 'bullseye'
replace: 'bookworm'
when: ansible_distribution == 'Debian'

View File

@@ -0,0 +1,16 @@
- name: Update to newest Alpine
hosts: all
tasks:
- name: Run APK update
apk:
update_cache: yes
upgrade: true
when: ansible_distribution == 'Alpine'
- name: Update Alpine versions
replace:
backup: yes
path: "/etc/apk/repositories"
regexp: 'v\d+\.\d+'
replace: 'v3.18'
when: ansible_distribution == 'Alpine'