123456789101112131415161718192021222324252627282930 |
- ---
- -
- connection: local
- gather_facts: false
- hosts: localhost
- tasks:
- -
- ec2:
- count: 4
- image: ami-0cca6df87334a74bd
- instance_tags:
- type: webinar
- system: wordpress
- instance_type: t2.micro
- key_name: webinar
- wait: true
- name: "create machine"
- register: ec2
-
-
- -
- name: run ssh-keyscan to add keys to known_hosts
- shell: ssh-keyscan {{ item.public_ip }} >> /home/ubuntu/.ssh/known_hosts
- with_items: "{{ ec2.instances }}"
- -
- name: Print ips
- debug:
- msg: "{{ item.public_ip }}"
- with_items: "{{ ec2.instances }}"
|