具有根提升的 Ansible shell 命令
Ansible shell comand with root elevation
我使用以下命令在我的机器中搜索特定数据:
ansible -i [inventory_name].inventory [inventory group] -m shell -a "grep 'PermitRootLogin' /etc/ssh/sshd_config"
但是现在,我需要将用户提升为根用户(以查看文件的内容)。有可能在同一个命令行中吗?我该怎么做?
ansible --help
建议:
Privilege Escalation Options:
-b, --become run operations with become (does not imply password
prompting)
我使用以下命令在我的机器中搜索特定数据:
ansible -i [inventory_name].inventory [inventory group] -m shell -a "grep 'PermitRootLogin' /etc/ssh/sshd_config"
但是现在,我需要将用户提升为根用户(以查看文件的内容)。有可能在同一个命令行中吗?我该怎么做?
ansible --help
建议:
Privilege Escalation Options:
-b, --become run operations with become (does not imply password prompting)