Useful Ansible commands

Table with Ansible commands I use often:

CommandExplanation
$ ansible-playbook playbook.yml -i ~/inventory/production -e “target=host1”Run a playbook with some common options.
$ ansible-vault encrypt_string ‘secret’ –name ‘foobar’Encrypt a variable.
$ ansible localhost -m debug -a var=’foobar’ -e ‘@inventory/group_vars/all/foobar.yml’Decrypt a variable.
$ ansible-inventory –list -i ./inventory/productionParse the inventory.
$ ansible-galaxy collection install -r requirements.yml –upgradeInstall and upgrade collections from a requirements.yml file.


Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *