· 7 years ago · Jun 26, 2018, 07:22 AM
1[GRAYLOG_SERVERS]
2graylog-master ansible_host=1.1.1.1 disk_size=50 instance_type=t2.small
3graylog-slave ansible-host=1.1.1.2 disk_size=50 instance_type=t2.small
4[GRAYLOG_SERVERS:vars]
5var=foo
6elb=bla
7
8- name: lunching instance
9 ec2:
10 aws_access_key: "{{ access_key }}"
11 aws_secret_key: "{{ secret_key }}"
12 key_name: "{{ ec2_keypair }}"
13 group_id: "{{ target_security_groups }}"
14 instance_type: "{{ instance_type }}"
15 image: "{{ target_ami }}"
16 vpc_subnet_id: "{{ instance_subnet_id }}"
17 region: "{{ aws_region }}"
18 instance_tags: '{"Name":"{{ec2_tag_Name}}","Product":"{{ec2_tag_Product}}","Environment":"{{ec2_tag_Environment}}"}'
19 private_ip: "{{ ansible_host }}"
20 exact_count: 1
21 count_tag: '{"Name":"{{ec2_tag_Name}}","Product":"{{ec2_tag_Product}}","Environment":"{{ec2_tag_Environment}}"}'
22 assign_public_ip: no
23 wait: true
24 volumes:
25 - device_name: "{{ device_name }}"
26 device_type: "{{ device_type }}"
27 volume_size: "{{ disk_size }}"
28 delete_on_termination: true
29 delegate_to: localhost
30 when: ec2_image is defined or ami_id is defined
31 register: ec2