summaryrefslogtreecommitdiffstats
path: root/playbooks/aws
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks/aws')
-rw-r--r--playbooks/aws/ansible-tower/launch.yml2
-rw-r--r--playbooks/aws/openshift-cluster/config.yml34
-rw-r--r--playbooks/aws/openshift-cluster/launch.yml31
-rw-r--r--playbooks/aws/openshift-cluster/library/ec2_ami_find.py2
l---------playbooks/aws/openshift-cluster/lookup_plugins1
-rw-r--r--playbooks/aws/openshift-cluster/tasks/launch_instances.yml48
-rw-r--r--playbooks/aws/openshift-cluster/templates/user_data.j242
-rw-r--r--playbooks/aws/openshift-cluster/terminate.yml61
-rw-r--r--playbooks/aws/openshift-cluster/update.yml4
-rw-r--r--playbooks/aws/openshift-cluster/vars.online.int.yml12
-rw-r--r--playbooks/aws/openshift-cluster/vars.online.prod.yml12
-rw-r--r--playbooks/aws/openshift-cluster/vars.online.stage.yml12
-rw-r--r--playbooks/aws/openshift-cluster/vars.yml12
-rw-r--r--playbooks/aws/openshift-master/config.yml19
l---------playbooks/aws/openshift-master/filter_plugins1
-rw-r--r--playbooks/aws/openshift-master/launch.yml70
l---------playbooks/aws/openshift-master/roles1
-rw-r--r--playbooks/aws/openshift-master/terminate.yml2
-rw-r--r--playbooks/aws/openshift-node/config.yml26
l---------playbooks/aws/openshift-node/filter_plugins1
-rw-r--r--playbooks/aws/openshift-node/launch.yml72
l---------playbooks/aws/openshift-node/roles1
-rw-r--r--playbooks/aws/openshift-node/terminate.yml2
-rw-r--r--playbooks/aws/terminate.yml64
24 files changed, 211 insertions, 321 deletions
diff --git a/playbooks/aws/ansible-tower/launch.yml b/playbooks/aws/ansible-tower/launch.yml
index 4bcc8b8dc..850238ffb 100644
--- a/playbooks/aws/ansible-tower/launch.yml
+++ b/playbooks/aws/ansible-tower/launch.yml
@@ -6,7 +6,7 @@
vars:
inst_region: us-east-1
- rhel7_ami: ami-78756d10
+ rhel7_ami: ami-9101c8fa
user_data_file: user_data.txt
vars_files:
diff --git a/playbooks/aws/openshift-cluster/config.yml b/playbooks/aws/openshift-cluster/config.yml
index 7188312ed..8106d5da9 100644
--- a/playbooks/aws/openshift-cluster/config.yml
+++ b/playbooks/aws/openshift-cluster/config.yml
@@ -1,37 +1,23 @@
---
-- name: Populate oo_masters_to_config host group
- hosts: localhost
+- hosts: localhost
gather_facts: no
vars_files:
- vars.yml
tasks:
- - name: Evaluate oo_masters_to_config
- add_host:
- name: "{{ item }}"
- groups: oo_masters_to_config
- ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
- ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: groups["tag_env-host-type_{{ cluster_id }}-openshift-master"] | default([])
- - name: Evaluate oo_nodes_to_config
- add_host:
- name: "{{ item }}"
- groups: oo_nodes_to_config
- ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
- ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: groups["tag_env-host-type_{{ cluster_id }}-openshift-node"] | default([])
- - name: Evaluate oo_first_master
- add_host:
- name: "{{ groups['tag_env-host-type_' ~ cluster_id ~ '-openshift-master'][0] }}"
- groups: oo_first_master
- ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
- ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- when: "'tag_env-host-type_{{ cluster_id }}-openshift-master' in groups"
+ - set_fact:
+ g_ssh_user_tmp: "{{ deployment_vars[deployment_type].ssh_user }}"
+ g_sudo_tmp: "{{ deployment_vars[deployment_type].sudo }}"
- include: ../../common/openshift-cluster/config.yml
vars:
+ g_etcd_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-etcd' }}"
+ g_masters_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-master' }}"
+ g_nodes_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-node' }}"
+ g_ssh_user: "{{ hostvars.localhost.g_ssh_user_tmp }}"
+ g_sudo: "{{ hostvars.localhost.g_sudo_tmp }}"
+ g_nodeonmaster: true
openshift_cluster_id: "{{ cluster_id }}"
openshift_debug_level: 4
openshift_deployment_type: "{{ deployment_type }}"
- openshift_first_master: "{{ groups.oo_first_master.0 }}"
openshift_hostname: "{{ ec2_private_ip_address }}"
openshift_public_hostname: "{{ ec2_ip_address }}"
diff --git a/playbooks/aws/openshift-cluster/launch.yml b/playbooks/aws/openshift-cluster/launch.yml
index 33e1ec25d..a89275597 100644
--- a/playbooks/aws/openshift-cluster/launch.yml
+++ b/playbooks/aws/openshift-cluster/launch.yml
@@ -11,23 +11,48 @@
msg: Deployment type not supported for aws provider yet
when: deployment_type == 'enterprise'
+ - include: ../../common/openshift-cluster/set_etcd_launch_facts_tasks.yml
+ - include: tasks/launch_instances.yml
+ vars:
+ instances: "{{ etcd_names }}"
+ cluster: "{{ cluster_id }}"
+ type: "{{ k8s_type }}"
+ g_sub_host_type: "default"
+
- include: ../../common/openshift-cluster/set_master_launch_facts_tasks.yml
- include: tasks/launch_instances.yml
vars:
instances: "{{ master_names }}"
cluster: "{{ cluster_id }}"
type: "{{ k8s_type }}"
+ g_sub_host_type: "default"
+
+ - include: ../../common/openshift-cluster/set_node_launch_facts_tasks.yml
+ vars:
+ type: "compute"
+ count: "{{ num_nodes }}"
+ - include: tasks/launch_instances.yml
+ vars:
+ instances: "{{ node_names }}"
+ cluster: "{{ cluster_id }}"
+ type: "{{ k8s_type }}"
+ g_sub_host_type: "{{ sub_host_type }}"
- include: ../../common/openshift-cluster/set_node_launch_facts_tasks.yml
+ vars:
+ type: "infra"
+ count: "{{ num_infra }}"
- include: tasks/launch_instances.yml
vars:
instances: "{{ node_names }}"
cluster: "{{ cluster_id }}"
type: "{{ k8s_type }}"
+ g_sub_host_type: "{{ sub_host_type }}"
- - set_fact:
- a_master: "{{ master_names[0] }}"
- - add_host: name={{ a_master }} groups=service_master
+ - add_host:
+ name: "{{ master_names.0 }}"
+ groups: service_master
+ when: master_names is defined and master_names.0 is defined
- include: update.yml
diff --git a/playbooks/aws/openshift-cluster/library/ec2_ami_find.py b/playbooks/aws/openshift-cluster/library/ec2_ami_find.py
index 29e594a65..2b1db62d8 100644
--- a/playbooks/aws/openshift-cluster/library/ec2_ami_find.py
+++ b/playbooks/aws/openshift-cluster/library/ec2_ami_find.py
@@ -158,7 +158,7 @@ EXAMPLES = '''
# Launch an EC2 instance
- ec2:
image: "{{ ami_search.results[0].ami_id }}"
- instance_type: m3.medium
+ instance_type: m4.medium
key_name: mykey
wait: yes
'''
diff --git a/playbooks/aws/openshift-cluster/lookup_plugins b/playbooks/aws/openshift-cluster/lookup_plugins
new file mode 120000
index 000000000..ac79701db
--- /dev/null
+++ b/playbooks/aws/openshift-cluster/lookup_plugins
@@ -0,0 +1 @@
+../../../lookup_plugins \ No newline at end of file
diff --git a/playbooks/aws/openshift-cluster/tasks/launch_instances.yml b/playbooks/aws/openshift-cluster/tasks/launch_instances.yml
index 060147659..236d84e74 100644
--- a/playbooks/aws/openshift-cluster/tasks/launch_instances.yml
+++ b/playbooks/aws/openshift-cluster/tasks/launch_instances.yml
@@ -5,6 +5,7 @@
env: "{{ cluster }}"
env_host_type: "{{ cluster }}-openshift-{{ type }}"
host_type: "{{ type }}"
+ sub_host_type: "{{ g_sub_host_type }}"
- set_fact:
ec2_region: "{{ lookup('env', 'ec2_region')
@@ -34,6 +35,35 @@
ec2_assign_public_ip: "{{ lookup('env', 'ec2_assign_public_ip')
| default(deployment_vars[deployment_type].assign_public_ip, true) }}"
when: ec2_assign_public_ip is not defined
+
+- set_fact:
+ ec2_instance_type: "{{ ec2_master_instance_type | default(deployment_vars[deployment_type].type, true) }}"
+ ec2_security_groups: "{{ ec2_master_security_groups
+ | default(deployment_vars[deployment_type].security_groups, true) }}"
+ when: host_type == "master" and sub_host_type == "default"
+
+- set_fact:
+ ec2_instance_type: "{{ ec2_etcd_instance_type | default(deployment_vars[deployment_type].type, true) }}"
+ ec2_security_groups: "{{ ec2_etcd_security_groups
+ | default(deployment_vars[deployment_type].security_groups, true)}}"
+ when: host_type == "etcd" and sub_host_type == "default"
+
+- set_fact:
+ ec2_instance_type: "{{ ec2_infra_instance_type | default(deployment_vars[deployment_type].type, true) }}"
+ ec2_security_groups: "{{ ec2_infra_security_groups
+ | default(deployment_vars[deployment_type].security_groups, true) }}"
+ when: host_type == "node" and sub_host_type == "infra"
+
+- set_fact:
+ ec2_instance_type: "{{ ec2_node_instance_type | default(deployment_vars[deployment_type].type, true) }}"
+ ec2_security_groups: "{{ ec2_node_security_groups
+ | default(deployment_vars[deployment_type].security_groups, true) }}"
+ when: host_type == "node" and sub_host_type == "compute"
+
+- set_fact:
+ ec2_instance_type: "{{ lookup('env', 'ec2_instance_type')
+ | default(deployment_vars[deployment_type].type, true) }}"
+ when: ec2_instance_type is not defined
- set_fact:
ec2_security_groups: "{{ lookup('env', 'ec2_security_groups')
| default(deployment_vars[deployment_type].security_groups, true) }}"
@@ -51,8 +81,17 @@
- set_fact:
latest_ami: "{{ ami_result.results | oo_ami_selector(ec2_image_name) }}"
- user_data: "{{ lookup('template', '../templates/user_data.j2') if type == 'node' else None | default('omit') }}"
+ user_data: "{{ lookup('template', '../templates/user_data.j2') }}"
volume_defs:
+ etcd:
+ root:
+ volume_size: "{{ lookup('env', 'os_etcd_root_vol_size') | default(25, true) }}"
+ device_type: "{{ lookup('env', 'os_etcd_root_vol_type') | default('gp2', true) }}"
+ iops: "{{ lookup('env', 'os_etcd_root_vol_iops') | default(500, true) }}"
+ etcd:
+ volume_size: "{{ lookup('env', 'os_etcd_vol_size') | default(32, true) }}"
+ device_type: "{{ lookup('env', 'os_etcd_vol_type') | default('gp2', true) }}"
+ iops: "{{ lookup('env', 'os_etcd_vol_iops') | default(500, true) }}"
master:
root:
volume_size: "{{ lookup('env', 'os_master_root_vol_size') | default(25, true) }}"
@@ -60,7 +99,7 @@
iops: "{{ lookup('env', 'os_master_root_vol_iops') | default(500, true) }}"
node:
root:
- volume_size: "{{ lookup('env', 'os_node_root_vol_size') | default(25, true) }}"
+ volume_size: "{{ lookup('env', 'os_node_root_vol_size') | default(85, true) }}"
device_type: "{{ lookup('env', 'os_node_root_vol_type') | default('gp2', true) }}"
iops: "{{ lookup('env', 'os_node_root_vol_iops') | default(500, true) }}"
docker:
@@ -90,6 +129,7 @@
env: "{{ env }}"
host-type: "{{ host_type }}"
env-host-type: "{{ env_host_type }}"
+ sub-host-type: "{{ sub_host_type }}"
volumes: "{{ volumes }}"
register: ec2
@@ -103,7 +143,9 @@
Name: "{{ item.0 }}"
- set_fact:
- instance_groups: tag_created-by_{{ created_by }}, tag_env_{{ env }}, tag_host-type_{{ host_type }}, tag_env-host-type_{{ env_host_type }}
+ instance_groups: "tag_created-by_{{ created_by }}, tag_env_{{ env }},
+ tag_host-type_{{ host_type }}, tag_env-host-type_{{ env_host_type }},
+ tag_sub-host-type_{{ sub_host_type }}"
- name: Add new instances groups and variables
add_host:
diff --git a/playbooks/aws/openshift-cluster/templates/user_data.j2 b/playbooks/aws/openshift-cluster/templates/user_data.j2
index 7dbc8f552..82c2f4d57 100644
--- a/playbooks/aws/openshift-cluster/templates/user_data.j2
+++ b/playbooks/aws/openshift-cluster/templates/user_data.j2
@@ -1,17 +1,25 @@
#cloud-config
-yum_repos:
- jdetiber-copr:
- name: Copr repo for origin owned by jdetiber
- baseurl: https://copr-be.cloud.fedoraproject.org/results/jdetiber/origin/epel-7-$basearch/
- skip_if_unavailable: true
- gpgcheck: true
- gpgkey: https://copr-be.cloud.fedoraproject.org/results/jdetiber/origin/pubkey.gpg
- enabled: true
+{% if type =='etcd' %}
+cloud_config_modules:
+- disk_setup
+- mounts
-packages:
-- xfsprogs # can be dropped after docker-storage-setup properly requires it: https://github.com/projectatomic/docker-storage-setup/pull/8
-- docker-storage-setup
+mounts:
+- [ xvdb, /var/lib/etcd, xfs, "defaults" ]
+
+disk_setup:
+ xvdb:
+ table_type: mbr
+ layout: True
+fs_setup:
+- label: etcd_storage
+ filesystem: xfs
+ device: /dev/xvdb
+ partition: auto
+{% endif %}
+
+{% if type == 'node' %}
mounts:
- [ xvdb ]
- [ ephemeral0 ]
@@ -23,7 +31,15 @@ write_files:
path: /etc/sysconfig/docker-storage-setup
owner: root:root
permissions: '0644'
+{% endif %}
+
+{% if deployment_type == 'online' %}
+devices: ['/var'] # Workaround for https://bugs.launchpad.net/bugs/1455436
+disable_root: 0
+growpart:
+ mode: auto
+ devices: ['/var']
runcmd:
-- systemctl daemon-reload
-- systemctl enable lvm2-lvmetad.service docker-storage-setup.service
+- xfs_growfs /var
+{% endif %}
diff --git a/playbooks/aws/openshift-cluster/terminate.yml b/playbooks/aws/openshift-cluster/terminate.yml
index 617d0d456..77287cad0 100644
--- a/playbooks/aws/openshift-cluster/terminate.yml
+++ b/playbooks/aws/openshift-cluster/terminate.yml
@@ -13,4 +13,63 @@
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
with_items: groups[scratch_group] | default([]) | difference(['localhost'])
-- include: ../terminate.yml
+- name: Unsubscribe VMs
+ hosts: oo_hosts_to_terminate
+ roles:
+ - role: rhel_unsubscribe
+ when: deployment_type == "enterprise" and
+ ansible_distribution == "RedHat" and
+ lookup('oo_option', 'rhel_skip_subscription') | default(rhsub_skip, True) |
+ default('no', True) | lower in ['no', 'false']
+
+- name: Terminate instances
+ hosts: localhost
+ connection: local
+ gather_facts: no
+ vars:
+ host_vars: "{{ hostvars
+ | oo_select_keys(groups['oo_hosts_to_terminate']) }}"
+ tasks:
+ - name: Remove tags from instances
+ ec2_tag: resource={{ item.ec2_id }} region={{ item.ec2_region }} state=absent
+ args:
+ tags:
+ env: "{{ item['ec2_tag_env'] }}"
+ host-type: "{{ item['ec2_tag_host-type'] }}"
+ env-host-type: "{{ item['ec2_tag_env-host-type'] }}"
+ sub_host_type: "{{ item['ec2_tag_sub-host-type'] }}"
+ with_items: host_vars
+ when: "'oo_hosts_to_terminate' in groups"
+
+ - name: Terminate instances
+ ec2:
+ state: absent
+ instance_ids: ["{{ item.ec2_id }}"]
+ region: "{{ item.ec2_region }}"
+ ignore_errors: yes
+ register: ec2_term
+ with_items: host_vars
+ when: "'oo_hosts_to_terminate' in groups"
+
+ # Fail if any of the instances failed to terminate with an error other
+ # than 403 Forbidden
+ - fail: msg=Terminating instance {{ item.ec2_id }} failed with message {{ item.msg }}
+ when: "'oo_hosts_to_terminate' in groups and item.failed and not item.msg | search(\"error: EC2ResponseError: 403 Forbidden\")"
+ with_items: ec2_term.results
+
+ - name: Stop instance if termination failed
+ ec2:
+ state: stopped
+ instance_ids: ["{{ item.item.ec2_id }}"]
+ region: "{{ item.item.ec2_region }}"
+ register: ec2_stop
+ when: "'oo_hosts_to_terminate' in groups and item.failed"
+ with_items: ec2_term.results
+
+ - name: Rename stopped instances
+ ec2_tag: resource={{ item.item.item.ec2_id }} region={{ item.item.item.ec2_region }} state=present
+ args:
+ tags:
+ Name: "{{ item.item.item.ec2_tag_Name }}-terminate"
+ with_items: ec2_stop.results
+ when: "'oo_hosts_to_terminate' in groups"
diff --git a/playbooks/aws/openshift-cluster/update.yml b/playbooks/aws/openshift-cluster/update.yml
index 5e7ab4e58..e006aa74a 100644
--- a/playbooks/aws/openshift-cluster/update.yml
+++ b/playbooks/aws/openshift-cluster/update.yml
@@ -11,7 +11,9 @@
groups: oo_hosts_to_update
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: groups["tag_env-host-type_{{ cluster_id }}-openshift-master"] | union(groups["tag_env-host-type_{{ cluster_id }}-openshift-node"]) | default([])
+ with_items: (groups["tag_env-host-type_{{ cluster_id }}-openshift-master"] | default([]))
+ | union(groups["tag_env-host-type_{{ cluster_id }}-openshift-node"] | default([]))
+ | union(groups["tag_env-host-type_{{ cluster_id }}-openshift-etcd"] | default([]))
- include: ../../common/openshift-cluster/update_repos_and_packages.yml
diff --git a/playbooks/aws/openshift-cluster/vars.online.int.yml b/playbooks/aws/openshift-cluster/vars.online.int.yml
index e115615d5..bb18e13b0 100644
--- a/playbooks/aws/openshift-cluster/vars.online.int.yml
+++ b/playbooks/aws/openshift-cluster/vars.online.int.yml
@@ -1,9 +1,15 @@
---
-ec2_image: ami-78756d10
+ec2_image: ami-9101c8fa
ec2_image_name: libra-ops-rhel7*
ec2_region: us-east-1
ec2_keypair: mmcgrath_libra
-ec2_instance_type: m3.large
-ec2_security_groups: [ 'int-v3' ]
+ec2_master_instance_type: t2.small
+ec2_master_security_groups: [ 'integration', 'integration-master' ]
+ec2_infra_instance_type: c4.large
+ec2_infra_security_groups: [ 'integration', 'integration-infra' ]
+ec2_node_instance_type: m4.large
+ec2_node_security_groups: [ 'integration', 'integration-node' ]
+ec2_etcd_instance_type: m4.large
+ec2_etcd_security_groups: [ 'integration', 'integration-etcd' ]
ec2_vpc_subnet: subnet-987c0def
ec2_assign_public_ip: yes
diff --git a/playbooks/aws/openshift-cluster/vars.online.prod.yml b/playbooks/aws/openshift-cluster/vars.online.prod.yml
index e115615d5..bbef9cc56 100644
--- a/playbooks/aws/openshift-cluster/vars.online.prod.yml
+++ b/playbooks/aws/openshift-cluster/vars.online.prod.yml
@@ -1,9 +1,15 @@
---
-ec2_image: ami-78756d10
+ec2_image: ami-9101c8fa
ec2_image_name: libra-ops-rhel7*
ec2_region: us-east-1
ec2_keypair: mmcgrath_libra
-ec2_instance_type: m3.large
-ec2_security_groups: [ 'int-v3' ]
+ec2_master_instance_type: t2.small
+ec2_master_security_groups: [ 'production', 'production-master' ]
+ec2_infra_instance_type: c4.large
+ec2_infra_security_groups: [ 'production', 'production-infra' ]
+ec2_node_instance_type: m4.large
+ec2_node_security_groups: [ 'production', 'production-node' ]
+ec2_etcd_instance_type: m4.large
+ec2_etcd_security_groups: [ 'production', 'production-etcd' ]
ec2_vpc_subnet: subnet-987c0def
ec2_assign_public_ip: yes
diff --git a/playbooks/aws/openshift-cluster/vars.online.stage.yml b/playbooks/aws/openshift-cluster/vars.online.stage.yml
index e115615d5..9008a55ba 100644
--- a/playbooks/aws/openshift-cluster/vars.online.stage.yml
+++ b/playbooks/aws/openshift-cluster/vars.online.stage.yml
@@ -1,9 +1,15 @@
---
-ec2_image: ami-78756d10
+ec2_image: ami-9101c8fa
ec2_image_name: libra-ops-rhel7*
ec2_region: us-east-1
ec2_keypair: mmcgrath_libra
-ec2_instance_type: m3.large
-ec2_security_groups: [ 'int-v3' ]
+ec2_master_instance_type: t2.small
+ec2_master_security_groups: [ 'stage', 'stage-master' ]
+ec2_infra_instance_type: c4.large
+ec2_infra_security_groups: [ 'stage', 'stage-infra' ]
+ec2_node_instance_type: m4.large
+ec2_node_security_groups: [ 'stage', 'stage-node' ]
+ec2_etcd_instance_type: m4.large
+ec2_etcd_security_groups: [ 'stage', 'stage-etcd' ]
ec2_vpc_subnet: subnet-987c0def
ec2_assign_public_ip: yes
diff --git a/playbooks/aws/openshift-cluster/vars.yml b/playbooks/aws/openshift-cluster/vars.yml
index 07e453f89..95bc4b3e2 100644
--- a/playbooks/aws/openshift-cluster/vars.yml
+++ b/playbooks/aws/openshift-cluster/vars.yml
@@ -1,14 +1,14 @@
---
deployment_vars:
origin:
- # fedora, since centos requires marketplace
- image: ami-acd999c4
+ # centos-7, requires marketplace
+ image: ami-96a818fe
image_name:
region: us-east-1
- ssh_user: fedora
+ ssh_user: centos
sudo: yes
keypair: libra
- type: m3.large
+ type: m4.large
security_groups: [ 'public' ]
vpc_subnet:
assign_public_ip:
@@ -20,7 +20,7 @@ deployment_vars:
ssh_user: root
sudo: no
keypair: libra
- type: m3.large
+ type: m4.large
security_groups: [ 'public' ]
vpc_subnet:
assign_public_ip:
@@ -32,7 +32,7 @@ deployment_vars:
ssh_user: ec2-user
sudo: yes
keypair: libra
- type: m3.large
+ type: m4.large
security_groups: [ 'public' ]
vpc_subnet:
assign_public_ip:
diff --git a/playbooks/aws/openshift-master/config.yml b/playbooks/aws/openshift-master/config.yml
deleted file mode 100644
index 37ab4fbe6..000000000
--- a/playbooks/aws/openshift-master/config.yml
+++ /dev/null
@@ -1,19 +0,0 @@
----
-- name: Populate oo_masters_to_config host group
- hosts: localhost
- gather_facts: no
- tasks:
- - name: Evaluate oo_masters_to_config
- add_host:
- name: "{{ item }}"
- groups: oo_masters_to_config
- ansible_ssh_user: root
- with_items: oo_host_group_exp | default([])
-
-- include: ../../common/openshift-master/config.yml
- vars:
- openshift_cluster_id: "{{ cluster_id }}"
- openshift_debug_level: 4
- openshift_deployment_type: "{{ deployment_type }}"
- openshift_hostname: "{{ ec2_private_ip_address }}"
- openshift_public_hostname: "{{ ec2_ip_address }}"
diff --git a/playbooks/aws/openshift-master/filter_plugins b/playbooks/aws/openshift-master/filter_plugins
deleted file mode 120000
index 99a95e4ca..000000000
--- a/playbooks/aws/openshift-master/filter_plugins
+++ /dev/null
@@ -1 +0,0 @@
-../../../filter_plugins \ No newline at end of file
diff --git a/playbooks/aws/openshift-master/launch.yml b/playbooks/aws/openshift-master/launch.yml
deleted file mode 100644
index 1cefad492..000000000
--- a/playbooks/aws/openshift-master/launch.yml
+++ /dev/null
@@ -1,70 +0,0 @@
----
-- name: Launch instance(s)
- hosts: localhost
- connection: local
- gather_facts: no
-
-# TODO: modify g_ami based on deployment_type
- vars:
- inst_region: us-east-1
- g_ami: ami-86781fee
- user_data_file: user_data.txt
-
- tasks:
- - name: Launch instances
- ec2:
- state: present
- region: "{{ inst_region }}"
- keypair: libra
- group: ['public']
- instance_type: m3.large
- image: "{{ g_ami }}"
- count: "{{ oo_new_inst_names | length }}"
- user_data: "{{ lookup('file', user_data_file) }}"
- wait: yes
- register: ec2
-
- - name: Add new instances public IPs to the host group
- add_host: "hostname={{ item.public_ip }} groupname=new_ec2_instances"
- with_items: ec2.instances
-
- - name: Add Name and environment tags to instances
- ec2_tag: "resource={{ item.1.id }} region={{ inst_region }} state=present"
- with_together:
- - oo_new_inst_names
- - ec2.instances
- args:
- tags:
- Name: "{{ item.0 }}"
-
- - name: Add other tags to instances
- ec2_tag: resource={{ item.id }} region={{ inst_region }} state=present
- with_items: ec2.instances
- args:
- tags: "{{ oo_new_inst_tags }}"
-
- - name: Add new instances public IPs to oo_masters_to_config
- add_host:
- hostname: "{{ item.0 }}"
- ansible_ssh_host: "{{ item.1.dns_name }}"
- groupname: oo_masters_to_config
- ec2_private_ip_address: "{{ item.1.private_ip }}"
- ec2_ip_address: "{{ item.1.public_ip }}"
- with_together:
- - oo_new_inst_names
- - ec2.instances
-
- - name: Wait for ssh
- wait_for: port=22 host={{ item.dns_name }}
- with_items: ec2.instances
-
- - name: Wait for root user setup
- command: "ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no -o ConnectTimeout=10 -o UserKnownHostsFile=/dev/null root@{{ item.dns_name }} echo root user is setup"
- register: result
- until: result.rc == 0
- retries: 20
- delay: 10
- with_items: ec2.instances
-
-# Apply the configs, seprate so that just the configs can be run by themselves
-- include: config.yml
diff --git a/playbooks/aws/openshift-master/roles b/playbooks/aws/openshift-master/roles
deleted file mode 120000
index 20c4c58cf..000000000
--- a/playbooks/aws/openshift-master/roles
+++ /dev/null
@@ -1 +0,0 @@
-../../../roles \ No newline at end of file
diff --git a/playbooks/aws/openshift-master/terminate.yml b/playbooks/aws/openshift-master/terminate.yml
deleted file mode 100644
index 07d9961bc..000000000
--- a/playbooks/aws/openshift-master/terminate.yml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-- include: ../terminate.yml
diff --git a/playbooks/aws/openshift-node/config.yml b/playbooks/aws/openshift-node/config.yml
deleted file mode 100644
index a993a1e99..000000000
--- a/playbooks/aws/openshift-node/config.yml
+++ /dev/null
@@ -1,26 +0,0 @@
----
-- name: Populate oo_nodes_to_config and oo_first_master host groups
- hosts: localhost
- gather_facts: no
- tasks:
- - name: Evaluate oo_nodes_to_config
- add_host:
- name: "{{ item }}"
- groups: oo_nodes_to_config
- ansible_ssh_user: root
- with_items: oo_host_group_exp | default([])
- - name: Evaluate oo_first_master
- add_host:
- name: "{{ groups['tag_env-host-type_' ~ cluster_id ~ '-openshift-master'][0] }}"
- groups: oo_first_master
- ansible_ssh_user: root
-
-
-- include: ../../common/openshift-node/config.yml
- vars:
- openshift_cluster_id: "{{ cluster_id }}"
- openshift_debug_level: 4
- openshift_deployment_type: "{{ deployment_type }}"
- openshift_first_master: "{{ groups.oo_first_master.0 }}"
- openshift_hostname: "{{ ec2_private_ip_address }}"
- openshift_public_hostname: "{{ ec2_ip_address }}"
diff --git a/playbooks/aws/openshift-node/filter_plugins b/playbooks/aws/openshift-node/filter_plugins
deleted file mode 120000
index 99a95e4ca..000000000
--- a/playbooks/aws/openshift-node/filter_plugins
+++ /dev/null
@@ -1 +0,0 @@
-../../../filter_plugins \ No newline at end of file
diff --git a/playbooks/aws/openshift-node/launch.yml b/playbooks/aws/openshift-node/launch.yml
deleted file mode 100644
index e7d1f7310..000000000
--- a/playbooks/aws/openshift-node/launch.yml
+++ /dev/null
@@ -1,72 +0,0 @@
----
-- name: Launch instance(s)
- hosts: localhost
- connection: local
- gather_facts: no
-
-# TODO: modify g_ami based on deployment_type
- vars:
- inst_region: us-east-1
- g_ami: ami-86781fee
- user_data_file: user_data.txt
-
- tasks:
- - name: Launch instances
- ec2:
- state: present
- region: "{{ inst_region }}"
- keypair: libra
- group: ['public']
- instance_type: m3.large
- image: "{{ g_ami }}"
- count: "{{ oo_new_inst_names | length }}"
- user_data: "{{ lookup('file', user_data_file) }}"
- wait: yes
- register: ec2
-
- - name: Add new instances public IPs to the host group
- add_host:
- hostname: "{{ item.public_ip }}"
- groupname: new_ec2_instances"
- with_items: ec2.instances
-
- - name: Add Name and environment tags to instances
- ec2_tag: resource={{ item.1.id }} region={{ inst_region }} state=present
- with_together:
- - oo_new_inst_names
- - ec2.instances
- args:
- tags:
- Name: "{{ item.0 }}"
-
- - name: Add other tags to instances
- ec2_tag: resource={{ item.id }} region={{ inst_region }} state=present
- with_items: ec2.instances
- args:
- tags: "{{ oo_new_inst_tags }}"
-
- - name: Add new instances public IPs to oo_nodes_to_config
- add_host:
- hostname: "{{ item.0 }}"
- ansible_ssh_host: "{{ item.1.dns_name }}"
- groupname: oo_nodes_to_config
- ec2_private_ip_address: "{{ item.1.private_ip }}"
- ec2_ip_address: "{{ item.1.public_ip }}"
- with_together:
- - oo_new_inst_names
- - ec2.instances
-
- - name: Wait for ssh
- wait_for: port=22 host={{ item.dns_name }}
- with_items: ec2.instances
-
- - name: Wait for root user setup
- command: "ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no -o ConnectTimeout=10 -o UserKnownHostsFile=/dev/null root@{{ item.dns_name }} echo root user is setup"
- register: result
- until: result.rc == 0
- retries: 20
- delay: 10
- with_items: ec2.instances
-
-# Apply the configs, seprate so that just the configs can be run by themselves
-- include: config.yml
diff --git a/playbooks/aws/openshift-node/roles b/playbooks/aws/openshift-node/roles
deleted file mode 120000
index 20c4c58cf..000000000
--- a/playbooks/aws/openshift-node/roles
+++ /dev/null
@@ -1 +0,0 @@
-../../../roles \ No newline at end of file
diff --git a/playbooks/aws/openshift-node/terminate.yml b/playbooks/aws/openshift-node/terminate.yml
deleted file mode 100644
index 07d9961bc..000000000
--- a/playbooks/aws/openshift-node/terminate.yml
+++ /dev/null
@@ -1,2 +0,0 @@
----
-- include: ../terminate.yml
diff --git a/playbooks/aws/terminate.yml b/playbooks/aws/terminate.yml
deleted file mode 100644
index e9767b260..000000000
--- a/playbooks/aws/terminate.yml
+++ /dev/null
@@ -1,64 +0,0 @@
----
-- name: Populate oo_hosts_to_terminate host group
- hosts: localhost
- gather_facts: no
- tasks:
- - name: Evaluate oo_hosts_to_terminate
- add_host: name={{ item }} groups=oo_hosts_to_terminate
- with_items: oo_host_group_exp | default([])
-
-- name: Gather dynamic inventory variables for hosts to terminate
- hosts: oo_hosts_to_terminate
- gather_facts: no
-
-- name: Terminate instances
- hosts: localhost
- connection: local
- gather_facts: no
- vars:
- host_vars: "{{ hostvars
- | oo_select_keys(groups['oo_hosts_to_terminate']) }}"
- tasks:
- - name: Remove tags from instances
- ec2_tag: resource={{ item.ec2_id }} region={{ item.ec2_region }} state=absent
- args:
- tags:
- env: "{{ item['ec2_tag_env'] }}"
- host-type: "{{ item['ec2_tag_host-type'] }}"
- env-host-type: "{{ item['ec2_tag_env-host-type'] }}"
- with_items: host_vars
- when: "'oo_hosts_to_terminate' in groups"
-
- - name: Terminate instances
- ec2:
- state: absent
- instance_ids: ["{{ item.ec2_id }}"]
- region: "{{ item.ec2_region }}"
- ignore_errors: yes
- register: ec2_term
- with_items: host_vars
- when: "'oo_hosts_to_terminate' in groups"
-
- # Fail if any of the instances failed to terminate with an error other
- # than 403 Forbidden
- - fail: msg=Terminating instance {{ item.item.ec2_id }} failed with message {{ item.msg }}
- when: "'oo_hosts_to_terminate' in groups and item.failed and not item.msg | search(\"error: EC2ResponseError: 403 Forbidden\")"
- with_items: ec2_term.results
-
- - name: Stop instance if termination failed
- ec2:
- state: stopped
- instance_ids: ["{{ item.item.ec2_id }}"]
- region: "{{ item.item.ec2_region }}"
- register: ec2_stop
- when: item.failed
- with_items: ec2_term.results
- when: "'oo_hosts_to_terminate' in groups"
-
- - name: Rename stopped instances
- ec2_tag: resource={{ item.item.item.ec2_id }} region={{ item.item.item.ec2_region }} state=present
- args:
- tags:
- Name: "{{ item.item.item.ec2_tag_Name }}-terminate"
- with_items: ec2_stop.results
- when: "'oo_hosts_to_terminate' in groups"