【发布时间】:2015-04-30 11:11:55
【问题描述】:
我正在尝试运行一个非常简单的剧本来测试新的 Ansible 设置。
在我的 ansible.cfg 文件中使用“新”Ansible 权限升级配置选项时:
[defaults]
host_key_checking=false
log_path=./logs/ansible.log
executable=/bin/bash
#callback_plugins=./lib/callback_plugins
######
[privilege_escalation]
become=True
become_method='sudo'
become_user='tstuser01'
become_ask_pass=False
[ssh_connection]
scp_if_ssh=True
我收到以下错误:
fatal: [webserver1.local] => Internal Error: this module does not support running commands via 'sudo'
FATAL: all hosts have already failed -- aborting
剧本也很简单:
# Checks the hosts provisioned by midrange
---
- name: Test su connecting as current user
hosts: all
gather_facts: no
tasks:
- name: "sudo to configued user -- tstuser01"
#action: ping
command: /usr/bin/whoami
我不确定 Ansible 1.9.1 中是否有问题,或者我做错了什么。当然,Ansible 中的“命令”模块允许将命令作为 sudo 运行。
【问题讨论】:
标签: bash sudo ansible ansible-playbook