Re: [ansible-project] ansible -a sudo command hangs

2022-02-11 Thread Brian Coca
simplest way would be in inventory https://docs.ansible.com/ansible/latest/user_guide/intro_inventory.html#connecting-to-hosts-behavioral-inventory-parameters -- -- Brian Coca -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsub

Re: [ansible-project] ansible -a sudo command hangs

2022-02-11 Thread Tony Wong
thank you. that works. how do i save the users password and the become pass? like I want to run ansible -a "systemctl status docker" myhosts -i hosts --become On Thu, Feb 10, 2022 at 2:55 PM Brian Coca wrote: > try this instead: > > ansible -a "systemctl status docker" -i hosts -u user --ask-

Re: [ansible-project] ansible -a sudo command hangs

2022-02-10 Thread Brian Coca
try this instead: ansible -a "systemctl status docker" -i hosts -u user --ask-pass -K --become Adding (--become) makes ansible responsible for executing sudo (default become method) and passing in a password if needed (-K prompts you ahead of time for the sudo password) -- -- Brian Co

Re: [ansible-project] ansible -a sudo command hangs

2022-02-10 Thread Alex Wanderley
Hello, Yes, I have a clue: check your sudo configuration. Very likely your sudo is set up in a way it is requiring an TTY for command executions. When Ansible sends a command it uses ssh, which usually does not provide a TTY. Alex On Thu, Feb 10, 2022 at 12:31 PM Tony Wong wrote: > I am trying

[ansible-project] ansible -a sudo command hangs

2022-02-10 Thread Tony Wong
I am trying to run remote commands on few servers ansible -a "df -h" myservers -i hosts -u "user" --assk-pass this works but when i do ansible -a "sudo systemctl status docker" -i hosts -u "user --ask-pass then i enter my password it just hangs any idea? -- You received this message becau