Guest User

Untitled

a guest
Jan 22nd, 2018
32
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.22 KB | None | 0 0
  1. ---
  2. - hosts: localhost
  3. vars:
  4. - aws_region: "ap-southeast-2"
  5. tasks:
  6. - name: launch Windows Ansible Test cloudformation stack
  7. cloudformation:
  8. stack_name: "AnsibleWindowsTest1"
  9. region: "{{ aws_region }}"
  10. state: "present"
  11. template: "windows_template.yml"
  12. - ec2_remote_facts:
  13. filters:
  14. instance-state-name: running
  15. "tag:Name": WindowsAnsibleTest
  16. region: "{{ aws_region }}"
  17. register: instance_details
  18. - name: getting windows password
  19. ec2_win_password:
  20. instance_id: "{{ instance_details.instances[0].id }}"
  21. key_file: "{{ windows_aws_key_file }}"
  22. wait: yes
  23. region: "{{ aws_region }}"
  24. register: win_password_output
  25. - name: adding host to inventory
  26. add_host:
  27. name: windows_test_host
  28. ansible_host: "{{ instance_details.instances[0].public_dns_name }}"
  29. ansible_password: "{{ win_password_output.win_password }}"
  30. groups: ec2_windows
  31. ansible_winrm_server_cert_validation: ignore
  32. ansible_connection: 'winrm'
  33. ansible_user: Administrator
  34. ansible_port: 5986
  35.  
  36. - hosts: windows_test_host
  37. roles:
  38. - webserver
Add Comment
Please, Sign In to add comment