You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

33 lines
816 B

  1. ---
  2. - hosts: localhost
  3. sudo: False
  4. gather_facts: False
  5. tasks:
  6. - name: Provision a set of instances
  7. ec2:
  8. key_name: "{{ aws.key_name }}"
  9. aws_access_key: "{{ aws.access_key }}"
  10. aws_secret_key: "{{ aws.secret_key }}"
  11. region: "{{ aws.region }}"
  12. group_id: "{{ aws.group}}"
  13. instance_type: "{{ aws.instance_type}}"
  14. image: "{{ aws.ami_id }}"
  15. wait: true
  16. count: "{{ aws.count }}"
  17. instance_tags: "{{ aws.tags }}"
  18. register: ec2
  19. - name: Template the inventory
  20. template:
  21. src: ../templates/inventory-aws.j2
  22. dest: "{{ inventory_path }}"
  23. - name: Wait until SSH is available
  24. local_action:
  25. module: wait_for
  26. host: "{{ item.public_ip }}"
  27. port: 22
  28. timeout: 300
  29. state: started
  30. with_items: ec2.instances