Ansible 在可能有效的语法上失败
Ansible fails on presumably valid syntax
我在写剧本。有效的语法使 ansible 抱怨
这是我的剧本:
- hosts: tcagents
tasks:
- name: Create temporary dir C:\Tmp\windows-sdk-8.0
win_file: path=C:\TMP\windows-sdk-8.0 state=directory
- name: Copy windows-sdk-8.0/Windows-SDK-8.0.zip file to temporary dir on a node
win_copy:
src: Windows-SDK-8.0.zip
dest: C:\Tmp\windows-sdk-8.0\Windows-SDK-8.0.zip
- name: Unzip C:\TMP\windows-sdk-8.0\Windows-SDK-8.0.zip to C:\TMP\windows-sdk-8.0
win_unzip:
src: C:\TMP\windows-sdk-8.0\Windows-SDK-8.0.zip
dest: C:\TMP\windows-sdk-8.0
- win_command: C:\TMP\windows-sdk-8.0\setup.exe /Quiet /NoRestart
args:
chdir: C:\TMP\windows-sdk-8.0
它在没有最后三行的情况下也能工作,但在最后三行时失败了:
$ ansible-playbook -l windows windows-sdk-8.0/windows-sdk-8.0.yml
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/home/qaexpert/ansible-lab/windows-sdk-8.0/windows-sdk-8.0.yml': line 20, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
dest: C:\TMP\windows-sdk-8.0
- win_command: C:\TMP\windows-sdk-8.0\setup.exe /Quiet /NoRestart
^ here
这里是ansible版本:
$ ansible --version
ansible 2.1.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
请帮忙!
Ansible win_command
版本 2.2 中的新内容,您是 运行 2.1.2
我在写剧本。有效的语法使 ansible 抱怨
这是我的剧本:
- hosts: tcagents
tasks:
- name: Create temporary dir C:\Tmp\windows-sdk-8.0
win_file: path=C:\TMP\windows-sdk-8.0 state=directory
- name: Copy windows-sdk-8.0/Windows-SDK-8.0.zip file to temporary dir on a node
win_copy:
src: Windows-SDK-8.0.zip
dest: C:\Tmp\windows-sdk-8.0\Windows-SDK-8.0.zip
- name: Unzip C:\TMP\windows-sdk-8.0\Windows-SDK-8.0.zip to C:\TMP\windows-sdk-8.0
win_unzip:
src: C:\TMP\windows-sdk-8.0\Windows-SDK-8.0.zip
dest: C:\TMP\windows-sdk-8.0
- win_command: C:\TMP\windows-sdk-8.0\setup.exe /Quiet /NoRestart
args:
chdir: C:\TMP\windows-sdk-8.0
它在没有最后三行的情况下也能工作,但在最后三行时失败了:
$ ansible-playbook -l windows windows-sdk-8.0/windows-sdk-8.0.yml
ERROR! no action detected in task. This often indicates a misspelled module name, or incorrect module path.
The error appears to have been in '/home/qaexpert/ansible-lab/windows-sdk-8.0/windows-sdk-8.0.yml': line 20, column 7, but may
be elsewhere in the file depending on the exact syntax problem.
The offending line appears to be:
dest: C:\TMP\windows-sdk-8.0
- win_command: C:\TMP\windows-sdk-8.0\setup.exe /Quiet /NoRestart
^ here
这里是ansible版本:
$ ansible --version
ansible 2.1.2.0
config file = /etc/ansible/ansible.cfg
configured module search path = Default w/o overrides
请帮忙!
Ansible win_command 版本 2.2 中的新内容,您是 运行 2.1.2