Advertisement
Guest User

Untitled

a guest
Jun 9th, 2017
76
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.28 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: display instance details
  19. debug: "msg={{ instance_details }}"
  20. - name: getting windows password
  21. ec2_win_password:
  22. instance_id: "{{ instance_details.instances[0].id }}"
  23. key_file: "/media/psf/Home/Documents/Kloud/MyWindowsKey.pem"
  24. wait: yes
  25. region: "{{ aws_region }}"
  26. register: win_password_output
  27. - name: adding host to inventory
  28. add_host:
  29. name: windows_test_host
  30. ansible_host: "{{ instance_details.instances[0].public_dns_name }}"
  31. ansible_password: "{{ win_password_output.win_password }}"
  32. groups: ec2_windows
  33. ansible_winrm_server_cert_validation: ignore
  34. ansible_connection: 'winrm'
  35. ansible_user: Administrator
  36. ansible_port: 5986
  37.  
  38. - hosts: windows_test_host
  39. roles:
  40. - webserver
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement