summaryrefslogtreecommitdiffstats
path: root/playbooks/aws
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks/aws')
-rw-r--r--playbooks/aws/README.md4
-rw-r--r--playbooks/aws/openshift-cluster/cluster_hosts.yml16
-rw-r--r--playbooks/aws/openshift-cluster/config.yml6
-rw-r--r--playbooks/aws/openshift-cluster/library/ec2_ami_find.py1
-rw-r--r--playbooks/aws/openshift-cluster/list.yml11
-rw-r--r--playbooks/aws/openshift-cluster/tasks/launch_instances.yml48
-rw-r--r--playbooks/aws/openshift-cluster/terminate.yml86
-rw-r--r--playbooks/aws/openshift-cluster/update.yml4
8 files changed, 88 insertions, 88 deletions
diff --git a/playbooks/aws/README.md b/playbooks/aws/README.md
new file mode 100644
index 000000000..99698b4d0
--- /dev/null
+++ b/playbooks/aws/README.md
@@ -0,0 +1,4 @@
+# AWS playbooks
+
+This playbook directory is meant to be driven by [`bin/cluster`](../../bin),
+which is community supported and most use is considered deprecated.
diff --git a/playbooks/aws/openshift-cluster/cluster_hosts.yml b/playbooks/aws/openshift-cluster/cluster_hosts.yml
index 119b376aa..fbaf81dec 100644
--- a/playbooks/aws/openshift-cluster/cluster_hosts.yml
+++ b/playbooks/aws/openshift-cluster/cluster_hosts.yml
@@ -1,21 +1,21 @@
---
-g_all_hosts: "{{ groups['tag_clusterid_' ~ cluster_id] | default([])
- | intersect(groups['tag_environment_' ~ cluster_env] | default([])) }}"
+g_all_hosts: "{{ groups['tag_clusterid_' ~ cluster_id] | default([])
+ | intersect(groups['tag_environment_' ~ cluster_env] | default([])) }}"
-g_etcd_hosts: "{{ g_all_hosts | intersect(groups['tag_host-type_etcd'] | default([])) }}"
+g_etcd_hosts: "{{ g_all_hosts | intersect(groups['tag_host-type_etcd'] | default([])) }}"
-g_lb_hosts: "{{ g_all_hosts | intersect(groups['tag_host-type_lb'] | default([])) }}"
+g_lb_hosts: "{{ g_all_hosts | intersect(groups['tag_host-type_lb'] | default([])) }}"
-g_nfs_hosts: "{{ g_all_hosts | intersect(groups['tag_host-type_nfs'] | default([])) }}"
+g_nfs_hosts: "{{ g_all_hosts | intersect(groups['tag_host-type_nfs'] | default([])) }}"
-g_master_hosts: "{{ g_all_hosts | intersect(groups['tag_host-type_master'] | default([])) }}"
+g_master_hosts: "{{ g_all_hosts | intersect(groups['tag_host-type_master'] | default([])) }}"
g_new_master_hosts: "{{ g_all_hosts | intersect(groups['tag_host-type_new_master'] | default([])) }}"
-g_node_hosts: "{{ g_all_hosts | intersect(groups['tag_host-type_node'] | default([])) }}"
+g_node_hosts: "{{ g_all_hosts | intersect(groups['tag_host-type_node'] | default([])) }}"
g_new_node_hosts: "{{ g_all_hosts | intersect(groups['tag_host-type_new_node'] | default([])) }}"
-g_infra_hosts: "{{ g_node_hosts | intersect(groups['tag_sub-host-type_infra'] | default([])) }}"
+g_infra_hosts: "{{ g_node_hosts | intersect(groups['tag_sub-host-type_infra'] | default([])) }}"
g_compute_hosts: "{{ g_node_hosts | intersect(groups['tag_sub-host-type_compute'] | default([])) }}"
diff --git a/playbooks/aws/openshift-cluster/config.yml b/playbooks/aws/openshift-cluster/config.yml
index 05cfe7d6e..d60b68885 100644
--- a/playbooks/aws/openshift-cluster/config.yml
+++ b/playbooks/aws/openshift-cluster/config.yml
@@ -1,6 +1,4 @@
---
-- include: ../../common/openshift-cluster/verify_ansible_version.yml
-
- hosts: localhost
gather_facts: no
tasks:
@@ -19,8 +17,8 @@
- include: ../../common/openshift-cluster/config.yml
vars:
- g_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
- g_sudo: "{{ deployment_vars[deployment_type].become }}"
+ g_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
+ g_sudo: "{{ deployment_vars[deployment_type].become }}"
g_nodeonmaster: true
openshift_cluster_id: "{{ cluster_id }}"
openshift_debug_level: "{{ debug_level }}"
diff --git a/playbooks/aws/openshift-cluster/library/ec2_ami_find.py b/playbooks/aws/openshift-cluster/library/ec2_ami_find.py
index 2b1db62d8..99d0f44f0 100644
--- a/playbooks/aws/openshift-cluster/library/ec2_ami_find.py
+++ b/playbooks/aws/openshift-cluster/library/ec2_ami_find.py
@@ -1,5 +1,6 @@
#!/usr/bin/python
#pylint: skip-file
+# flake8: noqa
#
# This file is part of Ansible
#
diff --git a/playbooks/aws/openshift-cluster/list.yml b/playbooks/aws/openshift-cluster/list.yml
index a542b4ca3..ed8aac398 100644
--- a/playbooks/aws/openshift-cluster/list.yml
+++ b/playbooks/aws/openshift-cluster/list.yml
@@ -16,11 +16,8 @@
groups: oo_list_hosts
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_become: "{{ deployment_vars[deployment_type].become }}"
- with_items: groups[scratch_group] | default([]) | difference(['localhost'])
-
-- name: List Hosts
- hosts: oo_list_hosts
- gather_facts: no
- tasks:
+ oo_public_ipv4: "{{ hostvars[item].ec2_ip_address }}"
+ oo_private_ipv4: "{{ hostvars[item].ec2_private_ip_address }}"
+ with_items: "{{ groups[scratch_group] | default([]) | difference(['localhost']) }}"
- debug:
- msg: "public ip:{{ hostvars[inventory_hostname].ec2_ip_address }} private ip:{{ hostvars[inventory_hostname].ec2_private_ip_address }}"
+ msg: "{{ hostvars | oo_select_keys(groups[scratch_group] | default([])) | oo_pretty_print_cluster }}"
diff --git a/playbooks/aws/openshift-cluster/tasks/launch_instances.yml b/playbooks/aws/openshift-cluster/tasks/launch_instances.yml
index d22c86cda..608512b79 100644
--- a/playbooks/aws/openshift-cluster/tasks/launch_instances.yml
+++ b/playbooks/aws/openshift-cluster/tasks/launch_instances.yml
@@ -99,8 +99,8 @@
- name: Add Name tag to instances
ec2_tag: resource={{ item.1.id }} region={{ deployment_vars[deployment_type].region }} state=present
with_together:
- - instances
- - ec2.instances
+ - "{{ instances }}"
+ - "{{ ec2.instances }}"
args:
tags:
Name: "{{ item.0 }}"
@@ -125,21 +125,21 @@
- set_fact:
logrotate:
- - name: syslog
- path: |
- /var/log/cron
- /var/log/maillog
- /var/log/messages
- /var/log/secure
- /var/log/spooler"
- options:
- - daily
- - rotate 7
- - compress
- - sharedscripts
- - missingok
- scripts:
- postrotate: "/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true"
+ - name: syslog
+ path: |
+ /var/log/cron
+ /var/log/maillog
+ /var/log/messages
+ /var/log/secure
+ /var/log/spooler"
+ options:
+ - daily
+ - rotate 7
+ - compress
+ - sharedscripts
+ - missingok
+ scripts:
+ postrotate: "/bin/kill -HUP `cat /var/run/syslogd.pid 2> /dev/null` 2> /dev/null || true"
- name: Add new instances groups and variables
add_host:
@@ -154,8 +154,8 @@
openshift_node_labels: "{{ node_label }}"
logrotate_scripts: "{{ logrotate }}"
with_together:
- - instances
- - ec2.instances
+ - "{{ instances }}"
+ - "{{ ec2.instances }}"
- name: Add new instances to nodes_to_add group if needed
add_host:
@@ -169,13 +169,13 @@
openshift_node_labels: "{{ node_label }}"
logrotate_scripts: "{{ logrotate }}"
with_together:
- - instances
- - ec2.instances
+ - "{{ instances }}"
+ - "{{ ec2.instances }}"
when: oo_extend_env is defined and oo_extend_env | bool
- name: Wait for ssh
wait_for: "port=22 host={{ item.dns_name }}"
- with_items: ec2.instances
+ with_items: "{{ ec2.instances }}"
- name: Wait for user setup
command: "ssh -o StrictHostKeyChecking=no -o PasswordAuthentication=no -o ConnectTimeout=10 -o UserKnownHostsFile=/dev/null {{ hostvars[item.0].ansible_ssh_user }}@{{ item.1.dns_name }} echo {{ hostvars[item.0].ansible_ssh_user }} user is setup"
@@ -184,5 +184,5 @@
retries: 20
delay: 10
with_together:
- - instances
- - ec2.instances
+ - "{{ instances }}"
+ - "{{ ec2.instances }}"
diff --git a/playbooks/aws/openshift-cluster/terminate.yml b/playbooks/aws/openshift-cluster/terminate.yml
index fb13e1839..1f15aa4bf 100644
--- a/playbooks/aws/openshift-cluster/terminate.yml
+++ b/playbooks/aws/openshift-cluster/terminate.yml
@@ -12,7 +12,7 @@
groups: oo_hosts_to_terminate
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_become: "{{ deployment_vars[deployment_type].become }}"
- with_items: (groups['tag_clusterid_' ~ cluster_id] | default([])) | difference(['localhost'])
+ with_items: "{{ (groups['tag_clusterid_' ~ cluster_id] | default([])) | difference(['localhost']) }}"
- name: Unsubscribe VMs
hosts: oo_hosts_to_terminate
@@ -29,49 +29,49 @@
become: no
gather_facts: no
tasks:
- - name: Remove tags from instances
- ec2_tag:
- resource: "{{ hostvars[item]['ec2_id'] }}"
- region: "{{ hostvars[item]['ec2_region'] }}"
- state: absent
- tags:
- environment: "{{ hostvars[item]['ec2_tag_environment'] }}"
- clusterid: "{{ hostvars[item]['ec2_tag_clusterid'] }}"
- host-type: "{{ hostvars[item]['ec2_tag_host-type'] }}"
- sub_host_type: "{{ hostvars[item]['ec2_tag_sub-host-type'] }}"
- with_items: groups.oo_hosts_to_terminate
- when: "'oo_hosts_to_terminate' in groups"
+ - name: Remove tags from instances
+ ec2_tag:
+ resource: "{{ hostvars[item]['ec2_id'] }}"
+ region: "{{ hostvars[item]['ec2_region'] }}"
+ state: absent
+ tags:
+ environment: "{{ hostvars[item]['ec2_tag_environment'] }}"
+ clusterid: "{{ hostvars[item]['ec2_tag_clusterid'] }}"
+ host-type: "{{ hostvars[item]['ec2_tag_host-type'] }}"
+ sub_host_type: "{{ hostvars[item]['ec2_tag_sub-host-type'] }}"
+ with_items: "{{ groups.oo_hosts_to_terminate }}"
+ when: "'oo_hosts_to_terminate' in groups"
- - name: Terminate instances
- ec2:
- state: absent
- instance_ids: ["{{ hostvars[item].ec2_id }}"]
- region: "{{ hostvars[item].ec2_region }}"
- ignore_errors: yes
- register: ec2_term
- with_items: groups.oo_hosts_to_terminate
- when: "'oo_hosts_to_terminate' in groups"
+ - name: Terminate instances
+ ec2:
+ state: absent
+ instance_ids: ["{{ hostvars[item].ec2_id }}"]
+ region: "{{ hostvars[item].ec2_region }}"
+ ignore_errors: yes
+ register: ec2_term
+ with_items: "{{ groups.oo_hosts_to_terminate }}"
+ 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.has_key('failed') and item.failed"
- with_items: ec2_term.results
+ # 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.has_key('failed') and item.failed"
+ 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.has_key('failed') and item.failed"
- 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.has_key('failed') 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: ec2_stop | changed
+ - 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: ec2_stop | changed
diff --git a/playbooks/aws/openshift-cluster/update.yml b/playbooks/aws/openshift-cluster/update.yml
index d762203b2..ed05d61ed 100644
--- a/playbooks/aws/openshift-cluster/update.yml
+++ b/playbooks/aws/openshift-cluster/update.yml
@@ -7,7 +7,7 @@
- add_host:
name: "{{ item }}"
groups: l_oo_all_hosts
- with_items: g_all_hosts
+ with_items: "{{ g_all_hosts }}"
- hosts: l_oo_all_hosts
gather_facts: no
@@ -27,7 +27,7 @@
groups: oo_hosts_to_update
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_become: "{{ deployment_vars[deployment_type].become }}"
- with_items: g_all_hosts | default([])
+ with_items: "{{ g_all_hosts | default([]) }}"
- include: ../../common/openshift-cluster/update_repos_and_packages.yml