Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ansible ec2 module is deprecated #29

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 14 additions & 10 deletions kinto/kinto-setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,32 +19,36 @@
when: (prodenv is not defined) or ((prodenv != "stage") and (prodenv != "prod"))

- name: Create EC2 instances.
ec2:
ec2_instance:
key_name: tb-amo-ops-key
region: us-west-2
groups:
security_groups:
- add-ssh
- kinto-web-backend
instance_type: c5.xlarge
image: ami-0157b1e4eefd91fd7
image_id: ami-0157b1e4eefd91fd7
exact_count: 2
count_tag:
Name: "kinto-web-{{ prodenv }}"
instance_tags:
Name: "kinto-web-{{ prodenv }}"
filters:
"tag:Name": "kinto-web-{{ prodenv }}"
name: "kinto-web-{{ prodenv }}"
wait: yes
vpc_subnet_id: subnet-35f0477d
assign_public_ip: yes
network:
assign_public_ip: yes
volumes:
- device_name: /dev/sda1
volume_type: gp2
volume_size: 200
delete_on_termination: true
register: ec2

- name: Add all instance hostnames to host group
# If we created any new instances, add them to the hosts group so later
# tasks against the hosts group will find it. Existing hosts will
# already be in the group from inventory.
- name: Add new instance hostnames to host group
add_host: hostname={{ item.public_dns_name }} groups=aws_ec2_kinto_web_{{ prodenv }}
loop: "{{ ec2.tagged_instances }}"
loop: "{{ ec2.instances }}"
when: ec2.instances is defined

- name: Show ec2 data
debug:
Expand Down