gpt4 book ai didi

ubuntu - "apt"模块在 Ansible 中停止

转载 作者:行者123 更新时间:2023-12-04 18:41:22 25 4
gpt4 key购买 nike

我正在学习 Ansible,但“apt”模块有问题。
我写了 ansible.cfg 和库存文件,我可以正确运行

ansible testserver -m ping

现在我正在尝试在目标上安装 NGinx,运行
ansible testserver -s -m apt -a name=nginx

但操作停止。这是带有“-vvv”标志的输出
<IP> ESTABLISH CONNECTION FOR USER: user
<IP> REMOTE_MODULE apt name=nginx
<IP> EXEC ['ssh', '-C', '-tt', '-q', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/user/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'ConnectTimeout=10', 'IP', "/bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1445515245.75-119301060889986 && chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1445515245.75-119301060889986 && echo $HOME/.ansible/tmp/ansible-tmp-1445515245.75-119301060889986'"]
<IP> PUT /tmp/tmpWaB4Lf TO /home/user/.ansible/tmp/ansible-tmp-1445515245.75-119301060889986/apt
<IP> EXEC ['ssh', '-C', '-tt', '-q', '-o', 'ControlMaster=auto', '-o', 'ControlPersist=60s', '-o', 'ControlPath=/home/user/.ansible/cp/ansible-ssh-%h-%p-%r', '-o', 'KbdInteractiveAuthentication=no', '-o', 'PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey', '-o', 'PasswordAuthentication=no', '-o', 'ConnectTimeout=10', 'IP', '/bin/sh -c \'sudo -k && sudo -H -S -p "[sudo via ansible, key=gakusrfbokzukkfpfgbvuseekjyqlllu] password: " -u root /bin/sh -c \'"\'"\'echo SUDO-SUCCESS-gakusrfbokzukkfpfgbvuseekjyqlllu; /usr/bin/python /home/user/.ansible/tmp/ansible-tmp-1445515245.75-119301060889986/apt; rm -rf /home/user/.ansible/tmp/ansible-tmp-1445515245.75-119301060889986/ >/dev/null 2>&1\'"\'"\'\'']

你知道问题的根源是什么吗?

谢谢

最佳答案

我注意到您得出的结论是问题出在 sudo 上。只是为了让您知道,您不必在目标机器上启用无密码 sudo。您可以使用 --ask-sudo-pass运行 Ansible playbook 时标记。

关于ubuntu - "apt"模块在 Ansible 中停止,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/33280592/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com