Skip to content

Instantly share code, notes, and snippets.

@mschmitt
Created February 24, 2025 09:30
Show Gist options
  • Save mschmitt/4c4db31224b8115073dc5e1bac7ee750 to your computer and use it in GitHub Desktop.
Save mschmitt/4c4db31224b8115073dc5e1bac7ee750 to your computer and use it in GitHub Desktop.
Ansible Hausaufgabenhilfe
#!/usr/bin/env ansible-playbook
---
- hosts: localhost
gather_facts: true
connection: local
tasks:
- name: Do some things
block:
- name: A few non-invasive apt actions
apt:
name:
- bash
- openssl
register: result_one
- name: Some that might produce interesting output
shell: iptables -L; ip6tables -L
register: result_two
- name: Some other random thing, but it will fail
systemd_service:
name: dummy.service
enabled: false
register: result_three
always:
- name: Show results
debug:
var: item
with_items:
- "{{ result_one }}"
- "{{ result_two }}"
- "{{ result_three }}"
# vim: filetype=yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment