Notes/docs/Command Snippets/Ansible Snippets.md
Keannu Bernasol f359c7ae0e vault backup: 2024-10-25 21:35:23
Affected files:
docs/Command Snippets/Ansible Snippets.md
docs/Command Snippets/Docker - Miscellaneous.md
2024-10-25 21:35:23 +08:00

821 B

  • WSL Fix for world-writable directories
export ANSIBLE_CONFIG=./ansible.cfg
  • Ping
ansible all -m ping
  • Gather facts
ansible all -m gather_facts

# Limit to one device
ansible all -m gather_facts --limit ADDRESS
  • Elevate command to root user
# This will fail without sudo
ansible all -m apt -a update_cache=true

# This will succeed
# Equivalent to sudo apt-update
ansible all -m apt -a update_cache=true --become --ask-become-me-pass
  • Install packages
ansible all -m apt -a name=vim --become --ask-become-pass
  • Install/Update Package (multiple arguments)
ansible all -m apt -a "name=vim state=latest" --become --ask-become-pass
  • sudo apt update equivalent
ansible all -m apt -a "name=apt state=latest" --become --ask-become-pass