Created
May 29, 2018 16:35
-
-
Save wrouesnel/ae6901f65ed5b0c3f65a51965a943223 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Ansible playbook to use a transient EC2 image to build the container | |
- name: Creating a disposable worker | |
hosts: localhost | |
connection: local | |
tasks: | |
- name: locating latest docker host AMI | |
ec2_ami_find: | |
region: eu-central-1 | |
owner: self | |
name: debian-8-docker-* | |
sort: name | |
sort_end: 1 | |
no_result_action: fail | |
register: ami_find | |
- name: deploying temporary instance | |
ec2: | |
region: eu-central-1 | |
key_name: "root_key" | |
image: "{{ ami_find.results[0].ami_id }}" | |
instance_type: t2.micro | |
instance_tags: | |
role: docker-build-instance | |
wait: true | |
wait_timeout: 600 | |
register: ec2result | |
- add_host: name={{ ec2result.instances[0].private_ip }} groups=workers |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment