summaryrefslogtreecommitdiffstats
path: root/roles/openshift_aws/tasks/provision_instance.yml
diff options
context:
space:
mode:
authorOpenShift Merge Robot <openshift-merge-robot@users.noreply.github.com>2017-10-05 05:19:53 -0700
committerGitHub <noreply@github.com>2017-10-05 05:19:53 -0700
commit2dde1853efe73b7b6f185ce918aaaefeac20334c (patch)
tree2283cf415cb1544797a8c8b264b2f869741afeee /roles/openshift_aws/tasks/provision_instance.yml
parentcdbc995e65921210981e9fb3710a36c7d93a35dc (diff)
parentca90c960f14824608e546f71ef777f19ce818c43 (diff)
downloadopenshift-2dde1853efe73b7b6f185ce918aaaefeac20334c.tar.gz
openshift-2dde1853efe73b7b6f185ce918aaaefeac20334c.tar.bz2
openshift-2dde1853efe73b7b6f185ce918aaaefeac20334c.tar.xz
openshift-2dde1853efe73b7b6f185ce918aaaefeac20334c.zip
Merge pull request #5605 from mgugino-upstream-stage/build-provision-split
Automatic merge from submit-queue. Build provision split Make provisioning steps more reusable Reorganizing and making some of the plays more reusable. Depends-on: https://github.com/openshift/openshift-ansible/pull/5565
Diffstat (limited to 'roles/openshift_aws/tasks/provision_instance.yml')
-rw-r--r--roles/openshift_aws/tasks/provision_instance.yml63
1 files changed, 63 insertions, 0 deletions
diff --git a/roles/openshift_aws/tasks/provision_instance.yml b/roles/openshift_aws/tasks/provision_instance.yml
new file mode 100644
index 000000000..1384bae59
--- /dev/null
+++ b/roles/openshift_aws/tasks/provision_instance.yml
@@ -0,0 +1,63 @@
+---
+- name: query vpc
+ ec2_vpc_net_facts:
+ region: "{{ openshift_aws_region }}"
+ filters:
+ 'tag:Name': "{{ openshift_aws_vpc_name }}"
+ register: vpcout
+
+- name: fetch the default subnet id
+ ec2_vpc_subnet_facts:
+ region: "{{ openshift_aws_region }}"
+ filters:
+ "tag:Name": "{{ openshift_aws_subnet_name }}"
+ vpc-id: "{{ vpcout.vpcs[0].id }}"
+ register: subnetout
+
+- name: create instance for ami creation
+ ec2:
+ assign_public_ip: yes
+ region: "{{ openshift_aws_region }}"
+ key_name: "{{ openshift_aws_ssh_key_name }}"
+ group: "{{ openshift_aws_build_ami_group }}"
+ instance_type: m4.xlarge
+ vpc_subnet_id: "{{ openshift_aws_subnet_id | default(subnetout.subnets[0].id) }}"
+ image: "{{ openshift_aws_base_ami }}"
+ volumes:
+ - device_name: /dev/sdb
+ volume_type: gp2
+ volume_size: 100
+ delete_on_termination: true
+ wait: yes
+ exact_count: 1
+ count_tag:
+ Name: "{{ openshift_aws_base_ami_name }}"
+ instance_tags:
+ Name: "{{ openshift_aws_base_ami_name }}"
+
+- name: fetch newly created instances
+ ec2_remote_facts:
+ region: "{{ openshift_aws_region }}"
+ filters:
+ "tag:Name": "{{ openshift_aws_base_ami_name }}"
+ instance-state-name: running
+ register: instancesout
+ retries: 20
+ delay: 3
+ until: instancesout.instances|length > 0
+
+- name: wait for ssh to become available
+ wait_for:
+ port: 22
+ host: "{{ instancesout.instances[0].public_ip_address }}"
+ timeout: 300
+ search_regex: OpenSSH
+
+- name: Pause 10 seconds to ensure ssh actually accepts logins
+ pause:
+ seconds: 20
+
+- name: add host to nodes
+ add_host:
+ groups: nodes
+ name: "{{ instancesout.instances[0].public_dns_name }}"