This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ tree | |
. | |
├── ansible.cfg | |
├── colletions | |
├── hosts | |
├── playbooks | |
│ ├── miscelanius | |
│ ├── monitoring | |
│ ├── network | |
│ ├── packages |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
#group for local machine | |
local: | |
hosts: | |
localhost: | |
ansible_connection: local | |
ansible_python_interpreter: /usr/bin/python | |
gather_facts: false | |
... |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ansible dell -m ping | |
localhosts | SUCCESS => { | |
"changed": false, | |
"ping": "pong" | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ansible all -m ping | |
localhosts | SUCCESS => { | |
"changed": false, | |
"ping": "pong" | |
} | |
localhost | SUCCESS => { | |
"ansible_facts": { | |
"discovered_interpreter_python": "/usr/bin/python3" | |
}, | |
"changed": false, |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ansible local -m copy -a "src=/etc/ansible/hosts dest=/tmp" | |
localhost | CHANGED => { | |
"ansible_facts": { | |
"discovered_interpreter_python": "/usr/bin/python3" | |
}, | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# ansible-playbook install_docker.yml --list-hosts | |
playbook: install_docker.yml | |
play #1 (localhost): my playbook TAGS: [Docker] | |
pattern: ['localhost'] | |
hosts (1): | |
localhost |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ansible-playbook install_docker.yml --list-tasks | |
playbook: install_docker.yml | |
play #1 (localhost): my playbook TAGS: [Docker] | |
tasks: | |
Update all packages to their latest version TAGS: [Docker] | |
Install Docker on the machine TAGS: [Docker] | |
Ensure Docker is running TAGS: [Docker] |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ansible-playbook install_docker.yml --syntax-check | |
playbook: install_docker.yml |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ansible-playbook playbooks/install_docker.yml --start-at-task="Ensure Docker is running" | |
PLAY [my playbook] ******************************************************************************************************************************************************* | |
TASK [Ensure Docker is running] ****************************************************************************************************************************************** | |
ok: [localhost] | |
PLAY RECAP *************************************************************************************************************************************************************** | |
localhost : ok=1 changed=0 unreachable=0 failed=0 skipped=0 rescued=0 ignored=0 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ ansible-playbook playbooks/install_docker.yml -vvv | |
ansible-playbook 2.10.8 | |
config file = /etc/ansible/ansible.cfg | |
configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules'] | |
ansible python module location = /usr/lib/python3/dist-packages/ansible | |
executable location = /usr/bin/ansible-playbook | |
python version = 3.9.7 (default, Sep 10 2021, 14:59:43) [GCC 11.2.0] | |
Using /etc/ansible/ansible.cfg as config file | |
host_list declined parsing /etc/ansible/hosts as it did not pass its verify_file() method | |
script declined parsing /etc/ansible/hosts as it did not pass its verify_file() method |