Advertisement
Guest User

Untitled

a guest
Nov 19th, 2017
111
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
YAML 0.81 KB | None | 0 0
  1. - name: Create ec2 instance
  2.   hosts: some-group # getting this value would need to be determined
  3.   gather_facts: no
  4.   tasks:
  5.     - name: create instances
  6.       local_action: ec2
  7.       args:
  8.         key_name: mykey
  9.         instance_type: t2.micro
  10.         image: ami-123456
  11.         wait: yes
  12.         group: webserver
  13.         count: 3
  14.         vpc_subnet_id: subnet-29e63245
  15.         assign_public_ip: yes
  16.  
  17.     - name: wait for ssh to come up
  18.       local_action: wait_for
  19.       args:
  20.         host: "{{ ansible_ssh_host }}"
  21.         state: started
  22.         delay: 10
  23.         timeout: 300
  24.         port: "{{ ansible_ssh_port | default(22) }}"
  25.         search_regex: OpenSSH
  26.  
  27.     - name: gather facts, now that we can connect to instance
  28.       setup:
  29.         gather_subset: all
  30.  
  31.     # should be able to continue on
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement