2017-07-27 164 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