From 70f0a522b005dd02d864143b92921d3ff1323ee1 Mon Sep 17 00:00:00 2001 From: Seth Vidal Date: Tue, 30 Oct 2012 22:12:48 +0000 Subject: [PATCH] first cut of the playbook to create and provision any instance --- playbooks/el6-temp-instance.yml | 33 +++++++++++++++++++++++++++++++++ tasks/transient_cloud.yml | 15 +++++++++++++++ 2 files changed, 48 insertions(+) create mode 100644 playbooks/el6-temp-instance.yml create mode 100644 tasks/transient_cloud.yml diff --git a/playbooks/el6-temp-instance.yml b/playbooks/el6-temp-instance.yml new file mode 100644 index 0000000000..41d9b77a55 --- /dev/null +++ b/playbooks/el6-temp-instance.yml @@ -0,0 +1,33 @@ +- name: check/create instance + hosts: lockbox01.phx2.fedoraproject.org + user: root + gather_facts: False + + vars_files: + - /srv/web/infra/ansible/vars/global.yml + - ${private}/vars.yml + vars: + - keypair: admin + - image: emi-B8793915 + - instance_type: m1.large + - security_group: default + + tasks: + - include: $tasks/transient_cloud.yml + +- name: provision instance + hosts: tmp_just_created + user: root + gather_facts: True + + vars_files: + - /srv/web/infra/ansible/vars/global.yml + - ${private}/vars.yml + - ${vars}/${ansible_distribution}.yml + + tasks: + - include: $tasks/cloud_setup_basic.yml + + + handlers: + - include: $handlers/restart_services.yml diff --git a/tasks/transient_cloud.yml b/tasks/transient_cloud.yml new file mode 100644 index 0000000000..87e94514e6 --- /dev/null +++ b/tasks/transient_cloud.yml @@ -0,0 +1,15 @@ +--- +- name: spin it up + local_action: ec2_create keypair=${keypair} image=${image} type=${instance_type} wait=true group=${security_group} + register: inst_res + +- name: add it to the special group + local_action: add_host hostname=${inst_res.instances[0].public_ip} groupname=tmp_just_created + +- name: mail off about where it is + local_action: mail to=sysadmin-main-members@fedoraproject.org from=ansible-create@fedoraproject.org subject=${inst_res.instances[0].public_ip} msg="cloud instance created on ${inst_res.instances[0].public_ip} instance id: ${instance_res.instances[0].id} " + +- name: wait for the host to be hot + local_action: wait_for host=${inst_res.instances[0].public_ip} port=22 delay=20 timeout=300 + +