summaryrefslogtreecommitdiffstats
path: root/playbooks
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks')
-rw-r--r--playbooks/aws/os2-atomic-proxy/launch.yml32
-rw-r--r--playbooks/aws/os2-atomic-proxy/vars.stg.yml7
2 files changed, 37 insertions, 2 deletions
diff --git a/playbooks/aws/os2-atomic-proxy/launch.yml b/playbooks/aws/os2-atomic-proxy/launch.yml
index 23bf67bb7..fd6b0f39a 100644
--- a/playbooks/aws/os2-atomic-proxy/launch.yml
+++ b/playbooks/aws/os2-atomic-proxy/launch.yml
@@ -8,12 +8,35 @@
inst_region: us-east-1
atomic_ami: ami-8e239fe6
user_data_file: user_data.txt
+ oo_vpc_subnet_id: # Purposely left blank, these are here to be overridden in env vars_files
+ oo_assign_public_ip: # Purposely left blank, these are here to be overridden in env vars_files
vars_files:
- vars.yml
+ - "vars.{{ oo_env }}.yml"
tasks:
- - name: Launch instances
+ - name: Launch instances in VPC
+ ec2:
+ state: present
+ region: "{{ inst_region }}"
+ keypair: mmcgrath_libra
+ group_id: "{{ oo_security_group_ids }}"
+ instance_type: m3.large
+ image: "{{ atomic_ami }}"
+ count: "{{ oo_new_inst_names | oo_len }}"
+ user_data: "{{ lookup('file', user_data_file) }}"
+ wait: yes
+ assign_public_ip: "{{ oo_assign_public_ip }}"
+ vpc_subnet_id: "{{ oo_vpc_subnet_id }}"
+ when: oo_vpc_subnet_id
+ register: ec2_vpc
+
+ - set_fact:
+ ec2: "{{ ec2_vpc }}"
+ when: oo_vpc_subnet_id
+
+ - name: Launch instances in Classic
ec2:
state: present
region: "{{ inst_region }}"
@@ -24,7 +47,12 @@
count: "{{ oo_new_inst_names | oo_len }}"
user_data: "{{ lookup('file', user_data_file) }}"
wait: yes
- register: ec2
+ when: not oo_vpc_subnet_id
+ register: ec2_classic
+
+ - set_fact:
+ ec2: "{{ ec2_classic }}"
+ when: not oo_vpc_subnet_id
- name: Add new instances public IPs to the atomic proxy host group
add_host: "hostname={{ item.public_ip }} groupname=new_ec2_instances"
diff --git a/playbooks/aws/os2-atomic-proxy/vars.stg.yml b/playbooks/aws/os2-atomic-proxy/vars.stg.yml
index 8d994c2fc..1cecfc9b2 100644
--- a/playbooks/aws/os2-atomic-proxy/vars.stg.yml
+++ b/playbooks/aws/os2-atomic-proxy/vars.stg.yml
@@ -1,3 +1,10 @@
---
oo_env_long: staging
oo_zabbix_hostgroups: ['STG Environment']
+oo_vpc_subnet_id: subnet-700bdd07
+oo_assign_public_ip: yes
+oo_security_group_ids:
+ - sg-02c2f267 # Libra (vpc)
+ - sg-f0bfbe95 # stg (vpc)
+ - sg-a3bfbec6 # stg_proxy (vpc)
+ - sg-d4bfbeb1 # stg_proxy_atomic (vpc)