summaryrefslogtreecommitdiffstats
path: root/playbooks
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks')
-rw-r--r--playbooks/adhoc/bootstrap-fedora.yml5
-rw-r--r--playbooks/adhoc/create_pv/create_pv.yaml19
-rw-r--r--playbooks/adhoc/docker_loopback_to_lvm/docker_loopback_to_direct_lvm.yml2
-rw-r--r--playbooks/adhoc/grow_docker_vg/grow_docker_vg.yml2
-rw-r--r--playbooks/adhoc/noc/create_host.yml4
-rw-r--r--playbooks/adhoc/noc/create_maintenance.yml2
-rw-r--r--playbooks/adhoc/noc/get_zabbix_problems.yml2
-rw-r--r--playbooks/adhoc/s3_registry/s3_registry.yml2
-rwxr-xr-xplaybooks/adhoc/sdn_restart/oo-sdn-restart.yml53
-rw-r--r--playbooks/adhoc/setupnfs.yml21
-rw-r--r--playbooks/adhoc/uninstall.yml34
-rw-r--r--playbooks/adhoc/zabbix_setup/clean_zabbix.yml2
-rwxr-xr-xplaybooks/adhoc/zabbix_setup/oo-config-zaio.yml2
-rw-r--r--playbooks/aws/ansible-tower/config.yml2
-rw-r--r--playbooks/aws/ansible-tower/launch.yml5
-rw-r--r--playbooks/aws/openshift-cluster/addNodes.yml1
-rw-r--r--playbooks/aws/openshift-cluster/cluster_hosts.yml22
-rw-r--r--playbooks/aws/openshift-cluster/config.yml22
-rw-r--r--playbooks/aws/openshift-cluster/launch.yml1
-rw-r--r--playbooks/aws/openshift-cluster/list.yml4
-rw-r--r--playbooks/aws/openshift-cluster/scaleup.yml19
-rw-r--r--playbooks/aws/openshift-cluster/service.yml7
-rw-r--r--playbooks/aws/openshift-cluster/tasks/launch_instances.yml22
-rw-r--r--playbooks/aws/openshift-cluster/terminate.yml38
-rw-r--r--playbooks/aws/openshift-cluster/update.yml11
-rw-r--r--playbooks/aws/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml17
-rw-r--r--playbooks/aws/openshift-cluster/vars.yml3
-rw-r--r--playbooks/byo/openshift-cluster/cluster_hosts.yml13
-rw-r--r--playbooks/byo/openshift-cluster/config.yml8
-rw-r--r--playbooks/byo/openshift-cluster/scaleup.yml8
-rw-r--r--playbooks/byo/openshift-cluster/upgrades/README.md2
-rw-r--r--playbooks/byo/openshift-cluster/upgrades/v3_0_minor/upgrade.yml11
-rw-r--r--playbooks/byo/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml11
-rw-r--r--playbooks/byo/openshift_facts.yml3
-rw-r--r--playbooks/common/openshift-cluster/config.yml7
-rw-r--r--playbooks/common/openshift-cluster/evaluate_groups.yml60
-rw-r--r--playbooks/common/openshift-cluster/scaleup.yml2
-rw-r--r--playbooks/common/openshift-cluster/update_repos_and_packages.yml1
-rw-r--r--playbooks/common/openshift-cluster/upgrades/files/pre-upgrade-check17
-rw-r--r--playbooks/common/openshift-cluster/upgrades/files/versions.sh5
-rw-r--r--playbooks/common/openshift-cluster/upgrades/v3_0_minor/upgrade.yml4
-rw-r--r--playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml41
-rw-r--r--playbooks/common/openshift-docker/config.yml9
l---------playbooks/common/openshift-docker/filter_plugins1
l---------playbooks/common/openshift-docker/lookup_plugins1
l---------playbooks/common/openshift-docker/roles1
-rw-r--r--playbooks/common/openshift-etcd/config.yml8
-rw-r--r--playbooks/common/openshift-etcd/service.yml2
-rw-r--r--playbooks/common/openshift-master/config.yml99
-rw-r--r--playbooks/common/openshift-master/service.yml2
-rw-r--r--playbooks/common/openshift-nfs/config.yml5
l---------playbooks/common/openshift-nfs/filter_plugins1
l---------playbooks/common/openshift-nfs/lookup_plugins1
l---------playbooks/common/openshift-nfs/roles1
-rw-r--r--playbooks/common/openshift-nfs/service.yml18
-rw-r--r--playbooks/common/openshift-node/config.yml8
-rw-r--r--playbooks/common/openshift-node/service.yml2
-rw-r--r--playbooks/gce/openshift-cluster/cluster_hosts.yml22
-rw-r--r--playbooks/gce/openshift-cluster/config.yml28
-rw-r--r--playbooks/gce/openshift-cluster/join_node.yml12
-rw-r--r--playbooks/gce/openshift-cluster/launch.yml1
-rw-r--r--playbooks/gce/openshift-cluster/list.yml4
-rw-r--r--playbooks/gce/openshift-cluster/service.yml9
-rw-r--r--playbooks/gce/openshift-cluster/tasks/launch_instances.yml4
-rw-r--r--playbooks/gce/openshift-cluster/terminate.yml5
-rw-r--r--playbooks/gce/openshift-cluster/update.yml7
-rw-r--r--playbooks/gce/openshift-cluster/vars.yml3
-rw-r--r--playbooks/gce/openshift-cluster/wip.yml3
-rw-r--r--playbooks/libvirt/openshift-cluster/cluster_hosts.yml22
-rw-r--r--playbooks/libvirt/openshift-cluster/config.yml24
-rw-r--r--playbooks/libvirt/openshift-cluster/launch.yml3
-rw-r--r--playbooks/libvirt/openshift-cluster/list.yml6
-rw-r--r--playbooks/libvirt/openshift-cluster/service.yml6
-rw-r--r--playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml11
-rw-r--r--playbooks/libvirt/openshift-cluster/templates/domain.xml4
-rw-r--r--playbooks/libvirt/openshift-cluster/terminate.yml6
-rw-r--r--playbooks/libvirt/openshift-cluster/update.yml7
-rw-r--r--playbooks/libvirt/openshift-cluster/vars.yml7
-rw-r--r--playbooks/openstack/openshift-cluster/cluster_hosts.yml22
-rw-r--r--playbooks/openstack/openshift-cluster/config.yml24
-rw-r--r--playbooks/openstack/openshift-cluster/files/heat_stack.yaml143
-rw-r--r--playbooks/openstack/openshift-cluster/files/heat_stack_server.yaml14
-rw-r--r--playbooks/openstack/openshift-cluster/launch.yml23
-rw-r--r--playbooks/openstack/openshift-cluster/list.yml6
-rw-r--r--playbooks/openstack/openshift-cluster/terminate.yml5
-rw-r--r--playbooks/openstack/openshift-cluster/update.yml7
-rw-r--r--playbooks/openstack/openshift-cluster/vars.yml2
87 files changed, 779 insertions, 337 deletions
diff --git a/playbooks/adhoc/bootstrap-fedora.yml b/playbooks/adhoc/bootstrap-fedora.yml
new file mode 100644
index 000000000..de9f36c8a
--- /dev/null
+++ b/playbooks/adhoc/bootstrap-fedora.yml
@@ -0,0 +1,5 @@
+- hosts: OSv3
+ gather_facts: false
+ tasks:
+ - name: install python and deps for ansible modules
+ raw: dnf install -y python2 python2-dnf libselinux-python libsemanage-python
diff --git a/playbooks/adhoc/create_pv/create_pv.yaml b/playbooks/adhoc/create_pv/create_pv.yaml
index 4f0ef7a75..347d9f574 100644
--- a/playbooks/adhoc/create_pv/create_pv.yaml
+++ b/playbooks/adhoc/create_pv/create_pv.yaml
@@ -1,20 +1,21 @@
---
-#example run:
+#example run:
# ansible-playbook -e "cli_volume_size=1" \
# -e "cli_device_name=/dev/xvdf" \
# -e "cli_hosttype=master" \
-# -e "cli_environment=ops" \
+# -e "cli_clusterid=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
+ connection: local
+ become: no
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]) |
+ intersect(groups['oo_clusterid_' ~ cli_clusterid]) |
first }}"
pre_tasks:
- fail:
@@ -24,7 +25,7 @@
- cli_volume_size
- cli_device_name
- cli_hosttype
- - cli_environment
+ - cli_clusterid
- name: set oo_name fact
set_fact:
@@ -55,7 +56,7 @@
args:
tags:
Name: "pv-{{ hostvars[oo_name]['ec2_tag_Name'] }}"
- env: "{{cli_environment}}"
+ clusterid: "{{cli_clusterid}}"
register: voltags
- debug: var=voltags
@@ -103,7 +104,7 @@
filesystem:
dev: "{{ cli_device_name }}"
fstype: ext4
-
+
- name: Mount the dev
mount:
name: "{{ pv_mntdir }}"
@@ -112,7 +113,7 @@
state: mounted
- name: chgrp g+rwXs
- file:
+ file:
path: "{{ pv_mntdir }}"
mode: 'g+rwXs'
recurse: yes
@@ -154,6 +155,6 @@
- debug: var=oc_output
- - fail:
+ - fail:
msg: "Failed to add {{ pv_template }} to master."
when: oc_output.rc != 0
diff --git a/playbooks/adhoc/docker_loopback_to_lvm/docker_loopback_to_direct_lvm.yml b/playbooks/adhoc/docker_loopback_to_lvm/docker_loopback_to_direct_lvm.yml
index b6a2d2f26..4d32fc40b 100644
--- a/playbooks/adhoc/docker_loopback_to_lvm/docker_loopback_to_direct_lvm.yml
+++ b/playbooks/adhoc/docker_loopback_to_lvm/docker_loopback_to_direct_lvm.yml
@@ -113,7 +113,7 @@
args:
tags:
Name: "{{ ec2_tag_Name }}"
- env: "{{ ec2_tag_environment }}"
+ clusterid: "{{ ec2_tag_clusterid }}"
register: voltags
- name: Wait for volume to attach
diff --git a/playbooks/adhoc/grow_docker_vg/grow_docker_vg.yml b/playbooks/adhoc/grow_docker_vg/grow_docker_vg.yml
index 63d473146..174cea460 100644
--- a/playbooks/adhoc/grow_docker_vg/grow_docker_vg.yml
+++ b/playbooks/adhoc/grow_docker_vg/grow_docker_vg.yml
@@ -151,7 +151,7 @@
args:
tags:
Name: "{{ ec2_tag_Name }}"
- env: "{{ ec2_tag_environment }}"
+ clusterid: "{{ ec2_tag_clusterid }}"
register: voltags
- name: check for attached drive
diff --git a/playbooks/adhoc/noc/create_host.yml b/playbooks/adhoc/noc/create_host.yml
index d250e6e69..2d2cae2b5 100644
--- a/playbooks/adhoc/noc/create_host.yml
+++ b/playbooks/adhoc/noc/create_host.yml
@@ -1,6 +1,8 @@
---
- name: 'Create a host object in zabbix'
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
roles:
- os_zabbix
@@ -23,6 +25,8 @@
#ansible-playbook -e 'oo_desc=kwoodson test' -e 'oo_name=kwoodson test name' -e 'oo_start=1435715357' -e 'oo_stop=1435718985' -e 'oo_hostids=11549' create_maintenance.yml
- name: 'Create a host object in zabbix'
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
roles:
- os_zabbix
diff --git a/playbooks/adhoc/noc/create_maintenance.yml b/playbooks/adhoc/noc/create_maintenance.yml
index c0ec57ce1..8ad5fa0e2 100644
--- a/playbooks/adhoc/noc/create_maintenance.yml
+++ b/playbooks/adhoc/noc/create_maintenance.yml
@@ -2,6 +2,8 @@
#ansible-playbook -e 'oo_desc=kwoodson test' -e 'oo_name=kwoodson test name' -e 'oo_start=1435715357' -e 'oo_stop=1435718985' -e 'oo_hostids=11549' create_maintenance.yml
- name: 'Create a maintenace object in zabbix'
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
roles:
- os_zabbix
diff --git a/playbooks/adhoc/noc/get_zabbix_problems.yml b/playbooks/adhoc/noc/get_zabbix_problems.yml
index 4b94fa228..79cae24ab 100644
--- a/playbooks/adhoc/noc/get_zabbix_problems.yml
+++ b/playbooks/adhoc/noc/get_zabbix_problems.yml
@@ -1,6 +1,8 @@
---
- name: 'Get current hosts who have triggers that are alerting by trigger description'
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
roles:
- os_zabbix
diff --git a/playbooks/adhoc/s3_registry/s3_registry.yml b/playbooks/adhoc/s3_registry/s3_registry.yml
index 4dcef1a42..d409b4086 100644
--- a/playbooks/adhoc/s3_registry/s3_registry.yml
+++ b/playbooks/adhoc/s3_registry/s3_registry.yml
@@ -6,7 +6,7 @@
# The AWS access/secret keys should be the keys of a separate user (not your main user), containing only the necessary S3 access role.
# The 'clusterid' is the short name of your cluster.
-- hosts: tag_env-host-type_{{ clusterid }}-openshift-master
+- hosts: tag_clusterid_{{ clusterid }}:&tag_host-type_openshift-master
remote_user: root
gather_facts: False
diff --git a/playbooks/adhoc/sdn_restart/oo-sdn-restart.yml b/playbooks/adhoc/sdn_restart/oo-sdn-restart.yml
new file mode 100755
index 000000000..0dc021fbc
--- /dev/null
+++ b/playbooks/adhoc/sdn_restart/oo-sdn-restart.yml
@@ -0,0 +1,53 @@
+#!/usr/bin/ansible-playbook
+---
+#example run:
+# ansible-playbook -e "host=ops-node-compute-abcde" oo-sdn-restart.yml
+#
+
+- name: Check vars
+ hosts: localhost
+ gather_facts: false
+
+ pre_tasks:
+ - fail:
+ msg: "Playbook requires host to be set"
+ when: host is not defined or host == ''
+
+- name: Restart openshift/docker (and monitoring containers)
+ hosts: oo_version_3:&oo_name_{{ host }}
+ gather_facts: false
+ user: root
+
+ tasks:
+ - name: stop openshift/docker
+ service:
+ name: "{{ item }}"
+ state: stopped
+ with_items:
+ - atomic-openshift-node
+ - docker
+
+ - name: restart openvswitch
+ service:
+ name: openvswitch
+ state: restarted
+
+ - name: wait 5 sec
+ pause:
+ seconds: 5
+
+ - name: start openshift/docker
+ service:
+ name: "{{ item }}"
+ state: started
+ with_items:
+ - atomic-openshift-node
+ - docker
+
+ - name: start monitoring containers
+ service:
+ name: "{{ item }}"
+ state: restarted
+ with_items:
+ - oso-f22-host-monitoring
+ - oso-rhel7-zagg-client
diff --git a/playbooks/adhoc/setupnfs.yml b/playbooks/adhoc/setupnfs.yml
new file mode 100644
index 000000000..5f3631fcf
--- /dev/null
+++ b/playbooks/adhoc/setupnfs.yml
@@ -0,0 +1,21 @@
+---
+### This playbook is old and we are currently not using NFS.
+- hosts: tag_Name_nfs-v3-stg
+ sudo: no
+ remote_user: root
+ gather_facts: no
+ roles:
+ - role: openshift_storage_nfs_lvm
+ mount_dir: /exports/stg-black
+ volume_prefix: "kwoodsontest"
+ volume_size: 5
+ volume_num_start: 222
+ number_of_volumes: 3
+ tasks:
+ - fetch:
+ dest: json/
+ src: /root/"{{ item }}"
+ with_items:
+ - persistent-volume.kwoodsontest5g0222.json
+ - persistent-volume.kwoodsontest5g0223.json
+ - persistent-volume.kwoodsontest5g0224.json
diff --git a/playbooks/adhoc/uninstall.yml b/playbooks/adhoc/uninstall.yml
index 1f1ada3f0..ac20f5f9b 100644
--- a/playbooks/adhoc/uninstall.yml
+++ b/playbooks/adhoc/uninstall.yml
@@ -19,15 +19,19 @@
failed_when: false
register: ostree_output
+ # Since we're not calling openshift_facts we'll do this for now
- set_fact:
is_atomic: "{{ ostree_output.rc == 0 }}"
+ - set_fact:
+ is_containerized: "{{ is_atomic or containerized | default(false) | bool }}"
- name: Remove br0 interface
shell: ovs-vsctl del-br br0
changed_when: False
failed_when: False
- - service: name={{ item }} state=stopped
+ - name: Stop services
+ service: name={{ item }} state=stopped
with_items:
- atomic-enterprise-master
- atomic-enterprise-node
@@ -36,6 +40,7 @@
- atomic-openshift-master-controllers
- atomic-openshift-node
- etcd
+ - haproxy
- openshift-master
- openshift-master-api
- openshift-master-controllers
@@ -46,8 +51,10 @@
- origin-master-controllers
- origin-node
- pcsd
+ failed_when: false
- - yum: name={{ item }} state=absent
+ - name: Remove packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=absent"
when: not is_atomic | bool
with_items:
- atomic-enterprise
@@ -61,6 +68,7 @@
- atomic-openshift-sdn-ovs
- corosync
- etcd
+ - haproxy
- openshift
- openshift-master
- openshift-node
@@ -132,14 +140,26 @@
with_items:
- registry\.access\..*redhat\.com/openshift3
- registry\.access\..*redhat\.com/aep3
+ - registry\.access\..*redhat\.com/rhel7/etcd
- docker.io/openshift
- shell: "docker rmi -f {{ item.stdout_lines | join(' ') }}"
changed_when: False
failed_when: False
with_items: "{{ images_to_delete.results }}"
+
+ - name: Remove sdn drop files
+ file:
+ path: /run/openshift-sdn
+ state: absent
+
+ - name: restart docker
+ service:
+ name: docker
+ state: restarted
- - file: path={{ item }} state=absent
+ - name: Remove remaining files
+ file: path={{ item }} state=absent
with_items:
- "~{{ ansible_ssh_user }}/.kube"
- /etc/ansible/facts.d/openshift.fact
@@ -149,7 +169,15 @@
- /etc/openshift
- /etc/openshift-sdn
- /etc/origin
+ - /etc/systemd/system/atomic-openshift-master.service
+ - /etc/systemd/system/atomic-openshift-master-api.service
+ - /etc/systemd/system/atomic-openshift-master-controllers.service
+ - /etc/systemd/system/atomic-openshift-node.service
+ - /etc/systemd/system/etcd_container.service
+ - /etc/systemd/system/openvswitch.service
- /etc/sysconfig/atomic-enterprise-master
+ - /etc/sysconfig/atomic-enterprise-master-api
+ - /etc/sysconfig/atomic-enterprise-master-controllers
- /etc/sysconfig/atomic-enterprise-node
- /etc/sysconfig/atomic-openshift-master
- /etc/sysconfig/atomic-openshift-master-api
diff --git a/playbooks/adhoc/zabbix_setup/clean_zabbix.yml b/playbooks/adhoc/zabbix_setup/clean_zabbix.yml
index 1e884240a..09f7c76cc 100644
--- a/playbooks/adhoc/zabbix_setup/clean_zabbix.yml
+++ b/playbooks/adhoc/zabbix_setup/clean_zabbix.yml
@@ -1,6 +1,8 @@
---
- hosts: localhost
gather_facts: no
+ connection: local
+ become: no
vars:
g_server: http://localhost:8080/zabbix/api_jsonrpc.php
g_user: ''
diff --git a/playbooks/adhoc/zabbix_setup/oo-config-zaio.yml b/playbooks/adhoc/zabbix_setup/oo-config-zaio.yml
index e2b8150c6..ec28564cf 100755
--- a/playbooks/adhoc/zabbix_setup/oo-config-zaio.yml
+++ b/playbooks/adhoc/zabbix_setup/oo-config-zaio.yml
@@ -2,6 +2,8 @@
---
- hosts: localhost
gather_facts: no
+ connection: local
+ become: no
vars:
g_server: http://localhost/zabbix/api_jsonrpc.php
g_user: Admin
diff --git a/playbooks/aws/ansible-tower/config.yml b/playbooks/aws/ansible-tower/config.yml
index efd1b9911..eb3f1a1da 100644
--- a/playbooks/aws/ansible-tower/config.yml
+++ b/playbooks/aws/ansible-tower/config.yml
@@ -2,6 +2,8 @@
- name: "populate oo_hosts_to_config host group if needed"
hosts: localhost
gather_facts: no
+ connection: local
+ become: no
tasks:
- name: Evaluate oo_host_group_exp if it's set
add_host: "name={{ item }} groups=oo_hosts_to_config"
diff --git a/playbooks/aws/ansible-tower/launch.yml b/playbooks/aws/ansible-tower/launch.yml
index 850238ffb..d40529435 100644
--- a/playbooks/aws/ansible-tower/launch.yml
+++ b/playbooks/aws/ansible-tower/launch.yml
@@ -2,6 +2,7 @@
- name: Launch instance(s)
hosts: localhost
connection: local
+ become: no
gather_facts: no
vars:
@@ -71,8 +72,8 @@
tasks:
- - name: Yum update
- yum: name=* state=latest
+ - name: Update All Things
+ action: "{{ ansible_pkg_mgr }} name=* state=latest"
# Apply the configs, seprate so that just the configs can be run by themselves
- include: config.yml
diff --git a/playbooks/aws/openshift-cluster/addNodes.yml b/playbooks/aws/openshift-cluster/addNodes.yml
index fff3e401b..3d88e6b23 100644
--- a/playbooks/aws/openshift-cluster/addNodes.yml
+++ b/playbooks/aws/openshift-cluster/addNodes.yml
@@ -2,6 +2,7 @@
- name: Launch instance(s)
hosts: localhost
connection: local
+ become: no
gather_facts: no
vars_files:
- vars.yml
diff --git a/playbooks/aws/openshift-cluster/cluster_hosts.yml b/playbooks/aws/openshift-cluster/cluster_hosts.yml
new file mode 100644
index 000000000..d6b413c6f
--- /dev/null
+++ b/playbooks/aws/openshift-cluster/cluster_hosts.yml
@@ -0,0 +1,22 @@
+---
+g_etcd_hosts: "{{ (groups['tag_host-type_etcd']|default([]))
+ | intersect((groups['tag_clusterid_' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment_' ~ cluster_env]|default([]))) }}"
+
+g_lb_hosts: "{{ (groups['tag_host-type_lb']|default([]))
+ | intersect((groups['tag_clusterid_' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment_' ~ cluster_env]|default([]))) }}"
+
+g_master_hosts: "{{ (groups['tag_host-type_master']|default([]))
+ | intersect((groups['tag_clusterid_' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment_' ~ cluster_env]|default([]))) }}"
+
+g_node_hosts: "{{ (groups['tag_host-type_node']|default([]))
+ | intersect((groups['tag_clusterid_' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment_' ~ cluster_env]|default([]))) }}"
+
+g_nfs_hosts: "{{ (groups['tag_host-type_nfs']|default([]))
+ | intersect((groups['tag_environment_' ~ cluster_id]|default([]))) }}"
+
+g_all_hosts: "{{ g_master_hosts | union(g_node_hosts) | union(g_etcd_hosts)
+ | union(g_lb_hosts) | default([]) }}"
diff --git a/playbooks/aws/openshift-cluster/config.yml b/playbooks/aws/openshift-cluster/config.yml
index 5aa6b0f9b..abdb23d78 100644
--- a/playbooks/aws/openshift-cluster/config.yml
+++ b/playbooks/aws/openshift-cluster/config.yml
@@ -1,24 +1,14 @@
---
-- hosts: localhost
- gather_facts: no
- vars_files:
- - vars.yml
- tasks:
- - 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_files:
+ - ../../aws/openshift-cluster/vars.yml
+ - ../../aws/openshift-cluster/cluster_hosts.yml
vars:
- g_etcd_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-etcd' }}"
- g_lb_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-lb' }}"
- 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_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
+ g_sudo: "{{ deployment_vars[deployment_type].sudo }}"
g_nodeonmaster: true
openshift_cluster_id: "{{ cluster_id }}"
- openshift_debug_level: 2
+ openshift_debug_level: "{{ debug_level }}"
openshift_deployment_type: "{{ deployment_type }}"
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 09bf34666..15b83dfad 100644
--- a/playbooks/aws/openshift-cluster/launch.yml
+++ b/playbooks/aws/openshift-cluster/launch.yml
@@ -2,6 +2,7 @@
- name: Launch instance(s)
hosts: localhost
connection: local
+ become: no
gather_facts: no
vars_files:
- vars.yml
diff --git a/playbooks/aws/openshift-cluster/list.yml b/playbooks/aws/openshift-cluster/list.yml
index 04fcdc0a1..8b41a355e 100644
--- a/playbooks/aws/openshift-cluster/list.yml
+++ b/playbooks/aws/openshift-cluster/list.yml
@@ -2,10 +2,12 @@
- name: Generate oo_list_hosts group
hosts: localhost
gather_facts: no
+ connection: local
+ become: no
vars_files:
- vars.yml
tasks:
- - set_fact: scratch_group=tag_env_{{ cluster_id }}
+ - set_fact: scratch_group=tag_clusterid_{{ cluster_id }}
when: cluster_id != ''
- set_fact: scratch_group=all
when: cluster_id == ''
diff --git a/playbooks/aws/openshift-cluster/scaleup.yml b/playbooks/aws/openshift-cluster/scaleup.yml
index 4415700a3..c2135cd03 100644
--- a/playbooks/aws/openshift-cluster/scaleup.yml
+++ b/playbooks/aws/openshift-cluster/scaleup.yml
@@ -2,12 +2,11 @@
- hosts: localhost
gather_facts: no
+ connection: local
+ become: no
vars_files:
- vars.yml
tasks:
- - set_fact:
- g_ssh_user_tmp: "{{ deployment_vars[deployment_type].ssh_user }}"
- g_sudo_tmp: "{{ deployment_vars[deployment_type].sudo }}"
- name: Evaluate oo_hosts_to_update
add_host:
name: "{{ item }}"
@@ -19,16 +18,16 @@
- include: ../../common/openshift-cluster/update_repos_and_packages.yml
- include: ../../common/openshift-cluster/scaleup.yml
+ vars_files:
+ - ../../aws/openshift-cluster/vars.yml
+ - ../../aws/openshift-cluster/cluster_hosts.yml
vars:
- g_etcd_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-etcd' }}"
- g_lb_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-lb' }}"
- g_masters_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-master' }}"
- g_new_nodes_group: 'nodes_to_add'
- g_ssh_user: "{{ hostvars.localhost.g_ssh_user_tmp }}"
- g_sudo: "{{ hostvars.localhost.g_sudo_tmp }}"
+ g_new_node_hosts: "{{ groups.nodes_to_add }}"
+ g_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
+ g_sudo: "{{ deployment_vars[deployment_type].sudo }}"
g_nodeonmaster: true
openshift_cluster_id: "{{ cluster_id }}"
- openshift_debug_level: 2
+ openshift_debug_level: "{{ debug_level }}"
openshift_deployment_type: "{{ deployment_type }}"
openshift_hostname: "{{ ec2_private_ip_address }}"
openshift_public_hostname: "{{ ec2_ip_address }}"
diff --git a/playbooks/aws/openshift-cluster/service.yml b/playbooks/aws/openshift-cluster/service.yml
index 25cf48505..d5f7d6b19 100644
--- a/playbooks/aws/openshift-cluster/service.yml
+++ b/playbooks/aws/openshift-cluster/service.yml
@@ -1,9 +1,12 @@
---
- name: Call same systemctl command for openshift on all instance(s)
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
vars_files:
- vars.yml
+ - cluster_hosts.yml
tasks:
- fail: msg="cluster_id is required to be injected in this playbook"
when: cluster_id is not defined
@@ -14,7 +17,7 @@
groups: g_service_masters
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([])
+ with_items: "{{ master_hosts | default([]) }}"
- name: Evaluate g_service_nodes
add_host:
@@ -22,7 +25,7 @@
groups: g_service_nodes
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([])
+ with_items: "{{ node_hosts | default([]) }}"
- include: ../../common/openshift-node/service.yml
- include: ../../common/openshift-master/service.yml
diff --git a/playbooks/aws/openshift-cluster/tasks/launch_instances.yml b/playbooks/aws/openshift-cluster/tasks/launch_instances.yml
index 15e775770..6090ed6fe 100644
--- a/playbooks/aws/openshift-cluster/tasks/launch_instances.yml
+++ b/playbooks/aws/openshift-cluster/tasks/launch_instances.yml
@@ -2,8 +2,8 @@
- set_fact:
created_by: "{{ lookup('env', 'LOGNAME')|default(cluster, true) }}"
docker_vol_ephemeral: "{{ lookup('env', 'os_docker_vol_ephemeral') | default(false, true) }}"
- env: "{{ cluster }}"
- env_host_type: "{{ cluster }}-openshift-{{ type }}"
+ cluster: "{{ cluster_id }}"
+ env: "{{ cluster_env }}"
host_type: "{{ type }}"
sub_host_type: "{{ g_sub_host_type }}"
@@ -33,25 +33,25 @@
when: ec2_assign_public_ip is not defined
- set_fact:
- ec2_instance_type: "{{ ec2_master_instance_type | default(lookup('env', 'ec2_master_instance_type') | default(lookup('env', 'ec2_instance_type') | default(deployment_vars[deployment_type].type))) }}"
+ ec2_instance_type: "{{ ec2_master_instance_type | default(lookup('env', 'ec2_master_instance_type') | default(lookup('env', 'ec2_instance_type') | default(deployment_vars[deployment_type].type, true), true), 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(lookup('env', 'ec2_etcd_instance_type') | default(lookup('env', 'ec2_instance_type') | default(deployment_vars[deployment_type].type))) }}"
+ ec2_instance_type: "{{ ec2_etcd_instance_type | default(lookup('env', 'ec2_etcd_instance_type') | default(lookup('env', 'ec2_instance_type') | default(deployment_vars[deployment_type].type, true), true), 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(lookup('env', 'ec2_infra_instance_type') | default(lookup('env', 'ec2_instance_type') | default(deployment_vars[deployment_type].type))) }}"
+ ec2_instance_type: "{{ ec2_infra_instance_type | default(lookup('env', 'ec2_infra_instance_type') | default(lookup('env', 'ec2_instance_type') | default(deployment_vars[deployment_type].type, true), true), 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(lookup('env', 'ec2_node_instance_type') | default(lookup('env', 'ec2_instance_type') | default(deployment_vars[deployment_type].type))) }}"
+ ec2_instance_type: "{{ ec2_node_instance_type | default(lookup('env', 'ec2_node_instance_type') | default(lookup('env', 'ec2_instance_type') | default(deployment_vars[deployment_type].type, true), true), 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"
@@ -124,10 +124,9 @@
wait: yes
instance_tags:
created-by: "{{ created_by }}"
- environment: "{{ env }}"
- env: "{{ env }}"
+ clusterid: "{{ cluster }}"
+ environment: "{{ cluster_env }}"
host-type: "{{ host_type }}"
- env-host-type: "{{ env_host_type }}"
sub-host-type: "{{ sub_host_type }}"
volumes: "{{ volumes }}"
register: ec2
@@ -142,9 +141,8 @@
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 }},
- tag_sub-host-type_{{ sub_host_type }}"
+ instance_groups: "tag_created-by_{{ created_by }}, tag_clusterid_{{ cluster }}, tag_environment_{{ cluster_env }},
+ tag_host-type_{{ host_type }}, tag_sub-host-type_{{ sub_host_type }}"
- set_fact:
node_label:
diff --git a/playbooks/aws/openshift-cluster/terminate.yml b/playbooks/aws/openshift-cluster/terminate.yml
index 77287cad0..4b9c80b14 100644
--- a/playbooks/aws/openshift-cluster/terminate.yml
+++ b/playbooks/aws/openshift-cluster/terminate.yml
@@ -1,17 +1,18 @@
---
- name: Terminate instance(s)
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
vars_files:
- vars.yml
tasks:
- - set_fact: scratch_group=tag_env_{{ cluster_id }}
- add_host:
name: "{{ item }}"
groups: oo_hosts_to_terminate
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: groups[scratch_group] | default([]) | difference(['localhost'])
+ with_items: (groups['tag_clusterid_' ~ cluster_id] | default([])) | difference(['localhost'])
- name: Unsubscribe VMs
hosts: oo_hosts_to_terminate
@@ -25,36 +26,37 @@
- name: Terminate instances
hosts: localhost
connection: local
+ become: no
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:
+ ec2_tag:
+ resource: "{{ hostvars[item]['ec2_id'] }}"
+ region: "{{ hostvars[item]['ec2_region'] }}"
+ state: absent
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
+ 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: ["{{ item.ec2_id }}"]
- region: "{{ item.ec2_region }}"
+ instance_ids: ["{{ hostvars[item].ec2_id }}"]
+ region: "{{ hostvars[item].ec2_region }}"
ignore_errors: yes
register: ec2_term
- with_items: host_vars
+ 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.failed and not item.msg | search(\"error: EC2ResponseError: 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
@@ -63,7 +65,7 @@
instance_ids: ["{{ item.item.ec2_id }}"]
region: "{{ item.item.ec2_region }}"
register: ec2_stop
- when: "'oo_hosts_to_terminate' in groups and item.failed"
+ when: "'oo_hosts_to_terminate' in groups and item.has_key('failed') and item.failed"
with_items: ec2_term.results
- name: Rename stopped instances
diff --git a/playbooks/aws/openshift-cluster/update.yml b/playbooks/aws/openshift-cluster/update.yml
index e006aa74a..32bab76b5 100644
--- a/playbooks/aws/openshift-cluster/update.yml
+++ b/playbooks/aws/openshift-cluster/update.yml
@@ -1,19 +1,20 @@
---
-- name: Populate oo_hosts_to_update group
+- name: Update - Populate oo_hosts_to_update group
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
vars_files:
- vars.yml
+ - cluster_hosts.yml
tasks:
- - name: Evaluate oo_hosts_to_update
+ - name: Update - Evaluate oo_hosts_to_update
add_host:
name: "{{ item }}"
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"] | default([]))
- | union(groups["tag_env-host-type_{{ cluster_id }}-openshift-node"] | default([]))
- | union(groups["tag_env-host-type_{{ cluster_id }}-openshift-etcd"] | default([]))
+ with_items: "{{ g_all_hosts | default([]) }}"
- include: ../../common/openshift-cluster/update_repos_and_packages.yml
diff --git a/playbooks/aws/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml b/playbooks/aws/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
new file mode 100644
index 000000000..11026e38d
--- /dev/null
+++ b/playbooks/aws/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
@@ -0,0 +1,17 @@
+---
+# This playbook upgrades an existing AWS cluster, leaving nodes untouched if used with an 'online' deployment type.
+# Usage:
+# ansible-playbook playbooks/aws/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml -e deployment_type=online -e cluster_id=<cluster_id>
+- include: ../../../../common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
+ vars_files:
+ - "{{lookup('file', '../../../../aws/openshift-cluster/vars.yml')}}"
+ - "{{lookup('file', '../../../../aws/openshift-cluster/cluster_hosts.yml')}}"
+ vars:
+ g_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
+ g_sudo: "{{ deployment_vars[deployment_type].sudo }}"
+ g_nodeonmaster: true
+ openshift_cluster_id: "{{ cluster_id }}"
+ openshift_debug_level: "{{ debug_level }}"
+ openshift_deployment_type: "{{ deployment_type }}"
+ openshift_hostname: "{{ ec2_private_ip_address }}"
+ openshift_public_hostname: "{{ ec2_ip_address }}"
diff --git a/playbooks/aws/openshift-cluster/vars.yml b/playbooks/aws/openshift-cluster/vars.yml
index 95bc4b3e2..c8ee9bad4 100644
--- a/playbooks/aws/openshift-cluster/vars.yml
+++ b/playbooks/aws/openshift-cluster/vars.yml
@@ -1,8 +1,9 @@
---
+debug_level: 2
deployment_vars:
origin:
# centos-7, requires marketplace
- image: ami-96a818fe
+ image: ami-61bbf104
image_name:
region: us-east-1
ssh_user: centos
diff --git a/playbooks/byo/openshift-cluster/cluster_hosts.yml b/playbooks/byo/openshift-cluster/cluster_hosts.yml
new file mode 100644
index 000000000..e093b2580
--- /dev/null
+++ b/playbooks/byo/openshift-cluster/cluster_hosts.yml
@@ -0,0 +1,13 @@
+---
+g_etcd_hosts: "{{ groups.etcd | default([]) }}"
+
+g_lb_hosts: "{{ groups.lb | default([]) }}"
+
+g_master_hosts: "{{ groups.masters | default([]) }}"
+
+g_node_hosts: "{{ groups.nodes | default([]) }}"
+
+g_nfs_hosts: "{{ groups.nfs | default([]) }}"
+
+g_all_hosts: "{{ g_master_hosts | union(g_node_hosts) | union(g_etcd_hosts)
+ | union(g_lb_hosts) | default([]) }}"
diff --git a/playbooks/byo/openshift-cluster/config.yml b/playbooks/byo/openshift-cluster/config.yml
index 411c7e660..5887b3208 100644
--- a/playbooks/byo/openshift-cluster/config.yml
+++ b/playbooks/byo/openshift-cluster/config.yml
@@ -1,10 +1,8 @@
---
- include: ../../common/openshift-cluster/config.yml
+ vars_files:
+ - ../../byo/openshift-cluster/cluster_hosts.yml
vars:
- g_etcd_group: "{{ 'etcd' }}"
- g_masters_group: "{{ 'masters' }}"
- g_nodes_group: "{{ 'nodes' }}"
- g_lb_group: "{{ 'lb' }}"
openshift_cluster_id: "{{ cluster_id | default('default') }}"
- openshift_debug_level: 2
+ openshift_debug_level: "{{ debug_level | default(2) }}"
openshift_deployment_type: "{{ deployment_type }}"
diff --git a/playbooks/byo/openshift-cluster/scaleup.yml b/playbooks/byo/openshift-cluster/scaleup.yml
index 70644d427..1702690f6 100644
--- a/playbooks/byo/openshift-cluster/scaleup.yml
+++ b/playbooks/byo/openshift-cluster/scaleup.yml
@@ -1,10 +1,8 @@
---
- include: ../../common/openshift-cluster/scaleup.yml
+ vars_files:
+ - ../../byo/openshift-cluster/cluster_hosts.yml
vars:
- g_etcd_group: "{{ 'etcd' }}"
- g_masters_group: "{{ 'masters' }}"
- g_new_nodes_group: "{{ 'new_nodes' }}"
- g_lb_group: "{{ 'lb' }}"
openshift_cluster_id: "{{ cluster_id | default('default') }}"
- openshift_debug_level: 2
+ openshift_debug_level: "{{ debug_level | default(2) }}"
openshift_deployment_type: "{{ deployment_type }}"
diff --git a/playbooks/byo/openshift-cluster/upgrades/README.md b/playbooks/byo/openshift-cluster/upgrades/README.md
index ce7aebf8e..ca01dbc9d 100644
--- a/playbooks/byo/openshift-cluster/upgrades/README.md
+++ b/playbooks/byo/openshift-cluster/upgrades/README.md
@@ -1,6 +1,6 @@
# Upgrade playbooks
The playbooks provided in this directory can be used for upgrading an existing
-environment. Additional notes for the associated upgrade playbooks are
+cluster. Additional notes for the associated upgrade playbooks are
provided in their respective directories.
# Upgrades available
diff --git a/playbooks/byo/openshift-cluster/upgrades/v3_0_minor/upgrade.yml b/playbooks/byo/openshift-cluster/upgrades/v3_0_minor/upgrade.yml
index 76fa9ba22..b52456dcd 100644
--- a/playbooks/byo/openshift-cluster/upgrades/v3_0_minor/upgrade.yml
+++ b/playbooks/byo/openshift-cluster/upgrades/v3_0_minor/upgrade.yml
@@ -1,9 +1,12 @@
---
- include: ../../../../common/openshift-cluster/upgrades/v3_0_minor/upgrade.yml
+ vars_files:
+ - "{{lookup('file', '../../../../byo/openshift-cluster/cluster_hosts.yml')}}"
vars:
- g_etcd_group: "{{ 'etcd' }}"
- g_masters_group: "{{ 'masters' }}"
- g_nodes_group: "{{ 'nodes' }}"
- g_lb_group: "{{ 'lb' }}"
+ g_etcd_hosts: "{{ groups.etcd | default([]) }}"
+ g_master_hosts: "{{ groups.masters | default([]) }}"
+ g_nfs_hosts: "{{ groups.nfs | default([]) }}"
+ g_node_hosts: "{{ groups.nodes | default([]) }}"
+ g_lb_hosts: "{{ groups.lb | default([]) }}"
openshift_cluster_id: "{{ cluster_id | default('default') }}"
openshift_deployment_type: "{{ deployment_type }}"
diff --git a/playbooks/byo/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml b/playbooks/byo/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
index b06442366..e07e2b88e 100644
--- a/playbooks/byo/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
+++ b/playbooks/byo/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
@@ -1,9 +1,12 @@
---
- include: ../../../../common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
+ vars_files:
+ - "{{lookup('file', '../../../../byo/openshift-cluster/cluster_hosts.yml')}}"
vars:
- g_etcd_group: "{{ 'etcd' }}"
- g_masters_group: "{{ 'masters' }}"
- g_nodes_group: "{{ 'nodes' }}"
- g_lb_group: "{{ 'lb' }}"
+ g_etcd_hosts: "{{ groups.etcd | default([]) }}"
+ g_master_hosts: "{{ groups.masters | default([]) }}"
+ g_nfs_hosts: "{{ groups.nfs | default([]) }}"
+ g_node_hosts: "{{ groups.nodes | default([]) }}"
+ g_lb_hosts: "{{ groups.lb | default([]) }}"
openshift_cluster_id: "{{ cluster_id | default('default') }}"
openshift_deployment_type: "{{ deployment_type }}"
diff --git a/playbooks/byo/openshift_facts.yml b/playbooks/byo/openshift_facts.yml
index 6d7c12fd4..babdfb952 100644
--- a/playbooks/byo/openshift_facts.yml
+++ b/playbooks/byo/openshift_facts.yml
@@ -1,7 +1,6 @@
---
- name: Gather Cluster facts
- hosts: all
- gather_facts: no
+ hosts: OSEv3
roles:
- openshift_facts
tasks:
diff --git a/playbooks/common/openshift-cluster/config.yml b/playbooks/common/openshift-cluster/config.yml
index a8bd634d3..11e5b68f6 100644
--- a/playbooks/common/openshift-cluster/config.yml
+++ b/playbooks/common/openshift-cluster/config.yml
@@ -1,11 +1,12 @@
---
- include: evaluate_groups.yml
+- include: ../openshift-docker/config.yml
+
- include: ../openshift-etcd/config.yml
+- include: ../openshift-nfs/config.yml
+
- include: ../openshift-master/config.yml
- include: ../openshift-node/config.yml
- vars:
- osn_cluster_dns_domain: "{{ hostvars[groups.oo_first_master.0].openshift.dns.domain }}"
- osn_cluster_dns_ip: "{{ hostvars[groups.oo_first_master.0].cluster_dns_ip }}"
diff --git a/playbooks/common/openshift-cluster/evaluate_groups.yml b/playbooks/common/openshift-cluster/evaluate_groups.yml
index 34da372a4..db7105ed5 100644
--- a/playbooks/common/openshift-cluster/evaluate_groups.yml
+++ b/playbooks/common/openshift-cluster/evaluate_groups.yml
@@ -1,23 +1,33 @@
---
- name: Populate config host groups
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
tasks:
- fail:
- msg: This playbook requires g_etcd_group to be set
- when: g_etcd_group is not defined
+ msg: This playbook requires g_etcd_hosts to be set
+ when: g_etcd_hosts is not defined
- fail:
- msg: This playbook requires g_masters_group to be set
- when: g_masters_group is not defined
+ msg: This playbook requires g_master_hosts to be set
+ when: g_master_hosts is not defined
- fail:
- msg: This playbook requires g_nodes_group or g_new_nodes_group to be set
- when: g_nodes_group is not defined and g_new_nodes_group is not defined
+ msg: This playbook requires g_node_hosts or g_new_node_hosts to be set
+ when: g_node_hosts is not defined and g_new_node_hosts is not defined
- fail:
- msg: This playbook requires g_lb_group to be set
- when: g_lb_group is not defined
+ msg: This playbook requires g_lb_hosts to be set
+ when: g_lb_hosts is not defined
+
+ - fail:
+ msg: This playbook requires g_nfs_hosts to be set
+ when: g_nfs_hosts is not defined
+
+ - fail:
+ msg: The nfs group must be limited to one host
+ when: (groups[g_nfs_hosts] | default([])) | length > 1
- name: Evaluate oo_etcd_to_config
add_host:
@@ -25,7 +35,7 @@
groups: oo_etcd_to_config
ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
ansible_sudo: "{{ g_sudo | default(omit) }}"
- with_items: groups[g_etcd_group] | default([])
+ with_items: "{{ g_etcd_hosts | default([]) }}"
- name: Evaluate oo_masters_to_config
add_host:
@@ -33,11 +43,11 @@
groups: oo_masters_to_config
ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
ansible_sudo: "{{ g_sudo | default(omit) }}"
- with_items: groups[g_masters_group] | default([])
+ with_items: "{{ g_master_hosts | default([]) }}"
- # Use g_new_nodes_group if it exists otherwise g_nodes_group
+ # Use g_new_node_hosts if it exists otherwise g_node_hosts
- set_fact:
- g_nodes_to_config: "{{ g_new_nodes_group | default(g_nodes_group | default([])) }}"
+ g_node_hosts_to_config: "{{ g_new_node_hosts | default(g_node_hosts | default([])) }}"
- name: Evaluate oo_nodes_to_config
add_host:
@@ -45,32 +55,32 @@
groups: oo_nodes_to_config
ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
ansible_sudo: "{{ g_sudo | default(omit) }}"
- with_items: groups[g_nodes_to_config] | default([])
+ with_items: "{{ g_node_hosts_to_config | default([]) }}"
- # Skip adding the master to oo_nodes_to_config when g_new_nodes_group is
+ # Skip adding the master to oo_nodes_to_config when g_new_node_hosts is
- 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 | default(false) == true and g_new_nodes_group is not defined
+ with_items: "{{ g_master_hosts | default([]) }}"
+ when: g_nodeonmaster | default(false) == true and g_new_node_hosts is not defined
- name: Evaluate oo_first_etcd
add_host:
- name: "{{ groups[g_etcd_group][0] }}"
+ name: "{{ g_etcd_hosts[0] }}"
groups: oo_first_etcd
ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
- when: g_etcd_group in groups and (groups[g_etcd_group] | length) > 0
+ when: g_etcd_hosts|length > 0
- name: Evaluate oo_first_master
add_host:
- name: "{{ groups[g_masters_group][0] }}"
+ name: "{{ g_master_hosts[0] }}"
groups: oo_first_master
ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
ansible_sudo: "{{ g_sudo | default(omit) }}"
- when: g_masters_group in groups and (groups[g_masters_group] | length) > 0
+ when: g_master_hosts|length > 0
- name: Evaluate oo_lb_to_config
add_host:
@@ -78,4 +88,12 @@
groups: oo_lb_to_config
ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
ansible_sudo: "{{ g_sudo | default(omit) }}"
- with_items: groups[g_lb_group] | default([])
+ with_items: "{{ g_lb_hosts | default([]) }}"
+
+ - name: Evaluate oo_nfs_to_config
+ add_host:
+ name: "{{ item }}"
+ groups: oo_nfs_to_config
+ ansible_ssh_user: "{{ g_ssh_user | default(omit) }}"
+ ansible_sudo: "{{ g_sudo | default(omit) }}"
+ with_items: "{{ g_nfs_hosts | default([]) }}"
diff --git a/playbooks/common/openshift-cluster/scaleup.yml b/playbooks/common/openshift-cluster/scaleup.yml
index e1778e41e..d2ba3fc7a 100644
--- a/playbooks/common/openshift-cluster/scaleup.yml
+++ b/playbooks/common/openshift-cluster/scaleup.yml
@@ -3,6 +3,4 @@
- include: ../openshift-node/config.yml
vars:
- osn_cluster_dns_domain: "{{ hostvars[groups.oo_first_master.0].openshift.dns.domain }}"
- osn_cluster_dns_ip: "{{ hostvars[groups.oo_first_master.0].openshift.dns.ip }}"
openshift_deployment_type: "{{ deployment_type }}"
diff --git a/playbooks/common/openshift-cluster/update_repos_and_packages.yml b/playbooks/common/openshift-cluster/update_repos_and_packages.yml
index 190e2d862..9a303c62d 100644
--- a/playbooks/common/openshift-cluster/update_repos_and_packages.yml
+++ b/playbooks/common/openshift-cluster/update_repos_and_packages.yml
@@ -8,5 +8,6 @@
ansible_distribution == "RedHat" and
lookup('oo_option', 'rhel_skip_subscription') | default(rhsub_skip, True) |
default('no', True) | lower in ['no', 'false']
+ and not openshift.common.is_atomic | bool
- openshift_repos
- os_update_latest
diff --git a/playbooks/common/openshift-cluster/upgrades/files/pre-upgrade-check b/playbooks/common/openshift-cluster/upgrades/files/pre-upgrade-check
index b5459f312..e5c958ebb 100644
--- a/playbooks/common/openshift-cluster/upgrades/files/pre-upgrade-check
+++ b/playbooks/common/openshift-cluster/upgrades/files/pre-upgrade-check
@@ -111,13 +111,16 @@ def print_validation_header():
overwhelming the user.
"""
print """\
-At least one port name does not validate. Valid port names:
+At least one port name is invalid and must be corrected before upgrading.
+Please update or remove any resources with invalid port names.
- * must be less that 16 chars
+ Valid port names must:
+
+ * be less that 16 characters
* have at least one letter
- * only a-z0-9-
- * do not start or end with -
- * Dashes may not be next to eachother ('--')
+ * contain only a-z0-9-
+ * not start or end with -
+ * not contain dashes next to each other ('--')
"""
@@ -142,9 +145,9 @@ def main():
# Where the magic happens
first_error = True
for kind, path in [
+ ('deploymentconfigs', ("spec", "template", "spec", "containers")),
('replicationcontrollers', ("spec", "template", "spec", "containers")),
- ('pods', ("spec", "containers")),
- ('deploymentconfigs', ("spec", "template", "spec", "containers"))]:
+ ('pods', ("spec", "containers"))]:
for item in list_items(kind):
namespace = item["metadata"]["namespace"]
item_name = item["metadata"]["name"]
diff --git a/playbooks/common/openshift-cluster/upgrades/files/versions.sh b/playbooks/common/openshift-cluster/upgrades/files/versions.sh
index c7c966b60..b46407ed7 100644
--- a/playbooks/common/openshift-cluster/upgrades/files/versions.sh
+++ b/playbooks/common/openshift-cluster/upgrades/files/versions.sh
@@ -1,9 +1,8 @@
#!/bin/bash
-yum_installed=$(yum list installed "$@" 2>&1 | tail -n +2 | grep -v 'Installed Packages' | grep -v 'Red Hat Subscription Management' | grep -v 'Error:' | awk '{ print $2 }' | tr '\n' ' ')
-
-yum_available=$(yum list available -q "$@" 2>&1 | tail -n +2 | grep -v 'Available Packages' | grep -v 'Red Hat Subscription Management' | grep -v 'el7ose' | grep -v 'Error:' | awk '{ print $2 }' | tr '\n' ' ')
+yum_installed=$(yum list installed -e 0 -q "$@" 2>&1 | tail -n +2 | awk '{ print $2 }' | tr '\n' ' ')
+yum_available=$(yum list available -e 0 -q "$@" 2>&1 | tail -n +2 | grep -v 'el7ose' | awk '{ print $2 }' | tr '\n' ' ')
echo "---"
echo "curr_version: ${yum_installed}"
diff --git a/playbooks/common/openshift-cluster/upgrades/v3_0_minor/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_0_minor/upgrade.yml
index 9f7e49b93..63c8ef756 100644
--- a/playbooks/common/openshift-cluster/upgrades/v3_0_minor/upgrade.yml
+++ b/playbooks/common/openshift-cluster/upgrades/v3_0_minor/upgrade.yml
@@ -11,7 +11,7 @@
openshift_version: "{{ openshift_pkg_version | default('') }}"
tasks:
- name: Upgrade master packages
- yum: pkg={{ openshift.common.service_type }}-master{{ openshift_version }} state=latest
+ action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-master{{ openshift_version }} state=latest"
- name: Restart master services
service: name="{{ openshift.common.service_type}}-master" state=restarted
@@ -21,7 +21,7 @@
openshift_version: "{{ openshift_pkg_version | default('') }}"
tasks:
- name: Upgrade node packages
- yum: pkg={{ openshift.common.service_type }}-node{{ openshift_version }} state=latest
+ action: "{{ ansible_pkg_mgr }} name={{ openshift.common.service_type }}-node{{ openshift_version }} state=latest"
- name: Restart node services
service: name="{{ openshift.common.service_type }}-node" state=restarted
diff --git a/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml b/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
index 99008446d..68df2153d 100644
--- a/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
+++ b/playbooks/common/openshift-cluster/upgrades/v3_0_to_v3_1/upgrade.yml
@@ -12,6 +12,8 @@
- name: Evaluate additional groups for upgrade
hosts: localhost
+ connection: local
+ become: no
tasks:
- name: Evaluate etcd_hosts_to_backup
add_host:
@@ -37,9 +39,9 @@
- fail:
msg: >
- This upgrade is only supported for origin and openshift-enterprise
+ This upgrade is only supported for origin, openshift-enterprise, and online
deployment types
- when: deployment_type not in ['origin','openshift-enterprise']
+ when: deployment_type not in ['origin','openshift-enterprise', 'online']
- fail:
msg: >
@@ -57,8 +59,8 @@
vars:
target_version: "{{ '1.1' if deployment_type == 'origin' else '3.1' }}"
tasks:
- - name: Clean yum cache
- command: yum clean all
+ - name: Clean package cache
+ command: "{{ ansible_pkg_mgr }} clean all"
- set_fact:
g_new_service_name: "{{ 'origin' if deployment_type =='origin' else 'atomic-openshift' }}"
@@ -90,6 +92,8 @@
##############################################################################
- name: Gate on pre-upgrade checks
hosts: localhost
+ connection: local
+ become: no
vars:
pre_upgrade_hosts: "{{ groups.oo_masters_to_config | union(groups.oo_nodes_to_config) }}"
tasks:
@@ -152,9 +156,7 @@
when: (embedded_etcd | bool) and (etcd_disk_usage.stdout|int > avail_disk.stdout|int)
- name: Install etcd (for etcdctl)
- yum:
- pkg: etcd
- state: latest
+ action: "{{ ansible_pkg_mgr }} name=etcd state=latest"
- name: Generate etcd backup
command: >
@@ -174,6 +176,8 @@
##############################################################################
- name: Gate on etcd backup
hosts: localhost
+ connection: local
+ become: no
tasks:
- set_fact:
etcd_backup_completed: "{{ hostvars
@@ -192,6 +196,8 @@
###############################################################################
- name: Create temp directory for syncing certs
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
tasks:
- name: Create local temp directory for syncing certs
@@ -225,17 +231,14 @@
openshift_version: "{{ openshift_pkg_version | default('') }}"
tasks:
- name: Upgrade to latest available kernel
- yum:
- pkg: kernel
- state: latest
+ action: "{{ ansible_pkg_mgr}} name=kernel state=latest"
- name: Upgrade master packages
- command: yum update -y {{ openshift.common.service_type }}-master{{ openshift_version }}
+ command: "{{ ansible_pkg_mgr}} update -y {{ openshift.common.service_type }}-master{{ openshift_version }}"
- name: Ensure python-yaml present for config upgrade
- yum:
- pkg: PyYAML
- state: installed
+ action: "{{ ansible_pkg_mgr }} name=PyYAML state=present"
+ when: not openshift.common.is_atomic | bool
- name: Upgrade master configuration
openshift_upgrade_config:
@@ -342,6 +345,8 @@
- name: Delete temporary directory on localhost
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
tasks:
- file: name={{ g_master_mktemp.stdout }} state=absent
@@ -360,6 +365,8 @@
##############################################################################
- name: Gate on master update
hosts: localhost
+ connection: local
+ become: no
tasks:
- set_fact:
master_update_completed: "{{ hostvars
@@ -383,7 +390,7 @@
- openshift_facts
tasks:
- name: Upgrade node packages
- command: yum update -y {{ openshift.common.service_type }}-node{{ openshift_version }}
+ command: "{{ ansible_pkg_mgr }} update -y {{ openshift.common.service_type }}-node{{ openshift_version }}"
- name: Restart node service
service: name="{{ openshift.common.service_type }}-node" state=restarted
@@ -400,6 +407,8 @@
##############################################################################
- name: Gate on nodes update
hosts: localhost
+ connection: local
+ become: no
tasks:
- set_fact:
node_update_completed: "{{ hostvars
@@ -467,6 +476,8 @@
##############################################################################
- name: Gate on reconcile
hosts: localhost
+ connection: local
+ become: no
tasks:
- set_fact:
reconcile_completed: "{{ hostvars
diff --git a/playbooks/common/openshift-docker/config.yml b/playbooks/common/openshift-docker/config.yml
new file mode 100644
index 000000000..092d5533c
--- /dev/null
+++ b/playbooks/common/openshift-docker/config.yml
@@ -0,0 +1,9 @@
+- name: Configure docker hosts
+ hosts: oo_masters_to_config:oo_nodes_to_config:oo_etcd_to_config
+ vars:
+ docker_additional_registries: "{{ lookup('oo_option', 'docker_additional_registries') | oo_split }}"
+ docker_insecure_registries: "{{ lookup('oo_option', 'docker_insecure_registries') | oo_split }}"
+ docker_blocked_registries: "{{ lookup('oo_option', 'docker_blocked_registries') | oo_split }}"
+ roles:
+ - openshift_facts
+ - openshift_docker
diff --git a/playbooks/common/openshift-docker/filter_plugins b/playbooks/common/openshift-docker/filter_plugins
new file mode 120000
index 000000000..99a95e4ca
--- /dev/null
+++ b/playbooks/common/openshift-docker/filter_plugins
@@ -0,0 +1 @@
+../../../filter_plugins \ No newline at end of file
diff --git a/playbooks/common/openshift-docker/lookup_plugins b/playbooks/common/openshift-docker/lookup_plugins
new file mode 120000
index 000000000..ac79701db
--- /dev/null
+++ b/playbooks/common/openshift-docker/lookup_plugins
@@ -0,0 +1 @@
+../../../lookup_plugins \ No newline at end of file
diff --git a/playbooks/common/openshift-docker/roles b/playbooks/common/openshift-docker/roles
new file mode 120000
index 000000000..20c4c58cf
--- /dev/null
+++ b/playbooks/common/openshift-docker/roles
@@ -0,0 +1 @@
+../../../roles \ No newline at end of file
diff --git a/playbooks/common/openshift-etcd/config.yml b/playbooks/common/openshift-etcd/config.yml
index 7d94ced2e..9a5ae0e6b 100644
--- a/playbooks/common/openshift-etcd/config.yml
+++ b/playbooks/common/openshift-etcd/config.yml
@@ -14,7 +14,8 @@
public_hostname: "{{ openshift_public_hostname | default(None) }}"
deployment_type: "{{ openshift_deployment_type }}"
- role: etcd
- local_facts: {}
+ local_facts:
+ etcd_image: "{{ osm_etcd_image | default(None) }}"
- name: Check status of etcd certificates
stat:
path: "{{ item }}"
@@ -33,7 +34,7 @@
- name: Create temp directory for syncing certs
hosts: localhost
connection: local
- sudo: false
+ become: no
gather_facts: no
tasks:
- name: Create local temp directory for syncing certs
@@ -88,11 +89,12 @@
roles:
- etcd
- role: nickhammond.logrotate
+ when: not openshift.common.is_containerized | bool
- name: Delete temporary directory on localhost
hosts: localhost
connection: local
- sudo: false
+ become: no
gather_facts: no
tasks:
- file: name={{ g_etcd_mktemp.stdout }} state=absent
diff --git a/playbooks/common/openshift-etcd/service.yml b/playbooks/common/openshift-etcd/service.yml
index 0bf69b22f..fd2bc24ae 100644
--- a/playbooks/common/openshift-etcd/service.yml
+++ b/playbooks/common/openshift-etcd/service.yml
@@ -1,6 +1,8 @@
---
- name: Populate g_service_masters host group if needed
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
tasks:
- fail: msg="new_cluster_state is required to be injected in this playbook"
diff --git a/playbooks/common/openshift-master/config.yml b/playbooks/common/openshift-master/config.yml
index 1c8a92122..677c274c4 100644
--- a/playbooks/common/openshift-master/config.yml
+++ b/playbooks/common/openshift-master/config.yml
@@ -70,7 +70,7 @@
- name: Create temp directory for syncing certs
hosts: localhost
connection: local
- sudo: false
+ become: no
gather_facts: no
tasks:
- name: Create local temp directory for syncing certs
@@ -207,7 +207,7 @@
- name: Compute haproxy_backend_servers
hosts: localhost
connection: local
- sudo: false
+ become: no
gather_facts: no
tasks:
- set_fact:
@@ -232,42 +232,41 @@
balance: source
servers: "{{ hostvars.localhost.haproxy_backend_servers }}"
roles:
+ - role: openshift_facts
- role: haproxy
when: groups.oo_masters_to_config | length > 1
-- name: Generate master session keys
+- name: Check for cached session secrets
hosts: oo_first_master
+ roles:
+ - role: openshift_facts
+ post_tasks:
+ - openshift_facts:
+ role: master
+ local_facts:
+ session_auth_secrets: "{{ openshift_master_session_auth_secrets | default(openshift.master.session_auth_secrets | default(None)) }}"
+ session_encryption_secrets: "{{ openshift_master_session_encryption_secrets | default(openshift.master.session_encryption_secrets | default(None)) }}"
+
+- name: Generate master session secrets
+ hosts: oo_first_master
+ vars:
+ g_session_secrets_present: "{{ (openshift.master.session_auth_secrets | default([]) and openshift.master.session_encryption_secrets | default([])) | length > 0 }}"
+ g_session_auth_secrets: "{{ [ 24 | oo_generate_secret ] }}"
+ g_session_encryption_secrets: "{{ [ 24 | oo_generate_secret ] }}"
+ roles:
+ - role: openshift_facts
tasks:
- - fail:
- msg: "Both openshift_master_session_auth_secrets and openshift_master_session_encryption_secrets must be provided if either variable is set"
- when: (openshift_master_session_auth_secrets is defined and openshift_master_session_encryption_secrets is not defined) or (openshift_master_session_encryption_secrets is defined and openshift_master_session_auth_secrets is not defined)
- - fail:
- msg: "openshift_master_session_auth_secrets and openshift_master_encryption_secrets must be equal length"
- when: (openshift_master_session_auth_secrets is defined and openshift_master_session_encryption_secrets is defined) and (openshift_master_session_auth_secrets | length != openshift_master_session_encryption_secrets | length)
- - name: Install OpenSSL package
- action: "{{ansible_pkg_mgr}} pkg=openssl state=present"
- - name: Generate session authentication key
- command: /usr/bin/openssl rand -base64 24
- register: session_auth_output
- with_sequence: count=1
- when: openshift_master_session_auth_secrets is undefined
- - name: Generate session encryption key
- command: /usr/bin/openssl rand -base64 24
- register: session_encryption_output
- with_sequence: count=1
- when: openshift_master_session_encryption_secrets is undefined
- - set_fact:
- session_auth_secret: "{{ openshift_master_session_auth_secrets
- | default(session_auth_output.results
- | oo_collect(attribute='stdout')
- | list) }}"
- session_encryption_secret: "{{ openshift_master_session_encryption_secrets
- | default(session_encryption_output.results
- | oo_collect(attribute='stdout')
- | list) }}"
+ - openshift_facts:
+ role: master
+ local_facts:
+ session_auth_secrets: "{{ g_session_auth_secrets }}"
+ session_encryption_secrets: "{{ g_session_encryption_secrets }}"
+ when: not g_session_secrets_present | bool
- name: Parse named certificates
hosts: localhost
+ connection: local
+ become: no
vars:
internal_hostnames: "{{ hostvars[groups.oo_first_master.0].openshift.common.internal_hostnames }}"
named_certificates: "{{ hostvars[groups.oo_first_master.0].openshift_master_named_certificates | default([]) }}"
@@ -318,8 +317,8 @@
sync_tmpdir: "{{ hostvars.localhost.g_master_mktemp.stdout }}"
openshift_master_ha: "{{ groups.oo_masters_to_config | length > 1 }}"
openshift_master_count: "{{ groups.oo_masters_to_config | length }}"
- openshift_master_session_auth_secrets: "{{ hostvars[groups['oo_first_master'][0]]['session_auth_secret'] }}"
- openshift_master_session_encryption_secrets: "{{ hostvars[groups['oo_first_master'][0]]['session_encryption_secret'] }}"
+ openshift_master_session_auth_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_auth_secrets }}"
+ openshift_master_session_encryption_secrets: "{{ hostvars[groups.oo_first_master.0].openshift.master.session_encryption_secrets }}"
pre_tasks:
- name: Ensure certificate directory exists
file:
@@ -334,6 +333,7 @@
roles:
- openshift_master
- role: nickhammond.logrotate
+ when: not openshift.common.is_containerized | bool
- role: fluentd_master
when: openshift.common.use_fluentd | bool
post_tasks:
@@ -349,25 +349,12 @@
roles:
- role: openshift_master_cluster
when: openshift_master_ha | bool and openshift.master.cluster_method == "pacemaker"
- - openshift_examples
+ - role: openshift_examples
+ when: openshift.common.install_examples | bool
- role: openshift_cluster_metrics
when: openshift.common.use_cluster_metrics | bool
-
- # TODO: Setting the cluster dns ip should be pushed into openshift-facts
-- name: Determine cluster dns ip
- hosts: oo_first_master
- tasks:
- - name: Get master service ip
- # This command has to be on a single line.
- command: "{{ openshift.common.client_binary }} -n default --config={{ openshift.common.config_base }}/master/admin.kubeconfig get -o template svc kubernetes --template=\\{\\{.spec.clusterIP\\}\\} --output-version=v1"
- register: master_service_ip_output
- when: openshift.common.version_greater_than_3_1_or_1_1 | bool
- - set_fact:
- cluster_dns_ip: "{{ hostvars[groups.oo_first_master.0].openshift.dns.ip }}"
- when: not openshift.common.version_greater_than_3_1_or_1_1 | bool
- - set_fact:
- cluster_dns_ip: "{{ master_service_ip_output.stdout }}"
- when: openshift.common.version_greater_than_3_1_or_1_1 | bool
+ - role: openshift_manageiq
+ when: openshift.common.use_manageiq | bool
- name: Enable cockpit
hosts: oo_first_master
@@ -375,7 +362,7 @@
cockpit_plugins: "{{ osm_cockpit_plugins | default(['cockpit-kubernetes']) }}"
roles:
- role: cockpit
- when: ( deployment_type in ['atomic-enterprise','openshift-enterprise'] ) and
+ when: not openshift.common.is_containerized and ( deployment_type in ['atomic-enterprise','openshift-enterprise'] ) and
(osm_use_cockpit | bool or osm_use_cockpit is undefined )
- name: Configure flannel
@@ -396,7 +383,7 @@
- name: Delete temporary directory on localhost
hosts: localhost
connection: local
- sudo: false
+ become: no
gather_facts: no
tasks:
- file: name={{ g_master_mktemp.stdout }} state=absent
@@ -413,7 +400,15 @@
- name: Create services
hosts: oo_first_master
+ vars:
+ attach_registry_volume: "{{ groups.oo_nfs_to_config | length > 0 }}"
+ pre_tasks:
+ - set_fact:
+ nfs_host: "{{ groups.oo_nfs_to_config.0 }}"
+ registry_volume_path: "{{ hostvars[groups.oo_nfs_to_config.0].openshift.nfs.exports_dir + '/' + hostvars[groups.oo_nfs_to_config.0].openshift.nfs.registry_volume }}"
+ when: attach_registry_volume | bool
roles:
- role: openshift_router
when: openshift.master.infra_nodes is defined
- #- role: openshift_registry
+ - role: openshift_registry
+ when: openshift.master.infra_nodes is defined and attach_registry_volume | bool
diff --git a/playbooks/common/openshift-master/service.yml b/playbooks/common/openshift-master/service.yml
index 27e1e66f9..f60c5a2b5 100644
--- a/playbooks/common/openshift-master/service.yml
+++ b/playbooks/common/openshift-master/service.yml
@@ -2,6 +2,8 @@
- name: Populate g_service_masters host group if needed
hosts: localhost
gather_facts: no
+ connection: local
+ become: no
tasks:
- fail: msg="new_cluster_state is required to be injected in this playbook"
when: new_cluster_state is not defined
diff --git a/playbooks/common/openshift-nfs/config.yml b/playbooks/common/openshift-nfs/config.yml
new file mode 100644
index 000000000..e3f5c17ca
--- /dev/null
+++ b/playbooks/common/openshift-nfs/config.yml
@@ -0,0 +1,5 @@
+---
+- name: Configure nfs hosts
+ hosts: oo_nfs_to_config
+ roles:
+ - role: openshift_storage_nfs
diff --git a/playbooks/common/openshift-nfs/filter_plugins b/playbooks/common/openshift-nfs/filter_plugins
new file mode 120000
index 000000000..99a95e4ca
--- /dev/null
+++ b/playbooks/common/openshift-nfs/filter_plugins
@@ -0,0 +1 @@
+../../../filter_plugins \ No newline at end of file
diff --git a/playbooks/common/openshift-nfs/lookup_plugins b/playbooks/common/openshift-nfs/lookup_plugins
new file mode 120000
index 000000000..ac79701db
--- /dev/null
+++ b/playbooks/common/openshift-nfs/lookup_plugins
@@ -0,0 +1 @@
+../../../lookup_plugins \ No newline at end of file
diff --git a/playbooks/common/openshift-nfs/roles b/playbooks/common/openshift-nfs/roles
new file mode 120000
index 000000000..e2b799b9d
--- /dev/null
+++ b/playbooks/common/openshift-nfs/roles
@@ -0,0 +1 @@
+../../../roles/ \ No newline at end of file
diff --git a/playbooks/common/openshift-nfs/service.yml b/playbooks/common/openshift-nfs/service.yml
new file mode 100644
index 000000000..20c8ca248
--- /dev/null
+++ b/playbooks/common/openshift-nfs/service.yml
@@ -0,0 +1,18 @@
+---
+- name: Populate g_service_nfs host group if needed
+ hosts: localhost
+ gather_facts: no
+ tasks:
+ - fail: msg="new_cluster_state is required to be injected in this playbook"
+ when: new_cluster_state is not defined
+
+ - name: Evaluate g_service_nfs
+ add_host: name={{ item }} groups=g_service_nfs
+ with_items: oo_host_group_exp | default([])
+
+- name: Change state on nfs instance(s)
+ hosts: g_service_nfs
+ connection: ssh
+ gather_facts: no
+ tasks:
+ - service: name=nfs-server state="{{ new_cluster_state }}"
diff --git a/playbooks/common/openshift-node/config.yml b/playbooks/common/openshift-node/config.yml
index 2b6171cb3..483a7768c 100644
--- a/playbooks/common/openshift-node/config.yml
+++ b/playbooks/common/openshift-node/config.yml
@@ -16,6 +16,7 @@
hostname: "{{ openshift_hostname | default(None) }}"
public_hostname: "{{ openshift_public_hostname | default(None) }}"
deployment_type: "{{ openshift_deployment_type }}"
+ use_flannel: "{{ openshift_use_flannel | default(None) }}"
- role: node
local_facts:
labels: "{{ openshift_node_labels | default(None) }}"
@@ -58,7 +59,7 @@
- name: Create temp directory for syncing certs
hosts: localhost
connection: local
- sudo: false
+ become: no
gather_facts: no
tasks:
- name: Create local temp directory for syncing certs
@@ -158,8 +159,10 @@
vars:
sync_tmpdir: "{{ hostvars.localhost.mktemp.stdout }}"
openshift_node_master_api_url: "{{ hostvars[groups.oo_first_master.0].openshift.master.api_url }}"
+ # TODO: Prefix flannel role variables.
etcd_urls: "{{ hostvars[groups.oo_first_master.0].openshift.master.etcd_urls }}"
embedded_etcd: "{{ hostvars[groups.oo_first_master.0].openshift.master.embedded_etcd }}"
+ openshift_node_first_master_ip: "{{ hostvars[groups.oo_first_master.0].openshift.common.ip }}"
pre_tasks:
- name: Ensure certificate directory exists
file:
@@ -179,6 +182,7 @@
- role: flannel
when: openshift.common.use_flannel | bool
- role: nickhammond.logrotate
+ when: not openshift.common.is_containerized | bool
- role: fluentd_node
when: openshift.common.use_fluentd | bool
tasks:
@@ -189,7 +193,7 @@
- name: Delete temporary directory on localhost
hosts: localhost
connection: local
- sudo: false
+ become: no
gather_facts: no
tasks:
- file: name={{ mktemp.stdout }} state=absent
diff --git a/playbooks/common/openshift-node/service.yml b/playbooks/common/openshift-node/service.yml
index 5cf83e186..0f07add2a 100644
--- a/playbooks/common/openshift-node/service.yml
+++ b/playbooks/common/openshift-node/service.yml
@@ -1,6 +1,8 @@
---
- name: Populate g_service_nodes host group if needed
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
tasks:
- fail: msg="new_cluster_state is required to be injected in this playbook"
diff --git a/playbooks/gce/openshift-cluster/cluster_hosts.yml b/playbooks/gce/openshift-cluster/cluster_hosts.yml
new file mode 100644
index 000000000..2bfcedfc9
--- /dev/null
+++ b/playbooks/gce/openshift-cluster/cluster_hosts.yml
@@ -0,0 +1,22 @@
+---
+g_etcd_hosts: "{{ (groups['tag_host-type-etcd']|default([]))
+ | intersect((groups['tag_clusterid-' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}"
+
+g_lb_hosts: "{{ (groups['tag_host-type-lb']|default([]))
+ | intersect((groups['tag_clusterid-' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}"
+
+g_master_hosts: "{{ (groups['tag_host-type-master']|default([]))
+ | intersect((groups['tag_clusterid-' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}"
+
+g_node_hosts: "{{ (groups['tag_host-type-node']|default([]))
+ | intersect((groups['tag_clusterid-' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}"
+
+g_nfs_hosts: "{{ (groups['tag_host-type-nfs']|default([]))
+ | intersect((groups['tag_environment-' ~ cluster_id]|default([]))) }}"
+
+g_all_hosts: "{{ g_master_hosts | union(g_node_hosts) | union(g_etcd_hosts)
+ | union(g_lb_hosts) | default([]) }}"
diff --git a/playbooks/gce/openshift-cluster/config.yml b/playbooks/gce/openshift-cluster/config.yml
index 745161bcb..3231ecc8e 100644
--- a/playbooks/gce/openshift-cluster/config.yml
+++ b/playbooks/gce/openshift-cluster/config.yml
@@ -1,30 +1,16 @@
---
# TODO: fix firewall related bug with GCE and origin, since GCE is overriding
# /etc/sysconfig/iptables
-
-- hosts: localhost
- gather_facts: no
- vars_files:
- - vars.yml
- tasks:
- - set_fact:
- g_ssh_user_tmp: "{{ deployment_vars[deployment_type].ssh_user }}"
- g_sudo_tmp: "{{ deployment_vars[deployment_type].sudo }}"
- use_sdn: "{{ do_we_use_openshift_sdn }}"
- sdn_plugin: "{{ sdn_network_plugin }}"
-
- include: ../../common/openshift-cluster/config.yml
+ vars_files:
+ - ../../gce/openshift-cluster/vars.yml
+ - ../../gce/openshift-cluster/cluster_hosts.yml
vars:
- g_etcd_group: "{{ 'tag_env-host-type-' ~ cluster_id ~ '-openshift-etcd' }}"
- g_lb_group: "{{ 'tag_env-host-type-' ~ cluster_id ~ '-openshift-lb' }}"
- 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_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
+ g_sudo: "{{ deployment_vars[deployment_type].sudo }}"
g_nodeonmaster: true
openshift_cluster_id: "{{ cluster_id }}"
- openshift_debug_level: 2
+ openshift_debug_level: "{{ debug_level }}"
openshift_deployment_type: "{{ deployment_type }}"
openshift_hostname: "{{ gce_private_ip }}"
- openshift_use_openshift_sdn: "{{ hostvars.localhost.use_sdn }}"
- os_sdn_network_plugin_name: "{{ hostvars.localhost.sdn_plugin }}"
+ openshift_use_openshift_sdn: "{{ do_we_use_openshift_sdn }}"
diff --git a/playbooks/gce/openshift-cluster/join_node.yml b/playbooks/gce/openshift-cluster/join_node.yml
index c8f6065cd..acf5e5110 100644
--- a/playbooks/gce/openshift-cluster/join_node.yml
+++ b/playbooks/gce/openshift-cluster/join_node.yml
@@ -1,9 +1,12 @@
---
- name: Populate oo_hosts_to_update group
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
vars_files:
- vars.yml
+ - cluster_hosts.yml
tasks:
- name: Evaluate oo_hosts_to_update
add_host:
@@ -16,9 +19,12 @@
- name: Populate oo_masters_to_config host group
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
vars_files:
- vars.yml
+ - cluster_hosts.yml
tasks:
- name: Evaluate oo_nodes_to_config
add_host:
@@ -29,11 +35,11 @@
- name: Evaluate oo_first_master
add_host:
- name: "{{ groups['tag_env-host-type-' ~ cluster_id ~ '-openshift-master'][0] }}"
+ name: "{{ master_hosts | first }}"
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
groups: oo_first_master
- when: "'tag_env-host-type-{{ cluster_id }}-openshift-master' in groups"
+ when: master_hosts is defined and master_hosts|length > 0
#- include: config.yml
- include: ../../common/openshift-node/config.yml
@@ -45,5 +51,3 @@
openshift_use_openshift_sdn: true
openshift_node_labels: "{{ lookup('oo_option', 'openshift_node_labels') }} "
os_sdn_network_plugin_name: "redhat/openshift-ovs-subnet"
- osn_cluster_dns_domain: "{{ hostvars[groups.oo_first_master.0].openshift.dns.domain }}"
- osn_cluster_dns_ip: "{{ hostvars[groups.oo_first_master.0].cluster_dns_ip }}"
diff --git a/playbooks/gce/openshift-cluster/launch.yml b/playbooks/gce/openshift-cluster/launch.yml
index d6ef57c45..562bf8d29 100644
--- a/playbooks/gce/openshift-cluster/launch.yml
+++ b/playbooks/gce/openshift-cluster/launch.yml
@@ -2,6 +2,7 @@
- name: Launch instance(s)
hosts: localhost
connection: local
+ become: no
gather_facts: no
vars_files:
- vars.yml
diff --git a/playbooks/gce/openshift-cluster/list.yml b/playbooks/gce/openshift-cluster/list.yml
index 53b2b9a5e..e67685912 100644
--- a/playbooks/gce/openshift-cluster/list.yml
+++ b/playbooks/gce/openshift-cluster/list.yml
@@ -1,11 +1,13 @@
---
- name: Generate oo_list_hosts group
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
vars_files:
- vars.yml
tasks:
- - set_fact: scratch_group=tag_env-{{ cluster_id }}
+ - set_fact: scratch_group=tag_clusterid-{{ cluster_id }}
when: cluster_id != ''
- set_fact: scratch_group=all
when: cluster_id == ''
diff --git a/playbooks/gce/openshift-cluster/service.yml b/playbooks/gce/openshift-cluster/service.yml
index 2d0f2ab95..8925de4cb 100644
--- a/playbooks/gce/openshift-cluster/service.yml
+++ b/playbooks/gce/openshift-cluster/service.yml
@@ -1,28 +1,29 @@
---
- name: Call same systemctl command for openshift on all instance(s)
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
vars_files:
- vars.yml
+ - cluster_hosts.yml
tasks:
- fail: msg="cluster_id is required to be injected in this playbook"
when: cluster_id is not defined
- - set_fact: scratch_group=tag_env-host-type-{{ cluster_id }}-openshift-node
- add_host:
name: "{{ item }}"
groups: g_service_nodes
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: groups[scratch_group] | default([]) | difference(['localhost']) | difference(groups.status_terminated)
+ with_items: "{{ node_hosts | default([]) | difference(['localhost']) | difference(groups.status_terminated) }}"
- - set_fact: scratch_group=tag_env-host-type-{{ cluster_id }}-openshift-master
- add_host:
name: "{{ item }}"
groups: g_service_masters
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: groups[scratch_group] | default([]) | difference(['localhost']) | difference(groups.status_terminated)
+ with_items: "{{ master_hosts | default([]) | difference(['localhost']) | difference(groups.status_terminated) }}"
- include: ../../common/openshift-node/service.yml
- include: ../../common/openshift-master/service.yml
diff --git a/playbooks/gce/openshift-cluster/tasks/launch_instances.yml b/playbooks/gce/openshift-cluster/tasks/launch_instances.yml
index de8a75b18..488b62eb9 100644
--- a/playbooks/gce/openshift-cluster/tasks/launch_instances.yml
+++ b/playbooks/gce/openshift-cluster/tasks/launch_instances.yml
@@ -16,10 +16,10 @@
#service_account_permissions: "datastore,logging-write"
tags:
- created-by-{{ lookup('env', 'LOGNAME') |default(cluster, true) }}
- - env-{{ cluster }}
+ - environment-{{ cluster_env }}
+ - clusterid-{{ cluster_id }}
- host-type-{{ type }}
- sub-host-type-{{ g_sub_host_type }}
- - env-host-type-{{ cluster }}-openshift-{{ type }}
when: instances |length > 0
register: gce
diff --git a/playbooks/gce/openshift-cluster/terminate.yml b/playbooks/gce/openshift-cluster/terminate.yml
index e20e0a8bc..faa46c0d6 100644
--- a/playbooks/gce/openshift-cluster/terminate.yml
+++ b/playbooks/gce/openshift-cluster/terminate.yml
@@ -2,17 +2,17 @@
- name: Terminate instance(s)
hosts: localhost
connection: local
+ become: no
gather_facts: no
vars_files:
- vars.yml
tasks:
- - set_fact: scratch_group=tag_env-{{ cluster_id }}
- add_host:
name: "{{ item }}"
groups: oo_hosts_to_terminate
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: groups[scratch_group] | default([], true) | difference(['localhost']) | difference(groups.status_terminated | default([], true))
+ with_items: (groups['tag_clusterid-' ~ cluster_id] | default([])) | difference(['localhost'])
- name: Unsubscribe VMs
hosts: oo_hosts_to_terminate
@@ -27,6 +27,7 @@
- name: Terminate instances(s)
hosts: localhost
+ become: no
connection: local
gather_facts: no
vars_files:
diff --git a/playbooks/gce/openshift-cluster/update.yml b/playbooks/gce/openshift-cluster/update.yml
index 8096aa654..dadceae58 100644
--- a/playbooks/gce/openshift-cluster/update.yml
+++ b/playbooks/gce/openshift-cluster/update.yml
@@ -1,9 +1,12 @@
---
- name: Populate oo_hosts_to_update group
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
vars_files:
- vars.yml
+ - cluster_hosts.yml
tasks:
- name: Evaluate oo_hosts_to_update
add_host:
@@ -11,9 +14,7 @@
groups: oo_hosts_to_update
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- 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([]))
+ with_items: "{{ g_all_hosts | default([]) }}"
- include: ../../common/openshift-cluster/update_repos_and_packages.yml
diff --git a/playbooks/gce/openshift-cluster/vars.yml b/playbooks/gce/openshift-cluster/vars.yml
index a8ce8eb22..bdb39923e 100644
--- a/playbooks/gce/openshift-cluster/vars.yml
+++ b/playbooks/gce/openshift-cluster/vars.yml
@@ -1,6 +1,7 @@
---
do_we_use_openshift_sdn: true
-sdn_network_plugin: redhat/openshift-ovs-subnet
+sdn_network_plugin: redhat/openshift-ovs-subnet
+debug_level: 2
# os_sdn_network_plugin_name can be ovssubnet or multitenant, see https://docs.openshift.org/latest/architecture/additional_concepts/sdn.html#ovssubnet-plugin-operation
deployment_vars:
origin:
diff --git a/playbooks/gce/openshift-cluster/wip.yml b/playbooks/gce/openshift-cluster/wip.yml
index 51a521a6b..0e3757546 100644
--- a/playbooks/gce/openshift-cluster/wip.yml
+++ b/playbooks/gce/openshift-cluster/wip.yml
@@ -1,6 +1,7 @@
---
- name: WIP
hosts: localhost
+ become: no
connection: local
gather_facts: no
vars_files:
@@ -12,7 +13,7 @@
groups: oo_masters_for_deploy
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user | default(ansible_ssh_user, true) }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: groups["tag_env-host-type-{{ cluster_id }}-openshift-master"] | default([])
+ with_items: "{{ g_master_hosts | default([]) }}"
- name: Deploy OpenShift Services
hosts: oo_masters_for_deploy
diff --git a/playbooks/libvirt/openshift-cluster/cluster_hosts.yml b/playbooks/libvirt/openshift-cluster/cluster_hosts.yml
new file mode 100644
index 000000000..198a3e4e2
--- /dev/null
+++ b/playbooks/libvirt/openshift-cluster/cluster_hosts.yml
@@ -0,0 +1,22 @@
+---
+g_etcd_hosts: "{{ (groups['tag_host-type-etcd']|default([]))
+ | intersect((groups['tag_clusterid-' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}"
+
+g_lb_hosts: "{{ (groups['tag_host-type-lb']|default([]))
+ | intersect((groups['tag_clusterid-' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}"
+
+g_master_hosts: "{{ (groups['tag_host-type-master']|default([]))
+ | intersect((groups['tag_clusterid-' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}"
+
+g_node_hosts: "{{ (groups['tag_host-type-node']|default([]))
+ | intersect((groups['tag_clusterid-' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment-' ~ cluster_env]|default([]))) }}"
+
+g_nfs_hosts: "{{ (groups['tag_host-type-node']|default([]))
+ | intersect((groups['tag_environment-' ~ cluster_id]|default([]))) }}"
+
+g_all_hosts: "{{ g_master_hosts | union(g_node_hosts) | union(g_etcd_hosts)
+ | union(g_lb_hosts) | default([]) }}"
diff --git a/playbooks/libvirt/openshift-cluster/config.yml b/playbooks/libvirt/openshift-cluster/config.yml
index 4d1ae22ff..be9cbbfaa 100644
--- a/playbooks/libvirt/openshift-cluster/config.yml
+++ b/playbooks/libvirt/openshift-cluster/config.yml
@@ -2,24 +2,14 @@
# TODO: need to figure out a plan for setting hostname, currently the default
# is localhost, so no hostname value (or public_hostname) value is getting
# assigned
-
-- hosts: localhost
- gather_facts: no
- vars_files:
- - vars.yml
- tasks:
- - 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_files:
+ - ../../libvirt/openshift-cluster/vars.yml
+ - ../../libvirt/openshift-cluster/cluster_hosts.yml
vars:
- g_etcd_group: "{{ 'tag_env-host-type-' ~ cluster_id ~ '-openshift-etcd' }}"
- g_lb_group: "{{ 'tag_env-host-type-' ~ cluster_id ~ '-openshift-lb' }}"
- 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_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
+ g_sudo: "{{ deployment_vars[deployment_type].sudo }}"
+ g_nodeonmaster: true
openshift_cluster_id: "{{ cluster_id }}"
- openshift_debug_level: 2
+ openshift_debug_level: "{{ debug_level }}"
openshift_deployment_type: "{{ deployment_type }}"
diff --git a/playbooks/libvirt/openshift-cluster/launch.yml b/playbooks/libvirt/openshift-cluster/launch.yml
index 8d7949dd1..3a48c82bc 100644
--- a/playbooks/libvirt/openshift-cluster/launch.yml
+++ b/playbooks/libvirt/openshift-cluster/launch.yml
@@ -1,6 +1,8 @@
---
- name: Launch instance(s)
hosts: localhost
+ become: no
+ connection: local
gather_facts: no
vars_files:
- vars.yml
@@ -11,6 +13,7 @@
image_url: "{{ deployment_vars[deployment_type].image.url }}"
image_sha256: "{{ deployment_vars[deployment_type].image.sha256 }}"
image_name: "{{ deployment_vars[deployment_type].image.name }}"
+ image_compression: "{{ deployment_vars[deployment_type].image.compression }}"
tasks:
- fail: msg="Deployment type not supported for libvirt provider yet"
when: deployment_type == 'online'
diff --git a/playbooks/libvirt/openshift-cluster/list.yml b/playbooks/libvirt/openshift-cluster/list.yml
index 5954bb01e..6cb81ee79 100644
--- a/playbooks/libvirt/openshift-cluster/list.yml
+++ b/playbooks/libvirt/openshift-cluster/list.yml
@@ -1,11 +1,13 @@
---
- name: Generate oo_list_hosts group
hosts: localhost
+ become: no
+ connection: local
gather_facts: no
vars_files:
- vars.yml
tasks:
- - set_fact: scratch_group=tag_env-{{ cluster_id }}
+ - set_fact: scratch_group=tag_clusterid-{{ cluster_id }}
when: cluster_id != ''
- set_fact: scratch_group=all
when: cluster_id == ''
@@ -21,6 +23,8 @@
- name: List Hosts
hosts: localhost
+ become: no
+ connection: local
gather_facts: no
vars_files:
- vars.yml
diff --git a/playbooks/libvirt/openshift-cluster/service.yml b/playbooks/libvirt/openshift-cluster/service.yml
index ae095f5a2..cd07c8701 100644
--- a/playbooks/libvirt/openshift-cluster/service.yml
+++ b/playbooks/libvirt/openshift-cluster/service.yml
@@ -5,6 +5,8 @@
- name: Call same systemctl command for openshift on all instance(s)
hosts: localhost
+ become: no
+ connection: local
gather_facts: no
vars_files:
- vars.yml
@@ -18,7 +20,7 @@
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
groups: g_service_masters
- with_items: groups["tag_env-host-type-{{ cluster_id }}-openshift-master"] | default([])
+ with_items: "{{ g_master_hosts | default([]) }}"
- name: Evaluate g_service_nodes
add_host:
@@ -26,7 +28,7 @@
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
groups: g_service_nodes
- with_items: groups["tag_env-host-type-{{ cluster_id }}-openshift-node"] | default([])
+ with_items: "{{ g_node_hosts | default([]) }}"
- include: ../../common/openshift-node/service.yml
- include: ../../common/openshift-master/service.yml
diff --git a/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml b/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
index 4825207c9..ff1cedc94 100644
--- a/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
+++ b/playbooks/libvirt/openshift-cluster/tasks/launch_instances.yml
@@ -13,8 +13,15 @@
get_url:
url: '{{ image_url }}'
sha256sum: '{{ image_sha256 }}'
- dest: '{{ os_libvirt_storage_pool_path }}/{{ image_name }}'
+ dest: '{{ os_libvirt_storage_pool_path }}/{{ [image_name, image_compression] | join(".") }}'
when: '{{ ( lookup("oo_option", "skip_image_download") | default("no", True) | lower ) in ["false", "no"] }}'
+ register: downloaded_image
+
+- name: Uncompress Base Cloud image
+ command: 'unxz -kf {{ os_libvirt_storage_pool_path }}/{{ [image_name, image_compression] | join(".") }}'
+ args:
+ creates: '{{ os_libvirt_storage_pool_path }}/{{ image_name }}'
+ when: image_compression in ["xz"] and downloaded_image.changed
- name: Create the cloud-init config drive path
file:
@@ -81,7 +88,7 @@
ansible_ssh_host: '{{ item.1 }}'
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- groups: 'tag_env-{{ cluster }}, tag_host-type-{{ type }}, tag_env-host-type-{{ cluster }}-openshift-{{ type }}, tag_sub-host-type-{{ g_sub_host_type }}'
+ groups: "tag_environment-{{ cluster_env }}, tag_host-type-{{ type }}, tag_sub-host-type-{{ g_sub_host_type }}, tag_clusterid-{{ cluster_id }}"
with_together:
- instances
- ips
diff --git a/playbooks/libvirt/openshift-cluster/templates/domain.xml b/playbooks/libvirt/openshift-cluster/templates/domain.xml
index 870bcf2a6..0ca8e0974 100644
--- a/playbooks/libvirt/openshift-cluster/templates/domain.xml
+++ b/playbooks/libvirt/openshift-cluster/templates/domain.xml
@@ -3,8 +3,8 @@
<memory unit='GiB'>1</memory>
<metadata xmlns:ansible="https://github.com/ansible/ansible">
<ansible:tags>
- <ansible:tag>env-{{ cluster }}</ansible:tag>
- <ansible:tag>env-host-type-{{ cluster }}-openshift-{{ type }}</ansible:tag>
+ <ansible:tag>environment-{{ cluster_env }}</ansible:tag>
+ <ansible:tag>clusterid-{{ cluster }}</ansible:tag>
<ansible:tag>host-type-{{ type }}</ansible:tag>
<ansible:tag>sub-host-type-{{ g_sub_host_type }}</ansible:tag>
</ansible:tags>
diff --git a/playbooks/libvirt/openshift-cluster/terminate.yml b/playbooks/libvirt/openshift-cluster/terminate.yml
index 8f00812a9..8d845c8f2 100644
--- a/playbooks/libvirt/openshift-cluster/terminate.yml
+++ b/playbooks/libvirt/openshift-cluster/terminate.yml
@@ -3,11 +3,13 @@
- name: Terminate instance(s)
hosts: localhost
+ become: no
+ connection: local
gather_facts: no
vars_files:
- vars.yml
tasks:
- - set_fact: cluster_group=tag_env-{{ cluster_id }}
+ - set_fact: cluster_group=tag_clusterid-{{ cluster_id }}
- add_host:
name: "{{ item }}"
groups: oo_hosts_to_terminate
@@ -28,6 +30,8 @@
- name: Terminate instance(s)
hosts: localhost
+ become: no
+ connection: local
gather_facts: no
vars_files:
- vars.yml
diff --git a/playbooks/libvirt/openshift-cluster/update.yml b/playbooks/libvirt/openshift-cluster/update.yml
index d09832c16..2dc540978 100644
--- a/playbooks/libvirt/openshift-cluster/update.yml
+++ b/playbooks/libvirt/openshift-cluster/update.yml
@@ -1,9 +1,12 @@
---
- name: Populate oo_hosts_to_update group
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
vars_files:
- vars.yml
+ - cluster_hosts.yml
tasks:
- name: Evaluate oo_hosts_to_update
add_host:
@@ -11,9 +14,7 @@
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"] | default([]))
- | union(groups["tag_env-host-type-{{ cluster_id }}-openshift-node"] | default([]))
- | union(groups["tag_env-host-type-{{ cluster_id }}-openshift-etcd"] | default([]))
+ with_items: "{{ g_all_hosts | default([]) }}"
- include: ../../common/openshift-cluster/update_repos_and_packages.yml
diff --git a/playbooks/libvirt/openshift-cluster/vars.yml b/playbooks/libvirt/openshift-cluster/vars.yml
index c77a0797e..8b170f99e 100644
--- a/playbooks/libvirt/openshift-cluster/vars.yml
+++ b/playbooks/libvirt/openshift-cluster/vars.yml
@@ -3,16 +3,19 @@ libvirt_storage_pool_path: "{{ lookup('env','HOME') }}/libvirt-storage-pool-open
libvirt_storage_pool: 'openshift-ansible'
libvirt_network: openshift-ansible
libvirt_uri: 'qemu:///system'
+debug_level: 2
deployment_vars:
origin:
image:
url: "{{ lookup('oo_option', 'image_url') |
- default('http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2', True) }}"
+ default('http://cloud.centos.org/centos/7/images/CentOS-7-x86_64-GenericCloud.qcow2.xz', True) }}"
+ compression: "{{ lookup('oo_option', 'image_compression') |
+ default('xz', True) }}"
name: "{{ lookup('oo_option', 'image_name') |
default('CentOS-7-x86_64-GenericCloud.qcow2', True) }}"
sha256: "{{ lookup('oo_option', 'image_sha256') |
- default('e324e3ab1d24a1bbf035ddb365e7f9058c0b454acf48d7aa15c5519fae5998ab', True) }}"
+ default('9461006300d65172f5668d8875f2aad7b54f7ba4e9c5435d65a84a5a2d66e39b', True) }}"
ssh_user: openshift
sudo: yes
online:
diff --git a/playbooks/openstack/openshift-cluster/cluster_hosts.yml b/playbooks/openstack/openshift-cluster/cluster_hosts.yml
new file mode 100644
index 000000000..bc586d983
--- /dev/null
+++ b/playbooks/openstack/openshift-cluster/cluster_hosts.yml
@@ -0,0 +1,22 @@
+---
+g_etcd_hosts: "{{ (groups['tag_host-type_etcd']|default([]))
+ | intersect((groups['tag_clusterid_' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment_' ~ cluster_env]|default([]))) }}"
+
+g_lb_hosts: "{{ (groups['tag_host-type_lb']|default([]))
+ | intersect((groups['tag_clusterid_' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment_' ~ cluster_env]|default([]))) }}"
+
+g_master_hosts: "{{ (groups['tag_host-type_master']|default([]))
+ | intersect((groups['tag_clusterid_' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment_' ~ cluster_env]|default([]))) }}"
+
+g_node_hosts: "{{ (groups['tag_host-type_node']|default([]))
+ | intersect((groups['tag_clusterid_' ~ cluster_id]|default([])))
+ | intersect((groups['tag_environment_' ~ cluster_env]|default([]))) }}"
+
+g_nfs_hosts: "{{ (groups['tag_host-type_nfs']|default([]))
+ | intersect((groups['tag_environment_' ~ cluster_id]|default([]))) }}"
+
+g_all_hosts: "{{ g_master_hosts | union(g_node_hosts) | union(g_etcd_hosts)
+ | union(g_lb_hosts) | default([]) }}"
diff --git a/playbooks/openstack/openshift-cluster/config.yml b/playbooks/openstack/openshift-cluster/config.yml
index 888804e28..b338d2eb4 100644
--- a/playbooks/openstack/openshift-cluster/config.yml
+++ b/playbooks/openstack/openshift-cluster/config.yml
@@ -1,21 +1,13 @@
-- hosts: localhost
- gather_facts: no
- vars_files:
- - vars.yml
- tasks:
- - 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_files:
+ - ../../openstack/openshift-cluster/vars.yml
+ - ../../openstack/openshift-cluster/cluster_hosts.yml
vars:
- g_etcd_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-etcd' }}"
- g_lb_group: "{{ 'tag_env-host-type_' ~ cluster_id ~ '-openshift-lb' }}"
- 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
+ g_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
+ g_sudo: "{{ deployment_vars[deployment_type].sudo }}"
openshift_cluster_id: "{{ cluster_id }}"
- openshift_debug_level: 2
+ openshift_debug_level: "{{ debug_level }}"
openshift_deployment_type: "{{ deployment_type }}"
openshift_hostname: "{{ ansible_default_ipv4.address }}"
diff --git a/playbooks/openstack/openshift-cluster/files/heat_stack.yaml b/playbooks/openstack/openshift-cluster/files/heat_stack.yaml
index 40e4ab22c..4f6a59a30 100644
--- a/playbooks/openstack/openshift-cluster/files/heat_stack.yaml
+++ b/playbooks/openstack/openshift-cluster/files/heat_stack.yaml
@@ -4,6 +4,11 @@ description: OpenShift cluster
parameters:
+ cluster_env:
+ type: string
+ label: Cluster environment
+ description: Environment of the cluster
+
cluster_id:
type: string
label: Cluster ID
@@ -43,6 +48,11 @@ parameters:
description: Source of legitimate ssh connections
default: 0.0.0.0/0
+ num_etcd:
+ type: number
+ label: Number of etcd nodes
+ description: Number of etcd nodes
+
num_masters:
type: number
label: Number of masters
@@ -58,6 +68,11 @@ parameters:
label: Number of infrastructure nodes
description: Number of infrastructure nodes
+ etcd_image:
+ type: string
+ label: Etcd image
+ description: Name of the image for the etcd servers
+
master_image:
type: string
label: Master image
@@ -73,6 +88,11 @@ parameters:
label: Infra image
description: Name of the image for the infra node servers
+ etcd_flavor:
+ type: string
+ label: Etcd flavor
+ description: Flavor of the etcd servers
+
master_flavor:
type: string
label: Master flavor
@@ -90,6 +110,18 @@ parameters:
outputs:
+ etcd_names:
+ description: Name of the etcds
+ value: { get_attr: [ etcd, name ] }
+
+ etcd_ips:
+ description: IPs of the etcds
+ value: { get_attr: [ etcd, private_ip ] }
+
+ etcd_floating_ips:
+ description: Floating IPs of the etcds
+ value: { get_attr: [ etcd, floating_ip ] }
+
master_names:
description: Name of the masters
value: { get_attr: [ masters, name ] }
@@ -220,6 +252,37 @@ resources:
port_range_min: 24224
port_range_max: 24224
+ etcd-secgrp:
+ type: OS::Neutron::SecurityGroup
+ properties:
+ name:
+ str_replace:
+ template: openshift-ansible-cluster_id-etcd-secgrp
+ params:
+ cluster_id: { get_param: cluster_id }
+ description:
+ str_replace:
+ template: Security group for cluster_id etcd cluster
+ params:
+ cluster_id: { get_param: cluster_id }
+ rules:
+ - direction: ingress
+ protocol: tcp
+ port_range_min: 22
+ port_range_max: 22
+ remote_ip_prefix: { get_param: ssh_incoming }
+ - direction: ingress
+ protocol: tcp
+ port_range_min: 2379
+ port_range_max: 2379
+ remote_mode: remote_group_id
+ remote_group_id: { get_resource: master-secgrp }
+ - direction: ingress
+ protocol: tcp
+ port_range_min: 2380
+ port_range_max: 2380
+ remote_mode: remote_group_id
+
node-secgrp:
type: OS::Neutron::SecurityGroup
properties:
@@ -274,6 +337,37 @@ resources:
port_range_min: 443
port_range_max: 443
+ etcd:
+ type: OS::Heat::ResourceGroup
+ properties:
+ count: { get_param: num_etcd }
+ resource_def:
+ type: heat_stack_server.yaml
+ properties:
+ name:
+ str_replace:
+ template: cluster_id-k8s_type-%index%
+ params:
+ cluster_id: { get_param: cluster_id }
+ k8s_type: etcd
+ cluster_env: { get_param: cluster_env }
+ cluster_id: { get_param: cluster_id }
+ type: etcd
+ image: { get_param: etcd_image }
+ flavor: { get_param: etcd_flavor }
+ key_name: { get_resource: keypair }
+ net: { get_resource: net }
+ subnet: { get_resource: subnet }
+ secgrp:
+ - { get_resource: etcd-secgrp }
+ floating_network: { get_param: floating_ip_pool }
+ net_name:
+ str_replace:
+ template: openshift-ansible-cluster_id-net
+ params:
+ cluster_id: { get_param: cluster_id }
+ depends_on: interface
+
masters:
type: OS::Heat::ResourceGroup
properties:
@@ -287,13 +381,14 @@ resources:
params:
cluster_id: { get_param: cluster_id }
k8s_type: master
- cluster_id: { get_param: cluster_id }
- type: master
- image: { get_param: master_image }
- flavor: { get_param: master_flavor }
- key_name: { get_resource: keypair }
- net: { get_resource: net }
- subnet: { get_resource: subnet }
+ cluster_env: { get_param: cluster_env }
+ cluster_id: { get_param: cluster_id }
+ type: master
+ image: { get_param: master_image }
+ flavor: { get_param: master_flavor }
+ key_name: { get_resource: keypair }
+ net: { get_resource: net }
+ subnet: { get_resource: subnet }
secgrp:
- { get_resource: master-secgrp }
floating_network: { get_param: floating_ip_pool }
@@ -318,14 +413,15 @@ resources:
cluster_id: { get_param: cluster_id }
k8s_type: node
sub_host_type: compute
- cluster_id: { get_param: cluster_id }
- type: node
- subtype: compute
- image: { get_param: node_image }
- flavor: { get_param: node_flavor }
- key_name: { get_resource: keypair }
- net: { get_resource: net }
- subnet: { get_resource: subnet }
+ cluster_env: { get_param: cluster_env }
+ cluster_id: { get_param: cluster_id }
+ type: node
+ subtype: compute
+ image: { get_param: node_image }
+ flavor: { get_param: node_flavor }
+ key_name: { get_resource: keypair }
+ net: { get_resource: net }
+ subnet: { get_resource: subnet }
secgrp:
- { get_resource: node-secgrp }
floating_network: { get_param: floating_ip_pool }
@@ -350,14 +446,15 @@ resources:
cluster_id: { get_param: cluster_id }
k8s_type: node
sub_host_type: infra
- cluster_id: { get_param: cluster_id }
- type: node
- subtype: infra
- image: { get_param: infra_image }
- flavor: { get_param: infra_flavor }
- key_name: { get_resource: keypair }
- net: { get_resource: net }
- subnet: { get_resource: subnet }
+ cluster_env: { get_param: cluster_env }
+ cluster_id: { get_param: cluster_id }
+ type: node
+ subtype: infra
+ image: { get_param: infra_image }
+ flavor: { get_param: infra_flavor }
+ key_name: { get_resource: keypair }
+ net: { get_resource: net }
+ subnet: { get_resource: subnet }
secgrp:
- { get_resource: node-secgrp }
- { get_resource: infra-secgrp }
diff --git a/playbooks/openstack/openshift-cluster/files/heat_stack_server.yaml b/playbooks/openstack/openshift-cluster/files/heat_stack_server.yaml
index 9dcab3e60..f83f2c984 100644
--- a/playbooks/openstack/openshift-cluster/files/heat_stack_server.yaml
+++ b/playbooks/openstack/openshift-cluster/files/heat_stack_server.yaml
@@ -9,6 +9,11 @@ parameters:
label: Name
description: Name
+ cluster_env:
+ type: string
+ label: Cluster environment
+ description: Environment of the cluster
+
cluster_id:
type: string
label: Cluster ID
@@ -105,14 +110,9 @@ resources:
user_data: { get_file: user-data }
user_data_format: RAW
metadata:
- env: { get_param: cluster_id }
+ environment: { get_param: cluster_env }
+ clusterid: { get_param: cluster_id }
host-type: { get_param: type }
- env-host-type:
- str_replace:
- template: cluster_id-openshift-type
- params:
- cluster_id: { get_param: cluster_id }
- type: { get_param: type }
sub-host-type: { get_param: subtype }
port:
diff --git a/playbooks/openstack/openshift-cluster/launch.yml b/playbooks/openstack/openshift-cluster/launch.yml
index 651aef40b..fdcb77acc 100644
--- a/playbooks/openstack/openshift-cluster/launch.yml
+++ b/playbooks/openstack/openshift-cluster/launch.yml
@@ -1,6 +1,7 @@
---
- name: Launch instance(s)
hosts: localhost
+ become: no
connection: local
gather_facts: no
vars_files:
@@ -28,6 +29,7 @@
- name: Create or Update OpenStack Stack
command: 'heat {{ heat_stack_action }} -f {{ openstack_infra_heat_stack }}
+ -P cluster_env={{ cluster_env }}
-P cluster_id={{ cluster_id }}
-P cidr={{ openstack_network_cidr }}
-P dns_nameservers={{ openstack_network_dns | join(",") }}
@@ -35,12 +37,15 @@
-P floating_ip_pool={{ openstack_floating_ip_pool }}
-P ssh_public_key="{{ openstack_ssh_public_key }}"
-P ssh_incoming={{ openstack_ssh_access_from }}
+ -P num_etcd={{ num_etcd }}
-P num_masters={{ num_masters }}
-P num_nodes={{ num_nodes }}
-P num_infra={{ num_infra }}
+ -P etcd_image={{ deployment_vars[deployment_type].image }}
-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 etcd_flavor={{ openstack_flavor["etcd"] }}
-P master_flavor={{ openstack_flavor["master"] }}
-P node_flavor={{ openstack_flavor["node"] }}
-P infra_flavor={{ openstack_flavor["infra"] }}
@@ -61,13 +66,25 @@
- set_fact:
parsed_outputs: "{{ stack_show_result | oo_parse_heat_stack_outputs }}"
+ - name: Add new etcd 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_environment_{{ cluster_env }}, tag_host-type_etcd, tag_sub-host-type_default, tag_clusterid_{{ cluster_id }}'
+ with_together:
+ - parsed_outputs.etcd_names
+ - parsed_outputs.etcd_ips
+ - parsed_outputs.etcd_floating_ips
+
- name: Add new master 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_master, tag_env-host-type_{{ cluster_id }}-openshift-master, tag_sub-host-type_default'
+ groups: 'tag_environment_{{ cluster_env }}, tag_host-type_master, tag_sub-host-type_default, tag_clusterid_{{ cluster_id }}'
with_together:
- parsed_outputs.master_names
- parsed_outputs.master_ips
@@ -79,7 +96,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_node, tag_env-host-type_{{ cluster_id }}-openshift-node, tag_sub-host-type_compute'
+ groups: 'tag_environment_{{ cluster_env }}, tag_host-type_node, tag_sub-host-type_compute, tag_clusterid_{{ cluster_id }}'
with_together:
- parsed_outputs.node_names
- parsed_outputs.node_ips
@@ -91,7 +108,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_node, tag_env-host-type_{{ cluster_id }}-openshift-node, tag_sub-host-type_infra'
+ groups: 'tag_environment_{{ cluster_env }}, tag_host-type_node, tag_sub-host-type_infra, tag_clusterid_{{ cluster_id }}'
with_together:
- parsed_outputs.infra_names
- parsed_outputs.infra_ips
diff --git a/playbooks/openstack/openshift-cluster/list.yml b/playbooks/openstack/openshift-cluster/list.yml
index fa194b072..123ebd323 100644
--- a/playbooks/openstack/openshift-cluster/list.yml
+++ b/playbooks/openstack/openshift-cluster/list.yml
@@ -1,11 +1,13 @@
---
- name: Generate oo_list_hosts group
hosts: localhost
+ become: no
+ connection: local
gather_facts: no
vars_files:
- vars.yml
tasks:
- - set_fact: scratch_group=tag_env_{{ cluster_id }}
+ - set_fact: scratch_group=tag_clusterid_{{ cluster_id }}
when: cluster_id != ''
- set_fact: scratch_group=all
when: cluster_id == ''
@@ -22,6 +24,8 @@
- name: List Hosts
hosts: localhost
+ become: no
+ connection: local
gather_facts: no
vars_files:
- vars.yml
diff --git a/playbooks/openstack/openshift-cluster/terminate.yml b/playbooks/openstack/openshift-cluster/terminate.yml
index 62df2be73..d4ab51fa7 100644
--- a/playbooks/openstack/openshift-cluster/terminate.yml
+++ b/playbooks/openstack/openshift-cluster/terminate.yml
@@ -1,17 +1,17 @@
- name: Terminate instance(s)
hosts: localhost
+ become: no
connection: local
gather_facts: no
vars_files:
- vars.yml
tasks:
- - set_fact: cluster_group=tag_env_{{ cluster_id }}
- add_host:
name: "{{ item }}"
groups: oo_hosts_to_terminate
ansible_ssh_user: "{{ deployment_vars[deployment_type].ssh_user }}"
ansible_sudo: "{{ deployment_vars[deployment_type].sudo }}"
- with_items: groups[cluster_group] | default([])
+ with_items: (groups['tag_environment_' ~ cluster_env]|default([])) | intersect(groups['tag_clusterid_' ~ cluster_id ]|default([]))
- name: Unsubscribe VMs
hosts: oo_hosts_to_terminate
@@ -25,6 +25,7 @@
default('no', True) | lower in ['no', 'false']
- hosts: localhost
+ become: no
connection: local
gather_facts: no
vars_files:
diff --git a/playbooks/openstack/openshift-cluster/update.yml b/playbooks/openstack/openshift-cluster/update.yml
index e006aa74a..2dc540978 100644
--- a/playbooks/openstack/openshift-cluster/update.yml
+++ b/playbooks/openstack/openshift-cluster/update.yml
@@ -1,9 +1,12 @@
---
- name: Populate oo_hosts_to_update group
hosts: localhost
+ connection: local
+ become: no
gather_facts: no
vars_files:
- vars.yml
+ - cluster_hosts.yml
tasks:
- name: Evaluate oo_hosts_to_update
add_host:
@@ -11,9 +14,7 @@
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"] | default([]))
- | union(groups["tag_env-host-type_{{ cluster_id }}-openshift-node"] | default([]))
- | union(groups["tag_env-host-type_{{ cluster_id }}-openshift-etcd"] | default([]))
+ with_items: "{{ g_all_hosts | default([]) }}"
- include: ../../common/openshift-cluster/update_repos_and_packages.yml
diff --git a/playbooks/openstack/openshift-cluster/vars.yml b/playbooks/openstack/openshift-cluster/vars.yml
index 262d3f4ed..f8d15999e 100644
--- a/playbooks/openstack/openshift-cluster/vars.yml
+++ b/playbooks/openstack/openshift-cluster/vars.yml
@@ -1,4 +1,5 @@
---
+debug_level: 2
openstack_infra_heat_stack: "{{ lookup('oo_option', 'infra_heat_stack' ) |
default('files/heat_stack.yaml', True) }}"
openstack_network_cidr: "{{ lookup('oo_option', 'net_cidr' ) |
@@ -14,6 +15,7 @@ openstack_ssh_public_key: "{{ lookup('file', lookup('oo_option', 'public_k
openstack_ssh_access_from: "{{ lookup('oo_option', 'ssh_from') |
default('0.0.0.0/0', True) }}"
openstack_flavor:
+ etcd: "{{ lookup('oo_option', 'etcd_flavor' ) | default('m1.small', True) }}"
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) }}"