summaryrefslogtreecommitdiffstats
path: root/playbooks
diff options
context:
space:
mode:
authorRodolfo Carvalho <rhcarvalho@gmail.com>2016-12-19 14:47:10 +0100
committerRodolfo Carvalho <rhcarvalho@gmail.com>2017-01-12 14:23:19 +0100
commit82ef5bc291006b51207b9e32626251a03c776548 (patch)
tree82e4d63dd71e0a616b21a15bb08e19847183c6be /playbooks
parente7c4a9410e88e2c18ba05fea067e5988f3b8ffa0 (diff)
downloadopenshift-82ef5bc291006b51207b9e32626251a03c776548.tar.gz
openshift-82ef5bc291006b51207b9e32626251a03c776548.tar.bz2
openshift-82ef5bc291006b51207b9e32626251a03c776548.tar.xz
openshift-82ef5bc291006b51207b9e32626251a03c776548.zip
Add RPM checks as an adhoc playbook
Diffstat (limited to 'playbooks')
-rw-r--r--playbooks/adhoc/preflight/README.md51
-rw-r--r--playbooks/adhoc/preflight/check.yml159
l---------playbooks/adhoc/preflight/library1
3 files changed, 211 insertions, 0 deletions
diff --git a/playbooks/adhoc/preflight/README.md b/playbooks/adhoc/preflight/README.md
new file mode 100644
index 000000000..871c6af01
--- /dev/null
+++ b/playbooks/adhoc/preflight/README.md
@@ -0,0 +1,51 @@
+# 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. Configure a custom callback plugin to get a summary of problems at the end of
+the playbook run:
+
+ ```console
+ $ export ANSIBLE_CALLBACK_PLUGINS=callback_plugins \
+ ANSIBLE_STDOUT_CALLBACK=default_plus_summary
+ ```
+
+3. Run the playbook:
+
+ ```console
+ $ ansible-playbook -i <inventory file> playbooks/adhoc/preflight/check.yml
+ ```
diff --git a/playbooks/adhoc/preflight/check.yml b/playbooks/adhoc/preflight/check.yml
new file mode 100644
index 000000000..b66c1a824
--- /dev/null
+++ b/playbooks/adhoc/preflight/check.yml
@@ -0,0 +1,159 @@
+---
+- hosts: OSEv3
+ gather_facts: no
+ tasks:
+ - 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([]) }}"
+
+- hosts: OSEv3
+ name: check content available on all hosts
+ gather_facts: no
+ ignore_errors: yes
+ tasks:
+ - when:
+ - not containerized
+ block:
+
+ - name: determine if yum update will work
+ action: check_yum_update
+ register: r
+
+ - set_fact:
+ oo_preflight_check_results: "{{ oo_preflight_check_results + [r|combine({'_task': 'check content available on all hosts'})] }}"
+
+ - name: determine if expected version matches what is available
+ aos_version:
+ version: "{{ openshift_release }}"
+ when:
+ - deployment_type == "openshift-enterprise"
+ register: r
+
+ - set_fact:
+ oo_preflight_check_results: "{{ oo_preflight_check_results + [r|combine({'_task': 'determine if expected version matches what is available'})] }}"
+
+- hosts: masters
+ name: determine if yum install of master pkgs will work
+ gather_facts: no
+ ignore_errors: yes
+ tasks:
+ - when:
+ - not containerized
+ block:
+
+ - name: main packages for enterprise
+ when:
+ - deployment_type == "openshift-enterprise"
+ check_yum_update:
+ packages:
+ - atomic-openshift
+ - atomic-openshift-clients
+ - atomic-openshift-master
+ register: r
+
+ - set_fact:
+ oo_preflight_check_results: "{{ oo_preflight_check_results + [r|combine({'_task': 'main packages for enterprise'})] }}"
+
+ - name: main packages for origin
+ when:
+ - deployment_type == "origin"
+ check_yum_update:
+ packages:
+ - origin
+ - origin-clients
+ - origin-master
+ register: r
+
+ - set_fact:
+ oo_preflight_check_results: "{{ oo_preflight_check_results + [r|combine({'_task': 'main packages for origin'})] }}"
+
+ - name: other master packages
+ check_yum_update:
+ packages:
+ - etcd
+ - bash-completion
+ - cockpit-bridge
+ - cockpit-docker
+ - cockpit-kubernetes
+ - cockpit-shell
+ - cockpit-ws
+ - httpd-tools
+ register: r
+
+ - set_fact:
+ oo_preflight_check_results: "{{ oo_preflight_check_results + [r|combine({'_task': 'other master packages'})] }}"
+
+- hosts: nodes
+ name: determine if yum install of node pkgs will work
+ gather_facts: no
+ ignore_errors: yes
+ tasks:
+ - when:
+ - not containerized
+ block:
+
+ - name: main packages for enterprise
+ when:
+ - deployment_type == "openshift-enterprise"
+ check_yum_update:
+ packages:
+ - atomic-openshift
+ - atomic-openshift-node
+ - atomic-openshift-sdn-ovs
+ register: r
+
+ - set_fact:
+ oo_preflight_check_results: "{{ oo_preflight_check_results + [r|combine({'_task': 'main packages for enterprise'})] }}"
+
+ - name: main packages for origin
+ when:
+ - deployment_type == "origin"
+ check_yum_update:
+ packages:
+ - origin
+ - origin-node
+ - origin-sdn-ovs
+ register: r
+
+ - set_fact:
+ oo_preflight_check_results: "{{ oo_preflight_check_results + [r|combine({'_task': 'main packages for origin'})] }}"
+
+ - name: other node packages
+ check_yum_update:
+ packages:
+ - docker
+ - PyYAML
+ - firewalld
+ - iptables
+ - iptables-services
+ - nfs-utils
+ - ntp
+ - yum-utils
+ - dnsmasq
+ - libselinux-python
+ - ceph-common
+ - glusterfs-fuse
+ - iscsi-initiator-utils
+ - pyparted
+ - python-httplib2
+ - openssl
+ - flannel
+ - bind
+ register: r
+
+ - set_fact:
+ oo_preflight_check_results: "{{ oo_preflight_check_results + [r|combine({'_task': 'other node packages'})] }}"
+
+- hosts: OSEv3
+ name: verify check results
+ gather_facts: no
+ tasks:
+
+ - set_fact:
+ oo_preflight_check_failures: "{{ oo_preflight_check_results | select('failed', 'equalto', True) | list }}"
+
+ - name: ensure all checks succeed
+ action: fail
+ when: oo_preflight_check_failures
diff --git a/playbooks/adhoc/preflight/library b/playbooks/adhoc/preflight/library
new file mode 120000
index 000000000..ba40d2f56
--- /dev/null
+++ b/playbooks/adhoc/preflight/library
@@ -0,0 +1 @@
+../../../library \ No newline at end of file