【发布时间】:2016-04-19 18:51:57
【问题描述】:
我正在尝试使用 Ansible 在多个主机上安装 java。
我寻找了一些expect 模块的例子来提供提示的答案。
我认为这种语法很好:
- hosts: datanode
sudo: yes
sudo_user: root
tasks:
- expect:
name: install java jdk 7
command: apt-get install openjdk-7-jdk
responses:
Question:
'Do you want to continue? [Y/n]': 'Y'
但是当我尝试执行 ansible-playbook file.yml 时,我收到了错误:
ERROR! conflicting action statements (expect, command)
The error appears to have been in '/root/scp.yml': line 5, column 5, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
tasks:
- expect:
^ here
问题出在哪里? (我已经安装了ansible 2.0.1.0、pexpect、python)
谢谢!
【问题讨论】:
-
当 Ansible 明显抛出语法错误时,是什么让您认为语法“很好”?
标签: ansible expect ansible-playbook ansible-2.x