I updated the playbook. I added a second play to target the new Windows 
host and some further steps after the ec2 module to add the new host to the 
inventory.

However, I'm still getting the same error. The  task is failing.

*Updated Playbook:*

--- # EC2 MODULE - PROVISIONING EXAMPLE

- hosts: localhost

  connection: local

  remote_user: test

  become: yes

  gather_facts: no

  vars_files:

  - files/awscreds.yml

  tasks:

  - name: Provision of a set of Windows instances

    ec2:

      aws_access_key: "{{ aws_id }}"

      aws_secret_key: "{{ aws_key }}"

      region: "{{ aws_region }}"

      image: ami-e3bb7399

      instance_type: t2.micro

      count: 1

      vpc_subnet_id: subnet-112b2c3d

      assign_public_ip: yes

      count_tag:

            Name: CountTagDemo

      instance_tags:

        Name: WinDemo

    register: ec2


  - name: Print the results

    debug: var=item

    with_items: ec2.instances


  - name: Add all instance public IPs to host group

    add_host: hostname={{ item.public_ip }} groups=windows

    with_items: "{{ ec2.instances }}"


  - name: Wait for the instances to boot

    wait_for: state=started

    with_items: ec2.instances


- hosts: windows

  connection: local

  remote_user: test

  become: yes

  gather_facts: no

  vars_files:

  - files/awscreds.yml


  tasks:

  - name: Install IIS

    win_feature:

      name: "Web-Server"

      state: present

      restart: true

      include_sub_features: yes

      include_management_tools: yes


*Error Message:*

TASK [Install IIS] 
***********************************************************************

*task path: /home/test/Playbooks/awsec2win_provision.yml:47*

Using module file 
/usr/lib/python2.7/site-packages/ansible-2.5.0-py2.7.egg/ansible/modules/windows/win_feature.py

<> ESTABLISH LOCAL CONNECTION FOR USER: test

<> EXEC /bin/sh -c 'echo ~ && sleep 0'

<> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo 
/home/test/.ansible/tmp/ansible-tmp-1510010700.13-143481769279149 `" && 
echo ansible-tmp-1510010700.13-143481769279149="` echo 
/home/test/.ansible/tmp/ansible-tmp-1510010700.13-143481769279149 `" ) && 
sleep 0'

<> PUT /tmp/tmpfvOE2z TO 
/home/test/.ansible/tmp/ansible-tmp-1510010700.13-143481769279149/win_feature.py

<> PUT /tmp/tmpzqtpyD TO 
/home/test/.ansible/tmp/ansible-tmp-1510010700.13-143481769279149/args

<> EXEC /bin/sh -c 'chmod u+x 
/home/test/.ansible/tmp/ansible-tmp-1510010700.13-143481769279149/ 
/home/test/.ansible/tmp/ansible-tmp-1510010700.13-143481769279149/win_feature.py
 
/home/test/.ansible/tmp/ansible-tmp-1510010700.13-143481769279149/args && 
sleep 0'

<> EXEC /bin/sh -c 'sudo -H -S -n -u root /bin/sh -c '"'"'echo 
BECOME-SUCCESS-fsnrdknpojaqmlsccnjclmrmrbdzokmc; /usr/bin/python 
/home/test/.ansible/tmp/ansible-tmp-1510010700.13-143481769279149/win_feature.py
 
/home/test/.ansible/tmp/ansible-tmp-1510010700.13-143481769279149/args; rm 
-rf "/home/test/.ansible/tmp/ansible-tmp-1510010700.13-143481769279149/" > 
/dev/null 2>&1'"'"' && sleep 0'

fatal: []: FAILED! => {

    "changed": false, 

    "failed": true, 

    "module_stderr": "", 

    "module_stdout": "", 

    "msg": "MODULE FAILURE", 

    "rc": 0

}

to retry, use: --limit @/home/test/Playbooks/awsec2win_provision.retry


PLAY RECAP *************************************************************

                           : ok=0    changed=0    unreachable=0    failed=1  
 

localhost                  : ok=4    changed=2    unreachable=0    failed=0


Could you please advise if the playbook is correct or how it should be 
modified to install IIS server?
Thank you.



-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/5b86a303-dbbd-4b5e-940f-b72460fc267e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to