create.yml 558 B

123456789101112131415161718192021222324
  1. ---
  2. -
  3. connection: local
  4. gather_facts: false
  5. hosts: localhost
  6. tasks:
  7. -
  8. ec2:
  9. count: 3
  10. image: ami-0cca6df87334a74bd
  11. instance_tags:
  12. type: webinar
  13. system: example
  14. third_tag: 3
  15. instance_type: t2.micro
  16. key_name: webinar
  17. wait: true
  18. name: "create machine"
  19. register: ec2
  20. -
  21. name: run ssh-keyscan to add keys to known_hosts
  22. local_action: shell ssh-keyscan {{ item.public_ip }} >> ~/.ssh/known_hosts
  23. with_items: "{{ ec2.instances }}"