From 1412c9c9871d99a2bc39b286540936b41e1be7b1 Mon Sep 17 00:00:00 2001 From: Adam Miller Date: Fri, 12 May 2017 03:19:04 +0000 Subject: [PATCH] properly handle shared infra nodes for openshift in a-a-o-a role template Signed-off-by: Adam Miller --- playbooks/groups/os-cluster.yml | 1 + playbooks/groups/osbs-cluster.yml | 2 + .../defaults/main.yml | 3 ++ .../templates/cluster-inventory.j2 | 40 +++++++++++++++++++ 4 files changed, 46 insertions(+) diff --git a/playbooks/groups/os-cluster.yml b/playbooks/groups/os-cluster.yml index 7005c258b6..312f938f0a 100644 --- a/playbooks/groups/os-cluster.yml +++ b/playbooks/groups/os-cluster.yml @@ -110,6 +110,7 @@ openshift_internal_cluster_url: "os-masters{{ env_suffix }}.phx2.fedoraproject.org", openshift_api_port: 443, openshift_console_port: 443, + openshift_shared_infra: true, when: env == 'staging', tags: ['openshift-cluster','ansible-ansible-openshift-ansible'] } diff --git a/playbooks/groups/osbs-cluster.yml b/playbooks/groups/osbs-cluster.yml index 70ebd43d64..1a90db8473 100644 --- a/playbooks/groups/osbs-cluster.yml +++ b/playbooks/groups/osbs-cluster.yml @@ -215,6 +215,7 @@ openshift_cluster_url: "{{osbs_url}}", openshift_master_ha: false, openshift_debug_level: 2, + openshift_shared_infra: true, openshift_deployment_type: "origin", when: env == 'staging', tags: ['openshift-cluster','ansible-ansible-openshift-ansible'] @@ -238,6 +239,7 @@ openshift_cluster_url: "{{osbs_url}}", openshift_master_ha: false, openshift_debug_level: 2, + openshift_shared_infra: true, openshift_deployment_type: "origin", when: env == 'production', tags: ['openshift-cluster','ansible-ansible-openshift-ansible'] diff --git a/roles/ansible-ansible-openshift-ansible/defaults/main.yml b/roles/ansible-ansible-openshift-ansible/defaults/main.yml index 243d855e32..f0c635b58c 100644 --- a/roles/ansible-ansible-openshift-ansible/defaults/main.yml +++ b/roles/ansible-ansible-openshift-ansible/defaults/main.yml @@ -23,6 +23,9 @@ openshift_auth_profile: osbs # and won't be bound to the docker daemon. openshift_ansible_containerized_deploy: false +# This will co-host the infra nodes with the primary nodes +openshift_shared_infra: false + # OpenShift Cluster URL # Example: openshift.fedoraproject.org openshift_cluster_url: None diff --git a/roles/ansible-ansible-openshift-ansible/templates/cluster-inventory.j2 b/roles/ansible-ansible-openshift-ansible/templates/cluster-inventory.j2 index 0dbf9e3c6c..8684e6f987 100644 --- a/roles/ansible-ansible-openshift-ansible/templates/cluster-inventory.j2 +++ b/roles/ansible-ansible-openshift-ansible/templates/cluster-inventory.j2 @@ -784,6 +784,24 @@ openshift_master_console_port={{openshift_console_port}} {{ host }} {% endfor %} +{% if openshift_shared_infra is defined %} +{% if openshift_shared_infra %} + +[lb] +{% for host in groups[openshift_cluster_nodes_group] %} +{{ host }} containerized=false +{% endfor %} + +[nodes] +{% for host in groups[openshift_cluster_masters_group] %} +{{ host }} openshift_schedulable=False +{% endfor %} +{% for host in groups[openshift_cluster_nodes_group] %} +{{ host }} openshift_node_labels="{'region': 'infra', 'zone': 'default'}" +{% endfor %} + +{% else %} + [lb] {% for host in groups[openshift_cluster_infra_group] %} {{ host }} containerized=false @@ -799,3 +817,25 @@ openshift_master_console_port={{openshift_console_port}} {% for host in groups[openshift_cluster_nodes_group] %} {{ host }} openshift_node_labels="{'region': 'primary', 'zone': 'default'}" {% endfor %} + +{% endif %} + +{% else %} + +[lb] +{% for host in groups[openshift_cluster_infra_group] %} +{{ host }} containerized=false +{% endfor %} + +[nodes] +{% for host in groups[openshift_cluster_infra_group] %} +{{ host }} openshift_node_labels="{'region':'infra'}" +{% endfor %} +{% for host in groups[openshift_cluster_masters_group] %} +{{ host }} openshift_schedulable=False +{% endfor %} +{% for host in groups[openshift_cluster_nodes_group] %} +{{ host }} openshift_node_labels="{'region': 'primary', 'zone': 'default'}" +{% endfor %} + +{% endif %}