Skip to content

Instantly share code, notes, and snippets.

@rgl
Last active January 19, 2020 21:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save rgl/c3de8d62d4344e7379b7ba57d51e7349 to your computer and use it in GitHub Desktop.
Save rgl/c3de8d62d4344e7379b7ba57d51e7349 to your computer and use it in GitHub Desktop.
Ansible Notes

Quick start:

cat >inventory.yml <<'EOF'
all:
  children:
    idrac:
      hosts:
        esxi[1:3]-idrac.example:
        # you can also override a specific host properties:
        #esxi3-idrac.example:
        #  idrac_user: drac
      vars:
        idrac_user: root
        idrac_password: toor
EOF
cat >playbook.yml <<'EOF'
- hosts: idrac
  connection: local
  name: Example
  gather_facts: no
  tasks:
    - name: Ping
      ping:
EOF
cat >ansible.cfg <<'EOF'
[defaults]
inventory = inventory.yml
EOF
ansible-doc -l # list all the available modules
ansible-inventory --list --yaml
ansible-lint playbook.yml
ansible-playbook playbook.yml --syntax-check
ansible-playbook playbook.yml --list-hosts
ansible-playbook playbook.yml -f 10 -vvv

Reference

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