Tarvinder
Tarvinder

Reputation: 43

Installing IIS on Windows from Ansible

My ansible is configured on my host machine - Linux 16.06 LTS and i am successfully able to ping my server using the ansible windows -m win_ping command.

Now im trying to install IIS on my server. I have created a YAML file in my group_vars folder called installIIS.yml.

---
- 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

and im running the yml file by: root@SAUPRDSVR01:/etc/ansible# ansible-playbook group_vars/installIIS.yml

and the error i received is

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

Any help regarding this. I would also like to install antivirus, tripwire and also check for windows updates from ansible.

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

Any help or links for this. Thank you in advance.

Upvotes: 2

Views: 11545

Answers (1)

T.J. Telan
T.J. Telan

Reputation: 111

I think the issue is the indent level where you are specifying the options for win_feature. The options should be indented under the win_feature module, as opposed to on the same level.

example:

---
- 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 documentation for the reference

Upvotes: 7

Related Questions