2017-07-27 168 views
0

我的主机在我的主机上配置 - Linux 16.06 LTS,并且我能够使用ansible windows -m win_ping命令成功地ping我的服务器。从Ansible在Windows上安装IIS

现在即时尝试在我的服务器上安装IIS。我在我的group_vars文件夹中创建了一个名为installIIS.yml的YAML文件。

--- 
- name: Install IIS 
    hosts: windows 
    gather_facts: true 
    tasks: 
    - win_feature: 
    name: "windows" 
    state: present 
    restart: yes 
    include_sub_features: yes 
    include_management_tools: yes 

和IM通过运行YML文件:[email protected]:/etc/ansible# ansible-playbook group_vars/installIIS.yml

和我收到的错误是

ERROR! 'include_sub_features' is not a valid attribute for a Task 

The error appears to have been in '/etc/ansible/group_vars/installIIS.yml': line 6, column 6, but may 
be elsewhere in the file depending on the exact syntax problem. 

The offending line appears to be: 

    tasks: 
    - win_feature: 
    ^here 

对此任何帮助。我也想安装杀毒软件,tripwire,并且还要检查windows的更新。

/etc/ansible# tree 
. 
├── ansible.cfg 
├── group_vars 
│   ├── installIIS.yml 
│   ├── linux.yml 
│   └── windows.yml 
├── hosts 
└── roles 

对此有任何帮助或链接。先谢谢你。

回答

1

我认为问题在于你指定win_feature选项的缩进级别。这些选项应该在win_feature模块下缩进,而不是在同一层上。

例如:

--- 
- name: Install IIS 
    hosts: windows 
    gather_facts: true 
    tasks: 
    - win_feature: 
     name: "windows" 
     state: present 
     restart: yes 
     include_sub_features: yes 
     include_management_tools: yes