Skip to content

Instantly share code, notes, and snippets.

@pfuntner
Created April 10, 2025 15:02
Show Gist options
  • Save pfuntner/ff9a039191ba7bdc91a7b85ebfb5f8a6 to your computer and use it in GitHub Desktop.
Save pfuntner/ff9a039191ba7bdc91a7b85ebfb5f8a6 to your computer and use it in GitHub Desktop.
A playbook to demonstrate an Ansible bug
---
- name: Simple playbook for Ubuntu 20 container
hosts: all
gather_facts: false
pre_tasks:
- name: Install Python if not present
raw: 'test -e /usr/bin/python3 || (apt -y update && apt install -y python3)'
register: ansible_install_python_result
changed_when: ansible_install_python_result.stdout
- name: Gather facts (setup module)
setup:
gather_timeout: 60
tasks:
- name: Clean cache (apt)
ansible.builtin.apt:
clean: true
changed_when: false
when: ansible_pkg_mgr == "apt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment