Created
May 16, 2024 11:56
-
-
Save kkroesch/5fc71f7222d30882d9bb7e86e2c9ebbc to your computer and use it in GitHub Desktop.
Template Ansible Playbook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- name: Example Ansible Playbook | |
hosts: all | |
become: true | |
vars: | |
paketname: "htop" | |
quellpfad: "/pfad/zur/datei" | |
zielpfad: "/pfad/zum/ziel" | |
tasks: | |
- name: Pakete aktualisieren | |
apt: | |
update_cache: yes | |
when: ansible_os_family == 'Debian' | |
- name: Installiere ein Paket | |
apt: | |
name: "{{ paketname }}" | |
state: present | |
when: ansible_os_family == 'Debian' | |
- name: Kopiere eine Datei | |
copy: | |
src: "{{ quellpfad }}" | |
dest: "{{ zielpfad }}" | |
- name: Starte den Dienst neu | |
service: | |
name: "{{ paketname }}" | |
state: restarted |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment