fatal: [localhost]: FAILED! => {
"changed": false,
"failed": true,
"module_stderr": "",
"module_stdout": "",
"msg": "MODULE FAILURE",
"rc": 0
}--- # Install IIS Web-Server
- hosts: localhost
connection: local
remote_user: test
become: yes
gather_facts: no
vars_files:
- files/awscreds.yml
tasks:
- name: Basic provisioning of two t2.micro EC2 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
- name: Install IIS Web-Server with sub features and management tools
win_feature:
name: Web-Server
state: present
restart: True
include_sub_features: True
include_management_tools: Trueec2 module to add the new host to the inventory.--- # 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
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
---
- name: provision new EC2 server
hosts: localhost
gather_facts: no
tasks:
- name: provision t2.micro EC2 instance
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
register: ec2_details
- name: add new t2.micro EC2 instance to Windows group
add_host:
name: '{{item.public_ip}}'
groups: windows
with_items: '{{ec2_details.instances}}'
- name: install features on new EC2 server
hosts: windows
gather_facts: no
tasks:
- name: wait for connection to be online
wait_for_connection:
- name: install IIS Web-Server with sub features and management tools
win_feature:
name: Web-Server
state: present
include_sub_features: yes
include_management_features: yes
register: feature_install
- name: reboot if feature install requires it
win_reboot:
when: feature_install.reboot_required