ansible 普通用户使用 sudo 管理

本贴最后更新于 1635 天前,其中的信息可能已经沧海桑田

hosts 文件

[redis]
# the redis of tyrz
192.168.0.1 ansible_user=tyrz ansible_password=T@369.com ansible_become_user=root ansible_become_password=123456
192.168.0.2 ansible_user=tyrz ansible_password=T@369.com ansible_become_user=root ansible_become_password=123456
192.168.0.3 ansible_user=tyrz ansible_password=T@369.com ansible_become_user=root ansible_become_password=123456

使用:

ansible redis -m shell -a "chage -l tyrz" --become

参考:

ansible tyrz -m shell -a 'chage -E -1 tyrz;chage -M 99999 tyrz' --become
chage -E -1 tyrz;chage -M 99999 tyrz

ansible redis -m shell -a "chage -l tyrz" --become --become-user root [--ask-become-pass]

ansible_become_password=Ysspaas@2019

ansible oldtifsso -m shell -a "ls /root" --become
ansible oldtifsso -m synchronize -a "src=/data/solution/tifsso/page/ dest=/data/solution/tifsso/page/ archive=yes delete=yes" --become

相关帖子

欢迎来到这里!

我们正在构建一个小众社区,大家在这里相互信任,以平等 • 自由 • 奔放的价值观进行分享交流。最终,希望大家能够找到与自己志同道合的伙伴,共同成长。

注册 关于
请输入回帖内容 ...