diff --git a/README.md b/README.md deleted file mode 100644 index f0a5b6a..0000000 --- a/README.md +++ /dev/null @@ -1,2 +0,0 @@ -# sema - diff --git a/README.org b/README.org new file mode 100644 index 0000000..5dd4680 --- /dev/null +++ b/README.org @@ -0,0 +1,70 @@ +#+title: Semaphore playbooks +#+AUTHOR: Manuel Prinz +#+date: 25.12.2025 + +* Inhalt :toc: +- [[#einleitung][Einleitung]] +- [[#playbooks][Playbooks]] + - [[#update-ubuntu][Update Ubuntu]] + - [[#test-cmd][Test cmd]] + +* Einleitung +* Playbooks +** Update Ubuntu +#+begin_src yaml :tangle ubuupdate.yml +--- +- name: Update ubuserver + hosts: ubuserver + become: true + tasks: + # Update and install the base software + - name: Update and upgrade + ansible.builtin.apt: + autoclean: yes + update_cache: yes + cache_valid_time: 3600 + upgrade: dist + + - name: Remove dependencies that are no longer required and purge their configuration files + ansible.builtin.apt: + autoremove: yes + purge: true + + - command: apt clean + #become: yes + + - name: Check if a reboot is needed for Debian and Ubuntu boxes + register: reboot_required_file + stat: path=/var/run/reboot-required get_md5=no + + - name: Reboot the box if kernel updated + reboot: + msg: "Reboot initiated by Ansible for kernel updates" + connect_timeout: 5 + reboot_timeout: 300 + pre_reboot_delay: 0 + post_reboot_delay: 30 + test_command: uptime + when: reboot_required_file.stat.exists +#+end_src + +** Test cmd +Hier mal bissl was zum Spielen: + +#+begin_src yaml :tangle testcmd.yml +--- +- name: Spielwiese + hosts: dockerserver + tasks: + - name: Container present + docker_container: + name: ansible-mysql-1 + state: present + image: mysql:8.0 + command: sleep infinity + + - name: Stop a container + docker_container: + name: ansible-mysql-1 + state: stopped +#+end_src diff --git a/testcmd.yml b/testcmd.yml new file mode 100644 index 0000000..697da81 --- /dev/null +++ b/testcmd.yml @@ -0,0 +1,15 @@ +--- +- name: Spielwiese + hosts: dockerserver + tasks: + - name: Container present + docker_container: + name: ansible-mysql-1 + state: present + image: mysql:8.0 + command: sleep infinity + + - name: Stop a container + docker_container: + name: ansible-mysql-1 + state: stopped diff --git a/ubuupdate.yml b/ubuupdate.yml new file mode 100644 index 0000000..ea700dc --- /dev/null +++ b/ubuupdate.yml @@ -0,0 +1,34 @@ +--- +- name: Update ubuserver + hosts: ubuserver + become: true + tasks: + # Update and install the base software + - name: Update and upgrade + ansible.builtin.apt: + autoclean: yes + update_cache: yes + cache_valid_time: 3600 + upgrade: dist + + - name: Remove dependencies that are no longer required and purge their configuration files + ansible.builtin.apt: + autoremove: yes + purge: true + + - command: apt clean + #become: yes + + - name: Check if a reboot is needed for Debian and Ubuntu boxes + register: reboot_required_file + stat: path=/var/run/reboot-required get_md5=no + + - name: Reboot the box if kernel updated + reboot: + msg: "Reboot initiated by Ansible for kernel updates" + connect_timeout: 5 + reboot_timeout: 300 + pre_reboot_delay: 0 + post_reboot_delay: 30 + test_command: uptime + when: reboot_required_file.stat.exists