KB: Ansible test connection
- Test node connection from ansible controller
- You can use the Ansible cli with -m ping or -m win_ping to test the node connection
- (if it's a container/awx) -> Connect to the awx_task container "docker exec -it awx_task bash".
- edit the vi "/etc/ansible/hosts" file, add the test node in the file (anywhere is fine) then don't forget to remove it after the test is done.
- then run this test command(s). (Replace the values inside the brackets <x> as needed.)
- (to test a linux machine):
ansible <target-node-name> -m ping -u '<username>' --ask-pass - #TODO windows
- (to test a linux machine):
- Next test with become=yes (SUDO) elevated:
- ansible <target-node> -m ping -u 'autoadm' --ask-pass -b -become-user=root -K
- next test facts (setup) module
- ansible <target-node> -m setup -u 'autoadm' --ask-pass -b -become-user=root -K
References:
https://docs.ansible.com/archive/ansible/2.3/become.html
Comments
Post a Comment