From 6d3e1764658582150f6c776c2662075531ccf70f Mon Sep 17 00:00:00 2001 From: Andrew Butcher Date: Wed, 3 Feb 2016 13:51:27 -0500 Subject: Add new_masters to scaleup playbook. --- .../common/openshift-cluster/evaluate_groups.yml | 17 +++++++-- playbooks/common/openshift-cluster/scaleup.yml | 40 +++++++++++++++++++++- 2 files changed, 53 insertions(+), 4 deletions(-) (limited to 'playbooks/common/openshift-cluster') diff --git a/playbooks/common/openshift-cluster/evaluate_groups.yml b/playbooks/common/openshift-cluster/evaluate_groups.yml index 7917bfba5..cab81b889 100644 --- a/playbooks/common/openshift-cluster/evaluate_groups.yml +++ b/playbooks/common/openshift-cluster/evaluate_groups.yml @@ -10,8 +10,8 @@ when: g_etcd_hosts is not defined - fail: - msg: This playbook requires g_master_hosts to be set - when: g_master_hosts is not defined + msg: This playbook requires g_master_hosts or g_new_master_hosts to be set + when: g_master_hosts is not defined and g_new_master_hosts is not defined - fail: msg: This playbook requires g_node_hosts or g_new_node_hosts to be set @@ -29,6 +29,14 @@ msg: The nfs group must be limited to one host when: (groups[g_nfs_hosts] | default([])) | length > 1 + - name: Evaluate oo_masters + add_host: + name: "{{ item }}" + groups: oo_masters + ansible_ssh_user: "{{ g_ssh_user | default(omit) }}" + ansible_sudo: "{{ g_sudo | default(omit) }}" + with_items: "{{ g_all_master_hosts | default([]) }}" + - name: Evaluate oo_etcd_to_config add_host: name: "{{ item }}" @@ -37,13 +45,16 @@ ansible_sudo: "{{ g_sudo | default(omit) }}" with_items: "{{ g_etcd_hosts | default([]) }}" + - set_fact: + g_master_hosts_to_config: "{{ g_new_master_hosts | default(g_master_hosts | default([], true), true) }}" + - name: Evaluate oo_masters_to_config add_host: name: "{{ item }}" groups: oo_masters_to_config ansible_ssh_user: "{{ g_ssh_user | default(omit) }}" ansible_sudo: "{{ g_sudo | default(omit) }}" - with_items: "{{ g_master_hosts | default([]) }}" + with_items: "{{ g_master_hosts_to_config | default([]) }}" # Use g_new_node_hosts if it exists otherwise g_node_hosts - set_fact: diff --git a/playbooks/common/openshift-cluster/scaleup.yml b/playbooks/common/openshift-cluster/scaleup.yml index c4340902b..e4b4564d8 100644 --- a/playbooks/common/openshift-cluster/scaleup.yml +++ b/playbooks/common/openshift-cluster/scaleup.yml @@ -12,5 +12,43 @@ - openshift_docker - include: ../openshift-node/config.yml + +- name: Gather facts + hosts: oo_etcd_to_config:oo_masters_to_config:oo_nodes_to_config + roles: + - openshift_facts + +- name: Update master count + hosts: oo_masters:!oo_masters_to_config + serial: 1 vars: - openshift_deployment_type: "{{ deployment_type }}" + openshift_master_count: "{{ groups.oo_masters | length }}" + roles: + - openshift_facts + post_tasks: + - name: Update master count + lineinfile: + dest: "{{ openshift.common.config_base}}/master/master-config.yaml" + regexp: '^ masterCount:.*$' + line: " masterCount: {{ openshift_master_count }}" + register: master_config + - name: Restart master api + service: name={{ openshift.common.service_type }}-master-api state=restarted + when: master_config | changed + notify: Verify api server + - name: restart master controllers + service: name={{ openshift.common.service_type }}-master-controllers state=restarted + when: master_config | changed + handlers: + - name: Verify api server + command: > + curl -k --head --silent {{ openshift.master.api_url }} + register: api_available_output + until: api_available_output.stdout.find("200 OK") != -1 + retries: 120 + delay: 1 + changed_when: false + +- include: ../openshift-master/config.yml + +- include: ../openshift-node/config.yml -- cgit v1.2.3 From 89afc792b4c49e926d50b1d99c2a79ce13526285 Mon Sep 17 00:00:00 2001 From: Andrew Butcher Date: Mon, 8 Feb 2016 11:34:08 -0500 Subject: Move additional master configuration into a separate master playbook. --- .../common/openshift-cluster/additional_config.yml | 55 ++++++++++++++++++++++ playbooks/common/openshift-cluster/config.yml | 2 + .../common/openshift-cluster/evaluate_groups.yml | 13 ++--- playbooks/common/openshift-cluster/scaleup.yml | 24 +++++----- 4 files changed, 73 insertions(+), 21 deletions(-) create mode 100644 playbooks/common/openshift-cluster/additional_config.yml (limited to 'playbooks/common/openshift-cluster') diff --git a/playbooks/common/openshift-cluster/additional_config.yml b/playbooks/common/openshift-cluster/additional_config.yml new file mode 100644 index 000000000..0f4e6ab88 --- /dev/null +++ b/playbooks/common/openshift-cluster/additional_config.yml @@ -0,0 +1,55 @@ +- name: Configure flannel + hosts: oo_first_master + vars: + etcd_urls: "{{ openshift.master.etcd_urls }}" + roles: + - role: flannel_register + when: openshift.common.use_flannel | bool + +- name: Additional master configuration + hosts: oo_first_master + vars: + cockpit_plugins: "{{ osm_cockpit_plugins | default(['cockpit-kubernetes']) }}" + etcd_urls: "{{ openshift.master.etcd_urls }}" + openshift_master_ha: "{{ groups.oo_masters | length > 1 }}" + omc_cluster_hosts: "{{ groups.oo_masters | join(' ')}}" + roles: + - role: openshift_master_cluster + when: openshift_master_ha | bool and openshift.master.cluster_method == "pacemaker" + - role: openshift_examples + when: openshift.common.install_examples | bool + - role: openshift_cluster_metrics + when: openshift.common.use_cluster_metrics | bool + - role: openshift_manageiq + when: openshift.common.use_manageiq | bool + - role: cockpit + when: not openshift.common.is_atomic and ( deployment_type in ['atomic-enterprise','openshift-enterprise'] ) and + (osm_use_cockpit | bool or osm_use_cockpit is undefined ) + - role: flannel_register + when: openshift.common.use_flannel | bool + - role: pods + when: openshift.common.deployment_type == 'online' + - role: os_env_extras + when: openshift.common.deployment_type == 'online' + +- name: Create persistent volumes and create hosted services + hosts: oo_first_master + vars: + attach_registry_volume: "{{ openshift.hosted.registry.storage.kind != None }}" + deploy_infra: "{{ openshift.master.infra_nodes | default([]) | length > 0 }}" + persistent_volumes: "{{ hostvars[groups.oo_first_master.0] | oo_persistent_volumes(groups) }}" + persistent_volume_claims: "{{ hostvars[groups.oo_first_master.0] | oo_persistent_volume_claims }}" + roles: + - role: openshift_persistent_volumes + when: persistent_volumes | length > 0 or persistent_volume_claims | length > 0 + - role: openshift_serviceaccounts + openshift_serviceaccounts_names: + - router + - registry + openshift_serviceaccounts_namespace: default + openshift_serviceaccounts_sccs: + - privileged + - role: openshift_router + when: deploy_infra | bool + - role: openshift_registry + when: deploy_infra | bool and attach_registry_volume | bool diff --git a/playbooks/common/openshift-cluster/config.yml b/playbooks/common/openshift-cluster/config.yml index 2cad4b362..23c8f039e 100644 --- a/playbooks/common/openshift-cluster/config.yml +++ b/playbooks/common/openshift-cluster/config.yml @@ -11,4 +11,6 @@ - include: ../openshift-master/config.yml +- include: additional_config.yml + - include: ../openshift-node/config.yml diff --git a/playbooks/common/openshift-cluster/evaluate_groups.yml b/playbooks/common/openshift-cluster/evaluate_groups.yml index cab81b889..432a92b49 100644 --- a/playbooks/common/openshift-cluster/evaluate_groups.yml +++ b/playbooks/common/openshift-cluster/evaluate_groups.yml @@ -35,7 +35,7 @@ groups: oo_masters ansible_ssh_user: "{{ g_ssh_user | default(omit) }}" ansible_sudo: "{{ g_sudo | default(omit) }}" - with_items: "{{ g_all_master_hosts | default([]) }}" + with_items: "{{ g_master_hosts | union(g_new_master_hosts) | default([]) }}" - name: Evaluate oo_etcd_to_config add_host: @@ -45,20 +45,13 @@ ansible_sudo: "{{ g_sudo | default(omit) }}" with_items: "{{ g_etcd_hosts | default([]) }}" - - set_fact: - g_master_hosts_to_config: "{{ g_new_master_hosts | default(g_master_hosts | default([], true), true) }}" - - name: Evaluate oo_masters_to_config add_host: name: "{{ item }}" groups: oo_masters_to_config ansible_ssh_user: "{{ g_ssh_user | default(omit) }}" ansible_sudo: "{{ g_sudo | default(omit) }}" - with_items: "{{ g_master_hosts_to_config | default([]) }}" - - # Use g_new_node_hosts if it exists otherwise g_node_hosts - - set_fact: - g_node_hosts_to_config: "{{ g_new_node_hosts | default(g_node_hosts | default([], true), true) }}" + with_items: "{{ g_new_master_hosts | default(g_master_hosts | default([], true), true) }}" - name: Evaluate oo_nodes_to_config add_host: @@ -66,7 +59,7 @@ groups: oo_nodes_to_config ansible_ssh_user: "{{ g_ssh_user | default(omit) }}" ansible_sudo: "{{ g_sudo | default(omit) }}" - with_items: "{{ g_node_hosts_to_config | default([]) }}" + with_items: "{{ g_new_node_hosts | default(g_node_hosts | default([], true), true) }}" # Skip adding the master to oo_nodes_to_config when g_new_node_hosts is - name: Evaluate oo_nodes_to_config diff --git a/playbooks/common/openshift-cluster/scaleup.yml b/playbooks/common/openshift-cluster/scaleup.yml index e4b4564d8..2ba5bb8a2 100644 --- a/playbooks/common/openshift-cluster/scaleup.yml +++ b/playbooks/common/openshift-cluster/scaleup.yml @@ -21,26 +21,28 @@ - name: Update master count hosts: oo_masters:!oo_masters_to_config serial: 1 - vars: - openshift_master_count: "{{ groups.oo_masters | length }}" roles: - openshift_facts post_tasks: + - openshift_facts: + role: master + local_facts: + master_count: "{{ openshift_master_count | default(groups.oo_masters | length) }}" - name: Update master count lineinfile: dest: "{{ openshift.common.config_base}}/master/master-config.yaml" regexp: '^ masterCount:.*$' - line: " masterCount: {{ openshift_master_count }}" - register: master_config - - name: Restart master api - service: name={{ openshift.common.service_type }}-master-api state=restarted - when: master_config | changed - notify: Verify api server + line: " masterCount: {{ openshift.master.master_count }}" + notify: + - restart master api + - restart master controllers + handlers: + - name: restart master api + service: name={{ openshift.common.service_type }}-master-controllers state=restarted + notify: verify api server - name: restart master controllers service: name={{ openshift.common.service_type }}-master-controllers state=restarted - when: master_config | changed - handlers: - - name: Verify api server + - name: verify api server command: > curl -k --head --silent {{ openshift.master.api_url }} register: api_available_output -- cgit v1.2.3 From 16e1f777e1df9371c4570aed149b29bd4cdc1a6f Mon Sep 17 00:00:00 2001 From: Andrew Butcher Date: Tue, 9 Feb 2016 15:13:06 -0500 Subject: Re-arrange scaleup playbooks. --- playbooks/common/openshift-cluster/scaleup.yml | 56 -------------------------- 1 file changed, 56 deletions(-) delete mode 100644 playbooks/common/openshift-cluster/scaleup.yml (limited to 'playbooks/common/openshift-cluster') diff --git a/playbooks/common/openshift-cluster/scaleup.yml b/playbooks/common/openshift-cluster/scaleup.yml deleted file mode 100644 index 2ba5bb8a2..000000000 --- a/playbooks/common/openshift-cluster/scaleup.yml +++ /dev/null @@ -1,56 +0,0 @@ ---- -- include: evaluate_groups.yml - -- name: Configure docker hosts - hosts: oo_nodes_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 - -- include: ../openshift-node/config.yml - -- name: Gather facts - hosts: oo_etcd_to_config:oo_masters_to_config:oo_nodes_to_config - roles: - - openshift_facts - -- name: Update master count - hosts: oo_masters:!oo_masters_to_config - serial: 1 - roles: - - openshift_facts - post_tasks: - - openshift_facts: - role: master - local_facts: - master_count: "{{ openshift_master_count | default(groups.oo_masters | length) }}" - - name: Update master count - lineinfile: - dest: "{{ openshift.common.config_base}}/master/master-config.yaml" - regexp: '^ masterCount:.*$' - line: " masterCount: {{ openshift.master.master_count }}" - notify: - - restart master api - - restart master controllers - handlers: - - name: restart master api - service: name={{ openshift.common.service_type }}-master-controllers state=restarted - notify: verify api server - - name: restart master controllers - service: name={{ openshift.common.service_type }}-master-controllers state=restarted - - name: verify api server - command: > - curl -k --head --silent {{ openshift.master.api_url }} - register: api_available_output - until: api_available_output.stdout.find("200 OK") != -1 - retries: 120 - delay: 1 - changed_when: false - -- include: ../openshift-master/config.yml - -- include: ../openshift-node/config.yml -- cgit v1.2.3