From 22d60dcccf62abd52caf9233fdcf0835d6343681 Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Thu, 12 Jan 2017 17:07:04 +0100 Subject: Move playbook to BYO Because that's the main playbook directory in use. --- playbooks/byo/openshift-preflight/README.md | 43 +++++++++++++++++++++++++++++ playbooks/byo/openshift-preflight/check.yml | 32 +++++++++++++++++++++ 2 files changed, 75 insertions(+) create mode 100644 playbooks/byo/openshift-preflight/README.md create mode 100644 playbooks/byo/openshift-preflight/check.yml (limited to 'playbooks/byo') diff --git a/playbooks/byo/openshift-preflight/README.md b/playbooks/byo/openshift-preflight/README.md new file mode 100644 index 000000000..b50292eac --- /dev/null +++ b/playbooks/byo/openshift-preflight/README.md @@ -0,0 +1,43 @@ +# OpenShift preflight checks + +Here we provide an Ansible playbook for detecting potential roadblocks prior to +an install or upgrade. + +Ansible's default operation mode is to fail fast, on the first error. However, +when performing checks, it is useful to gather as much information about +problems as possible in a single run. + +The `check.yml` playbook runs a battery of checks against the inventory hosts +and tells Ansible to ignore intermediate errors, thus giving a more complete +diagnostic of the state of each host. Still, if any check failed, the playbook +run will be marked as having failed. + +To facilitate understanding the problems that were encountered, we provide a +custom callback plugin to summarize execution errors at the end of a playbook +run. + +--- + +*Note that currently the `check.yml` playbook is only useful for RPM-based +installations. Containerized installs are excluded from checks for now, but +might be included in the future if there is demand for that.* + +--- + +## Running + +With an installation of Ansible 2.2 or greater, run the playbook directly +against your inventory file. Here is the step-by-step: + +1. If you haven't done it yet, clone this repository: + + ```console + $ git clone https://github.com/openshift/openshift-ansible + $ cd openshift-ansible + ``` + +2. Run the playbook: + + ```console + $ ansible-playbook -i playbooks/byo/openshift-preflight/check.yml + ``` diff --git a/playbooks/byo/openshift-preflight/check.yml b/playbooks/byo/openshift-preflight/check.yml new file mode 100644 index 000000000..460ba4ce4 --- /dev/null +++ b/playbooks/byo/openshift-preflight/check.yml @@ -0,0 +1,32 @@ +--- +- hosts: OSEv3 + gather_facts: no + roles: + - openshift_preflight/facts + +- hosts: OSEv3 + name: checks that apply to all hosts + gather_facts: no + ignore_errors: yes + roles: + - openshift_preflight/common + +- hosts: masters + name: checks that apply to masters + gather_facts: no + ignore_errors: yes + roles: + - openshift_preflight/masters + +- hosts: nodes + name: checks that apply to nodes + gather_facts: no + ignore_errors: yes + roles: + - openshift_preflight/nodes + +- hosts: OSEv3 + name: verify check results + gather_facts: no + roles: + - openshift_preflight/verify_status -- cgit v1.2.3 From c4aec0fbd112fd1c8503e935ac954da268a2fdff Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Thu, 12 Jan 2017 18:30:24 +0100 Subject: Replace custom variables with openshift_facts Note: on a simple example run of ansible-playbook against a single docker-based host, I saw the execution time jump from 7s to 17s. That's unfortunate, but it is probably better to reuse openshift_facts, than to come up with new variables. --- playbooks/byo/openshift-preflight/check.yml | 1 - roles/openshift_preflight/common/tasks/main.yml | 3 +-- roles/openshift_preflight/facts/meta/main.yml | 3 +++ roles/openshift_preflight/facts/tasks/main.yml | 3 --- roles/openshift_preflight/masters/tasks/main.yml | 3 +-- roles/openshift_preflight/nodes/tasks/main.yml | 3 +-- 6 files changed, 6 insertions(+), 10 deletions(-) create mode 100644 roles/openshift_preflight/facts/meta/main.yml (limited to 'playbooks/byo') diff --git a/playbooks/byo/openshift-preflight/check.yml b/playbooks/byo/openshift-preflight/check.yml index 460ba4ce4..94f53eb84 100644 --- a/playbooks/byo/openshift-preflight/check.yml +++ b/playbooks/byo/openshift-preflight/check.yml @@ -1,6 +1,5 @@ --- - hosts: OSEv3 - gather_facts: no roles: - openshift_preflight/facts diff --git a/roles/openshift_preflight/common/tasks/main.yml b/roles/openshift_preflight/common/tasks/main.yml index 423b13586..bb54d0380 100644 --- a/roles/openshift_preflight/common/tasks/main.yml +++ b/roles/openshift_preflight/common/tasks/main.yml @@ -1,7 +1,6 @@ --- # check content available on all hosts -- when: - - not containerized +- when: not openshift.common.is_containerized | bool block: - name: determine if yum update will work diff --git a/roles/openshift_preflight/facts/meta/main.yml b/roles/openshift_preflight/facts/meta/main.yml new file mode 100644 index 000000000..0bbeadd34 --- /dev/null +++ b/roles/openshift_preflight/facts/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: openshift_facts diff --git a/roles/openshift_preflight/facts/tasks/main.yml b/roles/openshift_preflight/facts/tasks/main.yml index 15a108510..bf2d82196 100644 --- a/roles/openshift_preflight/facts/tasks/main.yml +++ b/roles/openshift_preflight/facts/tasks/main.yml @@ -1,7 +1,4 @@ --- - name: set common variables set_fact: - deployment_type: "{{ deployment_type | default('openshift-enterprise') }}" - containerized: "{{ containerized | default('no') | bool }}" - openshift_release: "{{ openshift_release | default('3.3') }}" oo_preflight_check_results: "{{ oo_preflight_check_results | default([]) }}" diff --git a/roles/openshift_preflight/masters/tasks/main.yml b/roles/openshift_preflight/masters/tasks/main.yml index ed42f69fa..80d7af208 100644 --- a/roles/openshift_preflight/masters/tasks/main.yml +++ b/roles/openshift_preflight/masters/tasks/main.yml @@ -1,7 +1,6 @@ --- # determine if yum install of master pkgs will work -- when: - - not containerized +- when: not openshift.common.is_containerized | bool block: - name: main packages for enterprise diff --git a/roles/openshift_preflight/nodes/tasks/main.yml b/roles/openshift_preflight/nodes/tasks/main.yml index 16c7212d4..c98b02bf5 100644 --- a/roles/openshift_preflight/nodes/tasks/main.yml +++ b/roles/openshift_preflight/nodes/tasks/main.yml @@ -1,7 +1,6 @@ --- # determine if yum install of node pkgs will work -- when: - - not containerized +- when: not openshift.common.is_containerized | bool block: - name: main packages for enterprise -- cgit v1.2.3 From 01046c33e0bdcaf44dbd9bfcdf84f1a9a335437c Mon Sep 17 00:00:00 2001 From: Rodolfo Carvalho Date: Fri, 13 Jan 2017 17:06:57 +0100 Subject: Rename subrole facts -> init Trying to improve the name, `init` needs to be loaded before calling other subroles. We don't make `init` a dependency of `common`, `masters` and `nodes` to avoid running the relatively slow `openshift_facts` multiple times. --- playbooks/byo/openshift-preflight/check.yml | 2 +- roles/openshift_preflight/README.md | 3 +-- roles/openshift_preflight/facts/meta/main.yml | 3 --- roles/openshift_preflight/facts/tasks/main.yml | 4 ---- roles/openshift_preflight/init/meta/main.yml | 3 +++ roles/openshift_preflight/init/tasks/main.yml | 4 ++++ 6 files changed, 9 insertions(+), 10 deletions(-) delete mode 100644 roles/openshift_preflight/facts/meta/main.yml delete mode 100644 roles/openshift_preflight/facts/tasks/main.yml create mode 100644 roles/openshift_preflight/init/meta/main.yml create mode 100644 roles/openshift_preflight/init/tasks/main.yml (limited to 'playbooks/byo') diff --git a/playbooks/byo/openshift-preflight/check.yml b/playbooks/byo/openshift-preflight/check.yml index 94f53eb84..32673d01d 100644 --- a/playbooks/byo/openshift-preflight/check.yml +++ b/playbooks/byo/openshift-preflight/check.yml @@ -1,7 +1,7 @@ --- - hosts: OSEv3 roles: - - openshift_preflight/facts + - openshift_preflight/init - hosts: OSEv3 name: checks that apply to all hosts diff --git a/roles/openshift_preflight/README.md b/roles/openshift_preflight/README.md index a3d734e32..b6d3542d3 100644 --- a/roles/openshift_preflight/README.md +++ b/roles/openshift_preflight/README.md @@ -24,9 +24,8 @@ Example Playbook ```yaml --- - hosts: OSEv3 - gather_facts: no roles: - - openshift_preflight/facts + - openshift_preflight/init - hosts: OSEv3 name: checks that apply to all hosts diff --git a/roles/openshift_preflight/facts/meta/main.yml b/roles/openshift_preflight/facts/meta/main.yml deleted file mode 100644 index 0bbeadd34..000000000 --- a/roles/openshift_preflight/facts/meta/main.yml +++ /dev/null @@ -1,3 +0,0 @@ ---- -dependencies: - - role: openshift_facts diff --git a/roles/openshift_preflight/facts/tasks/main.yml b/roles/openshift_preflight/facts/tasks/main.yml deleted file mode 100644 index bf2d82196..000000000 --- a/roles/openshift_preflight/facts/tasks/main.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- name: set common variables - set_fact: - oo_preflight_check_results: "{{ oo_preflight_check_results | default([]) }}" diff --git a/roles/openshift_preflight/init/meta/main.yml b/roles/openshift_preflight/init/meta/main.yml new file mode 100644 index 000000000..0bbeadd34 --- /dev/null +++ b/roles/openshift_preflight/init/meta/main.yml @@ -0,0 +1,3 @@ +--- +dependencies: + - role: openshift_facts diff --git a/roles/openshift_preflight/init/tasks/main.yml b/roles/openshift_preflight/init/tasks/main.yml new file mode 100644 index 000000000..bf2d82196 --- /dev/null +++ b/roles/openshift_preflight/init/tasks/main.yml @@ -0,0 +1,4 @@ +--- +- name: set common variables + set_fact: + oo_preflight_check_results: "{{ oo_preflight_check_results | default([]) }}" -- cgit v1.2.3