summaryrefslogtreecommitdiffstats
path: root/playbooks
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks')
-rw-r--r--playbooks/adhoc/create_pv/create_pv.yaml142
-rw-r--r--playbooks/adhoc/create_pv/pv-template.j216
-rw-r--r--playbooks/adhoc/zabbix_setup/clean_zabbix.yml51
-rw-r--r--playbooks/adhoc/zabbix_setup/create_app.yml34
-rw-r--r--playbooks/adhoc/zabbix_setup/create_application.yml18
-rw-r--r--playbooks/adhoc/zabbix_setup/create_template.yml57
l---------playbooks/adhoc/zabbix_setup/filter_plugins1
l---------playbooks/adhoc/zabbix_setup/roles1
-rw-r--r--playbooks/adhoc/zabbix_setup/setup_zabbix.yml38
-rw-r--r--playbooks/adhoc/zabbix_setup/vars/template_heartbeat.yml11
-rw-r--r--playbooks/adhoc/zabbix_setup/vars/template_host.yml27
-rw-r--r--playbooks/adhoc/zabbix_setup/vars/template_master.yml27
-rw-r--r--playbooks/adhoc/zabbix_setup/vars/template_node.yml27
-rw-r--r--playbooks/adhoc/zabbix_setup/vars/template_os_linux.yml120
-rw-r--r--playbooks/adhoc/zabbix_setup/vars/template_router.yml27
-rw-r--r--playbooks/aws/openshift-cluster/config.yml1
-rw-r--r--playbooks/aws/openshift-cluster/launch.yml17
-rw-r--r--playbooks/aws/openshift-cluster/library/ec2_ami_find.py2
-rw-r--r--playbooks/aws/openshift-cluster/tasks/launch_instances.yml37
-rw-r--r--playbooks/aws/openshift-cluster/terminate.yml1
-rw-r--r--playbooks/aws/openshift-cluster/vars.online.int.yml10
-rw-r--r--playbooks/aws/openshift-cluster/vars.online.prod.yml10
-rw-r--r--playbooks/aws/openshift-cluster/vars.online.stage.yml10
-rw-r--r--playbooks/aws/openshift-cluster/vars.yml6
-rw-r--r--playbooks/common/openshift-cluster/config.yml9
-rw-r--r--playbooks/common/openshift-cluster/set_node_launch_facts_tasks.yml8
-rw-r--r--playbooks/common/openshift-node/config.yml10
-rw-r--r--playbooks/gce/openshift-cluster/launch.yml20
-rw-r--r--playbooks/gce/openshift-cluster/tasks/launch_instances.yml1
-rw-r--r--playbooks/libvirt/openshift-cluster/launch.yml16
-rw-r--r--playbooks/openstack/openshift-cluster/launch.yml22
-rw-r--r--playbooks/openstack/openshift-cluster/vars.yml1
32 files changed, 753 insertions, 25 deletions
diff --git a/playbooks/adhoc/create_pv/create_pv.yaml b/playbooks/adhoc/create_pv/create_pv.yaml
new file mode 100644
index 000000000..684a0ca72
--- /dev/null
+++ b/playbooks/adhoc/create_pv/create_pv.yaml
@@ -0,0 +1,142 @@
+---
+#example run:
+# ansible-playbook -e "cli_volume_size=1" \
+# -e "cli_device_name=/dev/xvdf" \
+# -e "cli_hosttype=master" \
+# -e "cli_environment=ops" \
+# create_pv.yaml
+# FIXME: we need to change "environment" to "clusterid" as that's what it really is now.
+#
+- name: Create a volume and attach it to master
+ hosts: localhost
+ gather_facts: no
+ vars:
+ cli_volume_type: gp2
+ cli_volume_iops: ''
+ oo_name: "{{ groups['tag_host-type_' ~ cli_hosttype] |
+ intersect(groups['tag_environment_' ~ cli_environment]) |
+ first }}"
+ pre_tasks:
+ - fail:
+ msg: "This playbook requires {{item}} to be set."
+ when: "{{ item }} is not defined or {{ item }} == ''"
+ with_items:
+ - cli_volume_size
+ - cli_device_name
+ - cli_hosttype
+ - cli_environment
+
+ - name: set oo_name fact
+ set_fact:
+ oo_name: "{{ oo_name }}"
+
+
+ - name: Select a single master to run this on
+ add_host:
+ hostname: "{{ oo_name }}"
+ ansible_ssh_host: "{{ hostvars[oo_name].ec2_public_dns_name }}"
+ groups: oo_master
+
+ - name: Create a volume and attach it
+ ec2_vol:
+ state: present
+ instance: "{{ hostvars[oo_name]['ec2_id'] }}"
+ region: "{{ hostvars[oo_name]['ec2_region'] }}"
+ volume_size: "{{ cli_volume_size }}"
+ volume_type: "{{ cli_volume_type }}"
+ device_name: "{{ cli_device_name }}"
+ iops: "{{ cli_volume_iops }}"
+ register: vol
+
+ - debug: var=vol
+
+- name: Configure the drive
+ gather_facts: no
+ hosts: oo_master
+ user: root
+ connection: ssh
+ vars:
+ pv_tmpdir: /tmp/persistentvolumes
+
+ post_tasks:
+ - name: Setting facts for template
+ set_fact:
+ pv_name: "pv-{{cli_volume_size}}-{{ hostvars[hostvars.localhost.oo_name]['ec2_tag_Name'] }}-{{hostvars.localhost.vol.volume_id }}"
+ vol_az: "{{ hostvars[hostvars.localhost.oo_name]['ec2_placement'] }}"
+ vol_id: "{{ hostvars.localhost.vol.volume_id }}"
+ vol_size: "{{ cli_volume_size }}"
+ pv_mntdir: "{{ pv_tmpdir }}/mnt-{{ 1000 | random }}"
+
+ - set_fact:
+ pv_template: "{{ pv_tmpdir }}/{{ pv_name }}.yaml"
+
+ - name: "Mkdir {{ pv_tmpdir }}"
+ file:
+ state: directory
+ path: "{{ pv_tmpdir }}"
+ mode: '0750'
+
+ - name: "Mkdir {{ pv_mntdir }}"
+ file:
+ state: directory
+ path: "{{ pv_mntdir }}"
+ mode: '0750'
+
+ - name: Create pv file from template
+ template:
+ src: ./pv-template.j2
+ dest: "{{ pv_template }}"
+ owner: root
+ mode: '0640'
+
+ - name: mkfs
+ filesystem:
+ dev: "{{ cli_device_name }}"
+ fstype: ext4
+
+ - name: Mount the dev
+ mount:
+ name: "{{ pv_mntdir }}"
+ src: "{{ cli_device_name }}"
+ fstype: ext4
+ state: mounted
+
+ - name: chgrp g+rwXs
+ file:
+ path: "{{ pv_mntdir }}"
+ mode: 'g+rwXs'
+ recurse: yes
+ seuser: system_u
+ serole: object_r
+ setype: svirt_sandbox_file_t
+ selevel: s0
+
+ - name: umount
+ mount:
+ name: "{{ pv_mntdir }}"
+ src: "{{ cli_device_name }}"
+ state: unmounted
+ fstype: ext4
+
+ - name: detach drive
+ delegate_to: localhost
+ ec2_vol:
+ region: "{{ hostvars[hostvars.localhost.oo_name].ec2_region }}"
+ id: "{{ hostvars.localhost.vol.volume_id }}"
+ instance: None
+
+ - name: "Remove {{ pv_mntdir }}"
+ file:
+ state: absent
+ path: "{{ pv_mntdir }}"
+
+ # We have to use the shell module because we can't set env vars with the command module.
+ - name: "Place PV into oc"
+ shell: "KUBECONFIG=/etc/openshift/master/admin.kubeconfig oc create -f {{ pv_template | quote }}"
+ register: oc_output
+
+ - debug: var=oc_output
+
+ - fail:
+ msg: "Failed to add {{ pv_template }} to master."
+ when: oc_output.rc != 0
diff --git a/playbooks/adhoc/create_pv/pv-template.j2 b/playbooks/adhoc/create_pv/pv-template.j2
new file mode 100644
index 000000000..5654ef6c4
--- /dev/null
+++ b/playbooks/adhoc/create_pv/pv-template.j2
@@ -0,0 +1,16 @@
+---
+apiVersion: v1
+kind: PersistentVolume
+metadata:
+ name: {{ pv_name }}
+ labels:
+ type: ebs
+spec:
+ capacity:
+ storage: {{ vol_size }}Gi
+ accessModes:
+ - ReadWriteOnce
+ persistentVolumeReclaimPolicy: Recycle
+ awsElasticBlockStore:
+ volumeID: aws://{{ vol_az }}/{{ vol_id }}
+ fsType: ext4
diff --git a/playbooks/adhoc/zabbix_setup/clean_zabbix.yml b/playbooks/adhoc/zabbix_setup/clean_zabbix.yml
new file mode 100644
index 000000000..a31cbef65
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/clean_zabbix.yml
@@ -0,0 +1,51 @@
+---
+- hosts: localhost
+ gather_facts: no
+ vars:
+ g_zserver: http://localhost/zabbix/api_jsonrpc.php
+ g_zuser: Admin
+ g_zpassword: zabbix
+ roles:
+ - ../../../roles/os_zabbix
+ post_tasks:
+
+ - zbx_template:
+ server: "{{ g_zserver }}"
+ user: "{{ g_zuser }}"
+ password: "{{ g_zpassword }}"
+ state: list
+ name: 'Template Heartbeat'
+ register: templ_heartbeat
+
+ - zbx_template:
+ server: "{{ g_zserver }}"
+ user: "{{ g_zuser }}"
+ password: "{{ g_zpassword }}"
+ state: list
+ name: 'Template App Zabbix Server'
+ register: templ_zabbix_server
+
+ - zbx_template:
+ server: "{{ g_zserver }}"
+ user: "{{ g_zuser }}"
+ password: "{{ g_zpassword }}"
+ state: list
+ name: 'Template App Zabbix Agent'
+ register: templ_zabbix_agent
+
+ - zbx_template:
+ server: "{{ g_zserver }}"
+ user: "{{ g_zuser }}"
+ password: "{{ g_zpassword }}"
+ state: list
+ register: templates
+
+ - debug: var=templ_heartbeat.results
+
+ - zbx_template:
+ server: "{{ g_zserver }}"
+ user: "{{ g_zuser }}"
+ password: "{{ g_zpassword }}"
+ state: absent
+ with_items: "{{ templates.results | difference(templ_zabbix_agent.results) | difference(templ_zabbix_server.results) | oo_collect('host') }}"
+ when: templ_heartbeat.results | length == 0
diff --git a/playbooks/adhoc/zabbix_setup/create_app.yml b/playbooks/adhoc/zabbix_setup/create_app.yml
new file mode 100644
index 000000000..3a08b2301
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/create_app.yml
@@ -0,0 +1,34 @@
+---
+- hosts: localhost
+ gather_facts: no
+ vars_files:
+ - vars/template_heartbeat.yml
+ - vars/template_os_linux.yml
+ vars:
+ g_zserver: http://oso-rhel7-zabbix-web.kwoodsontest2.opstest.online.openshift.com/zabbix/api_jsonrpc.php
+ g_zuser: Admin
+ g_zpassword: zabbix
+ roles:
+ - ../roles/os_zabbix
+ post_tasks:
+ - zbxapi:
+ server: "{{ g_zserver }}"
+ user: "{{ g_zuser }}"
+ password: "{{ g_zpassword }}"
+ zbx_class: Template
+ state: list
+ params:
+ output: extend
+ register: templates
+
+ - debug: var=templates
+
+ - name: Create app
+ include: create_application.yml
+ vars:
+ ctp_template: "{{ g_template_heartbeat }}"
+ ctp_zserver: "{{ g_zserver }}"
+ ctp_zuser: "{{ g_zuser }}"
+ ctp_zpassword: "{{ g_zpassword }}"
+
+
diff --git a/playbooks/adhoc/zabbix_setup/create_application.yml b/playbooks/adhoc/zabbix_setup/create_application.yml
new file mode 100644
index 000000000..aa6c40ed8
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/create_application.yml
@@ -0,0 +1,18 @@
+---
+- debug: var=ctp_template
+
+- name: Create Application
+ zbxapi:
+ server: "{{ ctp_zserver }}"
+ user: "{{ ctp_zuser }}"
+ password: "{{ ctp_zpassword }}"
+ zbx_class: Application
+ state: present
+ params:
+ name: "{{ ctp_template.application['name'] }}"
+ hostid: 10085
+ search:
+ name: "{{ ctp_template.application['name'] }}"
+ register: ctp_created_application
+
+- debug: var=ctp_created_application
diff --git a/playbooks/adhoc/zabbix_setup/create_template.yml b/playbooks/adhoc/zabbix_setup/create_template.yml
new file mode 100644
index 000000000..60fb27666
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/create_template.yml
@@ -0,0 +1,57 @@
+---
+- debug: var=ctp_template
+
+- name: Create Template
+ zbx_template:
+ server: "{{ ctp_zserver }}"
+ user: "{{ ctp_zuser }}"
+ password: "{{ ctp_zpassword }}"
+ name: "{{ ctp_template.name }}"
+ register: ctp_created_template
+
+- debug: var=ctp_created_template
+
+#- name: Create Application
+# zbxapi:
+# server: "{{ ctp_zserver }}"
+# user: "{{ ctp_zuser }}"
+# password: "{{ ctp_zpassword }}"
+# zbx_class: Application
+# state: present
+# params:
+# name: "{{ ctp_template.application.name}}"
+# hostid: "{{ ctp_created_template.results[0].templateid }}"
+# search:
+# name: "{{ ctp_template.application.name}}"
+# register: ctp_created_application
+
+#- debug: var=ctp_created_application
+
+- name: Create Items
+ zbx_item:
+ server: "{{ ctp_zserver }}"
+ user: "{{ ctp_zuser }}"
+ password: "{{ ctp_zpassword }}"
+ name: "{{ item.name }}"
+ key: "{{ item.key }}"
+ value_type: "{{ item.value_type | default('int') }}"
+ template_name: "{{ ctp_template.name }}"
+ with_items: ctp_template.zitems
+ register: ctp_created_items
+
+#- debug: var=ctp_created_items
+
+- name: Create Triggers
+ zbx_trigger:
+ server: "{{ ctp_zserver }}"
+ user: "{{ ctp_zuser }}"
+ password: "{{ ctp_zpassword }}"
+ description: "{{ item.description }}"
+ expression: "{{ item.expression }}"
+ priority: "{{ item.priority }}"
+ with_items: ctp_template.ztriggers
+ when: ctp_template.ztriggers is defined
+
+#- debug: var=ctp_created_triggers
+
+
diff --git a/playbooks/adhoc/zabbix_setup/filter_plugins b/playbooks/adhoc/zabbix_setup/filter_plugins
new file mode 120000
index 000000000..99a95e4ca
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/filter_plugins
@@ -0,0 +1 @@
+../../../filter_plugins \ No newline at end of file
diff --git a/playbooks/adhoc/zabbix_setup/roles b/playbooks/adhoc/zabbix_setup/roles
new file mode 120000
index 000000000..e2b799b9d
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/roles
@@ -0,0 +1 @@
+../../../roles/ \ No newline at end of file
diff --git a/playbooks/adhoc/zabbix_setup/setup_zabbix.yml b/playbooks/adhoc/zabbix_setup/setup_zabbix.yml
new file mode 100644
index 000000000..1729194b5
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/setup_zabbix.yml
@@ -0,0 +1,38 @@
+---
+- hosts: localhost
+ gather_facts: no
+ vars_files:
+ - vars/template_heartbeat.yml
+ - vars/template_os_linux.yml
+ vars:
+ g_zserver: http://localhost/zabbix/api_jsonrpc.php
+ g_zuser: Admin
+ g_zpassword: zabbix
+ roles:
+ - ../../../roles/os_zabbix
+ post_tasks:
+ - zbx_template:
+ server: "{{ g_zserver }}"
+ user: "{{ g_zuser }}"
+ password: "{{ g_zpassword }}"
+ state: list
+ register: templates
+
+ - debug: var=templates
+
+ - name: Include Template
+ include: create_template.yml
+ vars:
+ ctp_template: "{{ g_template_heartbeat }}"
+ ctp_zserver: "{{ g_zserver }}"
+ ctp_zuser: "{{ g_zuser }}"
+ ctp_zpassword: "{{ g_zpassword }}"
+
+ - name: Include Template
+ include: create_template.yml
+ vars:
+ ctp_template: "{{ g_template_os_linux }}"
+ ctp_zserver: "{{ g_zserver }}"
+ ctp_zuser: "{{ g_zuser }}"
+ ctp_zpassword: "{{ g_zpassword }}"
+
diff --git a/playbooks/adhoc/zabbix_setup/vars/template_heartbeat.yml b/playbooks/adhoc/zabbix_setup/vars/template_heartbeat.yml
new file mode 100644
index 000000000..22cc75554
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/vars/template_heartbeat.yml
@@ -0,0 +1,11 @@
+---
+g_template_heartbeat:
+ name: Template Heartbeat
+ zitems:
+ - name: Heartbeat Ping
+ hostid:
+ key: heartbeat.ping
+ ztriggers:
+ - description: 'Heartbeat.ping has failed on {HOST.NAME}'
+ expression: '{Template Heartbeat:heartbeat.ping.last()}<>0'
+ priority: avg
diff --git a/playbooks/adhoc/zabbix_setup/vars/template_host.yml b/playbooks/adhoc/zabbix_setup/vars/template_host.yml
new file mode 100644
index 000000000..e7cc667cb
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/vars/template_host.yml
@@ -0,0 +1,27 @@
+---
+g_template_host:
+ params:
+ name: Template Host
+ host: Template Host
+ groups:
+ - groupid: 1 # FIXME (not real)
+ output: extend
+ search:
+ name: Template Host
+ zitems:
+ - name: Host Ping
+ hostid:
+ key_: host.ping
+ type: 2
+ value_type: 0
+ output: extend
+ search:
+ key_: host.ping
+ ztriggers:
+ - description: 'Host ping has failed on {HOST.NAME}'
+ expression: '{Template Host:host.ping.last()}<>0'
+ priority: 3
+ searchWildcardsEnabled: True
+ search:
+ description: 'Host ping has failed on*'
+ expandExpression: True
diff --git a/playbooks/adhoc/zabbix_setup/vars/template_master.yml b/playbooks/adhoc/zabbix_setup/vars/template_master.yml
new file mode 100644
index 000000000..5f9b41a4f
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/vars/template_master.yml
@@ -0,0 +1,27 @@
+---
+g_template_master:
+ params:
+ name: Template Master
+ host: Template Master
+ groups:
+ - groupid: 1 # FIXME (not real)
+ output: extend
+ search:
+ name: Template Master
+ zitems:
+ - name: Master Etcd Ping
+ hostid:
+ key_: master.etcd.ping
+ type: 2
+ value_type: 0
+ output: extend
+ search:
+ key_: master.etcd.ping
+ ztriggers:
+ - description: 'Master Etcd ping has failed on {HOST.NAME}'
+ expression: '{Template Master:master.etcd.ping.last()}<>0'
+ priority: 3
+ searchWildcardsEnabled: True
+ search:
+ description: 'Master Etcd ping has failed on*'
+ expandExpression: True
diff --git a/playbooks/adhoc/zabbix_setup/vars/template_node.yml b/playbooks/adhoc/zabbix_setup/vars/template_node.yml
new file mode 100644
index 000000000..98c343a24
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/vars/template_node.yml
@@ -0,0 +1,27 @@
+---
+g_template_node:
+ params:
+ name: Template Node
+ host: Template Node
+ groups:
+ - groupid: 1 # FIXME (not real)
+ output: extend
+ search:
+ name: Template Node
+ zitems:
+ - name: Kubelet Ping
+ hostid:
+ key_: kubelet.ping
+ type: 2
+ value_type: 0
+ output: extend
+ search:
+ key_: kubelet.ping
+ ztriggers:
+ - description: 'Kubelet ping has failed on {HOST.NAME}'
+ expression: '{Template Node:kubelet.ping.last()}<>0'
+ priority: 3
+ searchWildcardsEnabled: True
+ search:
+ description: 'Kubelet ping has failed on*'
+ expandExpression: True
diff --git a/playbooks/adhoc/zabbix_setup/vars/template_os_linux.yml b/playbooks/adhoc/zabbix_setup/vars/template_os_linux.yml
new file mode 100644
index 000000000..6fab08879
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/vars/template_os_linux.yml
@@ -0,0 +1,120 @@
+---
+g_template_os_linux:
+ name: Template OS Linux
+ zitems:
+ - key: kernel.uname.sysname
+ name: kernel.uname.sysname
+ value_type: string
+
+ - key: kernel.all.cpu.wait.total
+ name: kernel.all.cpu.wait.total
+ value_type: int
+
+ - key: kernel.all.cpu.irq.hard
+ name: kernel.all.cpu.irq.hard
+ value_type: int
+
+ - key: kernel.all.cpu.idle
+ name: kernel.all.cpu.idle
+ value_type: int
+
+ - key: kernel.uname.distro
+ name: kernel.uname.distro
+ value_type: string
+
+ - key: kernel.uname.nodename
+ name: kernel.uname.nodename
+ value_type: string
+
+ - key: kernel.all.cpu.irq.soft
+ name: kernel.all.cpu.irq.soft
+ value_type: int
+
+ - key: kernel.all.load.15_minute
+ name: kernel.all.load.15_minute
+ value_type: float
+
+ - key: kernel.all.cpu.sys
+ name: kernel.all.cpu.sys
+ value_type: int
+
+ - key: kernel.all.load.5_minute
+ name: kernel.all.load.5_minute
+ value_type: float
+
+ - key: mem.freemem
+ name: mem.freemem
+ value_type: int
+
+ - key: kernel.all.cpu.nice
+ name: kernel.all.cpu.nice
+ value_type: int
+
+ - key: mem.util.bufmem
+ name: mem.util.bufmem
+ value_type: int
+
+ - key: swap.used
+ name: swap.used
+ value_type: int
+
+ - key: kernel.all.load.1_minute
+ name: kernel.all.load.1_minute
+ value_type: float
+
+ - key: kernel.uname.version
+ name: kernel.uname.version
+ value_type: string
+
+ - key: swap.length
+ name: swap.length
+ value_type: int
+
+ - key: mem.physmem
+ name: mem.physmem
+ value_type: int
+
+ - key: kernel.all.uptime
+ name: kernel.all.uptime
+ value_type: int
+
+ - key: swap.free
+ name: swap.free
+ value_type: int
+
+ - key: mem.util.used
+ name: mem.util.used
+ value_type: int
+
+ - key: kernel.all.cpu.user
+ name: kernel.all.cpu.user
+ value_type: int
+
+ - key: kernel.uname.machine
+ name: kernel.uname.machine
+ value_type: string
+
+ - key: hinv.ncpu
+ name: hinv.ncpu
+ value_type: int
+
+ - key: mem.util.cached
+ name: mem.util.cached
+ value_type: int
+
+ - key: kernel.all.cpu.steal
+ name: kernel.all.cpu.steal
+ value_type: int
+
+
+ - key: kernel.all.pswitch
+ name: kernel.all.pswitch
+ value_type: int
+
+ - key: kernel.uname.release
+ name: kernel.uname.release
+ value_type: string
+
+ - key: proc.nprocs
+ name: proc.nprocs
+ value_type: int
diff --git a/playbooks/adhoc/zabbix_setup/vars/template_router.yml b/playbooks/adhoc/zabbix_setup/vars/template_router.yml
new file mode 100644
index 000000000..4dae7da1e
--- /dev/null
+++ b/playbooks/adhoc/zabbix_setup/vars/template_router.yml
@@ -0,0 +1,27 @@
+---
+g_template_router:
+ params:
+ name: Template Router
+ host: Template Router
+ groups:
+ - groupid: 1 # FIXME (not real)
+ output: extend
+ search:
+ name: Template Router
+ zitems:
+ - name: Router Backends down
+ hostid:
+ key_: router.backends.down
+ type: 2
+ value_type: 0
+ output: extend
+ search:
+ key_: router.backends.down
+ ztriggers:
+ - description: 'Number of router backends down on {HOST.NAME}'
+ expression: '{Template Router:router.backends.down.last()}<>0'
+ priority: 3
+ searchWildcardsEnabled: True
+ search:
+ description: 'Number of router backends down on {HOST.NAME}'
+ expandExpression: True
diff --git a/playbooks/aws/openshift-cluster/config.yml b/playbooks/aws/openshift-cluster/config.yml
index 6ee539c7e..8106d5da9 100644
--- a/playbooks/aws/openshift-cluster/config.yml
+++ b/playbooks/aws/openshift-cluster/config.yml
@@ -15,6 +15,7 @@
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 }}"
diff --git a/playbooks/aws/openshift-cluster/launch.yml b/playbooks/aws/openshift-cluster/launch.yml
index 5db87fa90..a89275597 100644
--- a/playbooks/aws/openshift-cluster/launch.yml
+++ b/playbooks/aws/openshift-cluster/launch.yml
@@ -17,6 +17,7 @@
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
@@ -24,13 +25,29 @@
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 }}"
- add_host:
name: "{{ master_names.0 }}"
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/tasks/launch_instances.yml b/playbooks/aws/openshift-cluster/tasks/launch_instances.yml
index 25a87aaf6..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) }}"
@@ -69,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:
@@ -99,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
@@ -112,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/terminate.yml b/playbooks/aws/openshift-cluster/terminate.yml
index 3a08ed966..77287cad0 100644
--- a/playbooks/aws/openshift-cluster/terminate.yml
+++ b/playbooks/aws/openshift-cluster/terminate.yml
@@ -37,6 +37,7 @@
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"
diff --git a/playbooks/aws/openshift-cluster/vars.online.int.yml b/playbooks/aws/openshift-cluster/vars.online.int.yml
index e406a7635..b9ee29b83 100644
--- a/playbooks/aws/openshift-cluster/vars.online.int.yml
+++ b/playbooks/aws/openshift-cluster/vars.online.int.yml
@@ -3,7 +3,13 @@ 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: m4.large
+ec2_master_security_groups: [ 'integration', 'integration-master' ]
+ec2_infra_instance_type: m4.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 e406a7635..691582834 100644
--- a/playbooks/aws/openshift-cluster/vars.online.prod.yml
+++ b/playbooks/aws/openshift-cluster/vars.online.prod.yml
@@ -3,7 +3,13 @@ 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: m4.large
+ec2_master_security_groups: [ 'production', 'production-master' ]
+ec2_infra_instance_type: m4.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 e406a7635..2ec43ad4c 100644
--- a/playbooks/aws/openshift-cluster/vars.online.stage.yml
+++ b/playbooks/aws/openshift-cluster/vars.online.stage.yml
@@ -3,7 +3,13 @@ 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: m4.large
+ec2_master_security_groups: [ 'stage', 'stage-master' ]
+ec2_infra_instance_type: m4.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 aad95ef48..95bc4b3e2 100644
--- a/playbooks/aws/openshift-cluster/vars.yml
+++ b/playbooks/aws/openshift-cluster/vars.yml
@@ -8,7 +8,7 @@ deployment_vars:
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/common/openshift-cluster/config.yml b/playbooks/common/openshift-cluster/config.yml
index 0779cfe47..4c74f96db 100644
--- a/playbooks/common/openshift-cluster/config.yml
+++ b/playbooks/common/openshift-cluster/config.yml
@@ -39,6 +39,15 @@
ansible_sudo: "{{ g_sudo | default(omit) }}"
with_items: groups[g_nodes_group] | default([])
+ - name: Evaluate oo_nodes_to_config
+ add_host:
+ name: "{{ item }}"
+ groups: oo_nodes_to_config
+ ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
+ ansible_sudo: "{{ g_sudo | default(omit) }}"
+ with_items: groups[g_masters_group] | default([])
+ when: g_nodeonmaster is defined and g_nodeonmaster == true
+
- name: Evaluate oo_first_etcd
add_host:
name: "{{ groups[g_etcd_group][0] }}"
diff --git a/playbooks/common/openshift-cluster/set_node_launch_facts_tasks.yml b/playbooks/common/openshift-cluster/set_node_launch_facts_tasks.yml
index 96e1a9a63..278942f8b 100644
--- a/playbooks/common/openshift-cluster/set_node_launch_facts_tasks.yml
+++ b/playbooks/common/openshift-cluster/set_node_launch_facts_tasks.yml
@@ -1,11 +1,13 @@
---
-- set_fact: k8s_type="node"
+- set_fact: k8s_type=node
+- set_fact: sub_host_type="{{ type }}"
+- set_fact: number_nodes="{{ count }}"
- name: Generate node instance names(s)
set_fact:
- scratch_name: "{{ cluster_id }}-{{ k8s_type }}-{{ '%05x' | format(1048576 | random) }}"
+ scratch_name: "{{ cluster_id }}-{{ k8s_type }}-{{ sub_host_type }}-{{ '%05x' | format(1048576 | random) }}"
register: node_names_output
- with_sequence: count={{ num_nodes }}
+ with_sequence: count={{ number_nodes }}
- set_fact:
node_names: "{{ node_names_output.results | default([])
diff --git a/playbooks/common/openshift-node/config.yml b/playbooks/common/openshift-node/config.yml
index bd35008b8..6ef375bbb 100644
--- a/playbooks/common/openshift-node/config.yml
+++ b/playbooks/common/openshift-node/config.yml
@@ -129,16 +129,14 @@
openshift_nodes: "{{ hostvars
| oo_select_keys(groups['oo_nodes_to_config'])
| oo_collect('openshift.common.hostname') }}"
- openshift_unscheduleable_nodes: "{{ hostvars
- | oo_select_keys(groups['oo_nodes_to_config']
- | default([]))
- | oo_collect('openshift.common.hostname', {'openshift_scheduleable': False}) }}"
+ openshift_unscheduleable_nodes: "{{ hostvars | oo_select_keys(groups['oo_nodes_to_config'] | default([]))
+ | oo_collect('openshift.common.hostname', {'openshift_scheduleable': False}) }}"
pre_tasks:
- set_fact:
openshift_scheduleable_nodes: "{{ hostvars
- | oo_select_keys(groups['oo_nodes_to_config']
- | default([]))
+ | oo_select_keys(groups['oo_nodes_to_config'] | default([]))
| oo_collect('openshift.common.hostname')
| difference(openshift_unscheduleable_nodes) }}"
+
roles:
- openshift_manage_node
diff --git a/playbooks/gce/openshift-cluster/launch.yml b/playbooks/gce/openshift-cluster/launch.yml
index 35737f03d..7a3b80da0 100644
--- a/playbooks/gce/openshift-cluster/launch.yml
+++ b/playbooks/gce/openshift-cluster/launch.yml
@@ -15,17 +15,33 @@
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: "{{ infra_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
+ a_infra: "{{ infra_names[0] }}"
+ - add_host: name={{ a_infra }} groups=service_master
- include: update.yml
diff --git a/playbooks/gce/openshift-cluster/tasks/launch_instances.yml b/playbooks/gce/openshift-cluster/tasks/launch_instances.yml
index 9a9848f05..6307ecc27 100644
--- a/playbooks/gce/openshift-cluster/tasks/launch_instances.yml
+++ b/playbooks/gce/openshift-cluster/tasks/launch_instances.yml
@@ -14,6 +14,7 @@
- created-by-{{ lookup('env', 'LOGNAME') |default(cluster, true) }}
- env-{{ cluster }}
- host-type-{{ type }}
+ - sub-host-type-{{ sub_host_type }}
- env-host-type-{{ cluster }}-openshift-{{ type }}
register: gce
diff --git a/playbooks/libvirt/openshift-cluster/launch.yml b/playbooks/libvirt/openshift-cluster/launch.yml
index 6badcb325..830f9d216 100644
--- a/playbooks/libvirt/openshift-cluster/launch.yml
+++ b/playbooks/libvirt/openshift-cluster/launch.yml
@@ -23,13 +23,29 @@
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 }}"
- include: update.yml
diff --git a/playbooks/openstack/openshift-cluster/launch.yml b/playbooks/openstack/openshift-cluster/launch.yml
index 3cdd2ae4d..d41448dc0 100644
--- a/playbooks/openstack/openshift-cluster/launch.yml
+++ b/playbooks/openstack/openshift-cluster/launch.yml
@@ -27,10 +27,13 @@
-P ssh_incoming={{ openstack_ssh_access_from }}
-P num_masters={{ num_masters }}
-P num_nodes={{ num_nodes }}
+ -P num_infra={{ num_infra }}
-P master_image={{ deployment_vars[deployment_type].image }}
-P node_image={{ deployment_vars[deployment_type].image }}
+ -P infra_image={{ deployment_vars[deployment_type].image }}
-P master_flavor={{ openstack_flavor["master"] }}
-P node_flavor={{ openstack_flavor["node"] }}
+ -P infra_flavor={{ openstack_flavor["infra"] }}
-P ssh_public_key="{{ openstack_ssh_public_key }}"
openshift-ansible-{{ cluster_id }}-stack'
when: stack_show_result.rc == 1
@@ -43,10 +46,13 @@
-P ssh_incoming={{ openstack_ssh_access_from }}
-P num_masters={{ num_masters }}
-P num_nodes={{ num_nodes }}
+ -P num_infra={{ num_infra }}
-P master_image={{ deployment_vars[deployment_type].image }}
-P node_image={{ deployment_vars[deployment_type].image }}
+ -P infra_image={{ deployment_vars[deployment_type].image }}
-P master_flavor={{ openstack_flavor["master"] }}
-P node_flavor={{ openstack_flavor["node"] }}
+ -P infra_flavor={{ openstack_flavor["infra"] }}
-P ssh_public_key="{{ openstack_ssh_public_key }}"
openshift-ansible-{{ cluster_id }}-stack'
when: stack_show_result.rc == 0
@@ -72,7 +78,7 @@
ansible_ssh_host: '{{ item[2] }}'
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- groups: 'tag_env_{{ cluster_id }}, tag_host-type_master, tag_env-host-type_{{ cluster_id }}-openshift-master'
+ groups: 'tag_env_{{ cluster_id }}, tag_host-type_master, tag_env-host-type_{{ cluster_id }}-openshift-master, tag_sub-host-type_default'
with_together:
- parsed_outputs.master_names
- parsed_outputs.master_ips
@@ -84,12 +90,24 @@
ansible_ssh_host: '{{ item[2] }}'
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- groups: 'tag_env_{{ cluster_id }}, tag_host-type_node, tag_env-host-type_{{ cluster_id }}-openshift-node'
+ groups: 'tag_env_{{ cluster_id }}, tag_host-type_node, tag_env-host-type_{{ cluster_id }}-openshift-node, tag_sub-host-type_node'
with_together:
- parsed_outputs.node_names
- parsed_outputs.node_ips
- parsed_outputs.node_floating_ips
+ - name: Add new infra instances groups and variables
+ add_host:
+ hostname: '{{ item[0] }}'
+ ansible_ssh_host: '{{ item[2] }}'
+ ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
+ ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
+ groups: 'tag_env_{{ cluster_id }}, tag_host-type_node, tag_env-host-type_{{ cluster_id }}-openshift-node, tag_sub-host-type_infra'
+ with_together:
+ - parsed_outputs.infra_names
+ - parsed_outputs.infra_ips
+ - parsed_outputs.infra_floating_ips
+
- name: Wait for ssh
wait_for:
host: '{{ item }}'
diff --git a/playbooks/openstack/openshift-cluster/vars.yml b/playbooks/openstack/openshift-cluster/vars.yml
index d077a6ced..43e25f2e6 100644
--- a/playbooks/openstack/openshift-cluster/vars.yml
+++ b/playbooks/openstack/openshift-cluster/vars.yml
@@ -19,6 +19,7 @@ openstack_ssh_access_from: "{{ lookup('oo_option', 'ssh_from') |
default('0.0.0.0/0', True) }}"
openstack_flavor:
master: "{{ lookup('oo_option', 'master_flavor' ) | default('m1.small', True) }}"
+ infra: "{{ lookup('oo_option', 'infra_flavor' ) | default('m1.small', True) }}"
node: "{{ lookup('oo_option', 'node_flavor' ) | default('m1.medium', True) }}"
deployment_vars: