Skip to content

Instantly share code, notes, and snippets.

@JayDoubleu
Created January 11, 2021 19:25
Show Gist options
  • Save JayDoubleu/ab08876489dabd6244e652e16c935f9d to your computer and use it in GitHub Desktop.
Save JayDoubleu/ab08876489dabd6244e652e16c935f9d to your computer and use it in GitHub Desktop.
Ansible update toolbox
- hosts: localhost
connection: local
tasks:
- name: Gather facts on a specific container
containers.podman.podman_container_info:
name:
- fedora-toolbox-33
- fedora-toolbox-34
register: toolbox_facts
- name: Add toolbox as ansible host
ansible.builtin.add_host:
name: "{{ item.Name }}"
ansible_host: "{{ item.Id }}"
ansible_python_interpreter: /usr/bin/python3
groups: toolbox
changed_when: false
loop: "{{ toolbox_facts.containers }}"
- hosts: toolbox
connection: podman
tasks:
- name: Run full system update on each toolbox container
ansible.builtin.dnf:
name: "*"
state: latest
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment