Skip to content

Instantly share code, notes, and snippets.

@mbodo
Forked from aleixripoll/ansible-tips.md
Last active March 11, 2019 15:35
Show Gist options
  • Save mbodo/b107bdfd3160c9cfc76db5c33d6f53b2 to your computer and use it in GitHub Desktop.
Save mbodo/b107bdfd3160c9cfc76db5c33d6f53b2 to your computer and use it in GitHub Desktop.
Ansible tips

ansible-playbook useful switches

ansible-playbook -C -D -i <inventory> [-u <ssh-user>] [-e <var=value>] [-t tag1,tag2] [--list-hosts] [-l host1,host2] play.yml

-C check_mode
-D show file diffs

Ad-hoc commands

ansible -i <inventory> <host/hostgroup> -a <command>
EXAMPLE: ansible -i inventory/beta tag_Role_api_socket -a "date"

Gather facts from a host

ansible -m setup -i <inventory> <host>

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment