Ansible Cheatsheet
Ping machine
ansible -i ./inventory/hosts <group_name> -m <command> --user <server_user> --ask-passPassword prompt with apk-pass
Note that this is not safe, usually better to use SSH Keys
ansible -i ~/ansible/inventory servers -m ping --user root --ask-passPlaybook run:
To run playbook:
ansible-playbook ~/ansible/playbooks/<playbook_name> --user <server_user> --ask-pass --ask-become-pass -i ~/ansible/inventoryTo run playbook and become super user:
To run playbook with specific key use args: --key-file
To run playbook for ssh autorized_keys:
To check playbook syntax use:
To check the playbook tags use:
To execute playbook with tags use:
To execute multiple tags:
To execute playbook for specific groups, you have to provide the hosts file like so:
The playbook must include the group required to run this:
To roll out specific hosts file with specific user and user password run:
Last updated