【问题标题】:Installing IIS on Windows from Ansible从 Ansible 在 Windows 上安装 IIS
【发布时间】:2017-07-27 08:47:20
【问题描述】:

我的 ansible 已在我的主机上配置 - Linux 16.06 LTS,我可以使用 ansible windows -m win_ping 命令成功地 ping 我的服务器。

现在我正在尝试在我的服务器上安装 IIS。我在名为 installIIS.yml 的 group_vars 文件夹中创建了一个 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

我通过以下方式运行 yml 文件:root@SAUPRDSVR01:/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 并从 ansible 检查 Windows 更新。

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

任何帮助或链接。先感谢您。

【问题讨论】:

    标签: linux windows ansible yaml


    【解决方案1】:

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

    示例:

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

    win_feature 参考文档

    【讨论】:

      【解决方案2】:

      如果您正在安装 IIS,那么 win_feature 的名称应该是正确的:

      • 名称:安装 IIS 主机:窗户 收集事实:真 任务:
        • win_feature: 名称:网络服务器 状态:现在 重启:是 include_sub_features:是的 include_management_tools:是的

      【讨论】:

      • 只提交唯一的答案。如果有人已经在您之前发布了类似的答案,而不是支持该人以鼓励他的努力
      猜你喜欢
      • 2021-10-08
      • 2018-12-12
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2022-12-19
      • 2012-06-17
      • 2013-06-05
      相关资源
      最近更新 更多