Skip to content

Instantly share code, notes, and snippets.

@kkroesch
Created May 16, 2024 11:56
Show Gist options
  • Save kkroesch/5fc71f7222d30882d9bb7e86e2c9ebbc to your computer and use it in GitHub Desktop.
Save kkroesch/5fc71f7222d30882d9bb7e86e2c9ebbc to your computer and use it in GitHub Desktop.
Template Ansible Playbook
---
- 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