简体   繁体   中英

Ansible adhoc command with sudo

I'm tried to execute this command:

ansible somegroup -m raw -a "docker ps -a" --ask-pass -K --become-user root

But the error is:

Got permission denied while trying to connect to the Docker daemon socket at unix:///var/run/docker.sock:

How to correct set directives of ansible adhoc to execute under root using sudo su - ?

忘记使用- --become开关:

ansible somegroup -m raw -a "docker ps -a" --ask-pass -K --become
ansible somegroup -m raw -a "docker ps -a" --ask-pass -K --become

-m = This is raw,

-a = To run ad-hoc command,

--ask-pass = ssh password,

-K --become = To become root or sudo,

You can read more on "How to use Ansible"

ansible somegroup -b -m raw -a "docker ps -a" 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM