ansible_intro
Running ansible playbook
To run an ansible playbook you can run the following command:
# ansible-playbook -s playbook.yml
Option | Description |
---|---|
-s, –sudo | Force all plays to use sudo, even if not marked as such |
Running script locally
By default ansible will run against the hosts in the following file: /etc/ansible/hosts
If you wish to install and then run ansible playbooks on your local machine/directly on the server-in-question, you can define the following at the top of your playbook:
--- - hosts: 127.0.0.1 connection: local
You can also run ansible commands locally with the following command:
# ansible localhost -a "/bin/echo hello" localhost | success | rc=0 >> hello
ansible_intro.txt · Last modified: 2024/05/23 07:26 by 127.0.0.1