Created
April 10, 2025 15:02
-
-
Save pfuntner/ff9a039191ba7bdc91a7b85ebfb5f8a6 to your computer and use it in GitHub Desktop.
A playbook to demonstrate an Ansible bug
This file contains hidden or 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: 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