summaryrefslogtreecommitdiffstats
path: root/playbooks/adhoc
diff options
context:
space:
mode:
Diffstat (limited to 'playbooks/adhoc')
-rw-r--r--playbooks/adhoc/atomic_openshift_tutorial_reset.yml2
-rw-r--r--playbooks/adhoc/bootstrap-fedora.yml2
-rw-r--r--playbooks/adhoc/create_pv/pv-template.j22
-rw-r--r--playbooks/adhoc/metrics_setup/README.md25
-rw-r--r--playbooks/adhoc/metrics_setup/files/metrics-deployer-setup.yaml37
-rw-r--r--playbooks/adhoc/metrics_setup/files/metrics.yaml116
-rw-r--r--playbooks/adhoc/metrics_setup/playbooks/install.yml36
-rw-r--r--playbooks/adhoc/metrics_setup/playbooks/master_config_facts.yml10
-rw-r--r--playbooks/adhoc/metrics_setup/playbooks/uninstall.yml16
l---------playbooks/adhoc/noc/filter_plugins1
l---------playbooks/adhoc/noc/roles1
-rw-r--r--playbooks/adhoc/openshift_hosted_logging_efk.yaml6
-rwxr-xr-xplaybooks/adhoc/sdn_restart/oo-sdn-restart.yml3
-rw-r--r--playbooks/adhoc/setupnfs.yml2
-rw-r--r--playbooks/adhoc/uninstall.yml574
15 files changed, 612 insertions, 221 deletions
diff --git a/playbooks/adhoc/atomic_openshift_tutorial_reset.yml b/playbooks/adhoc/atomic_openshift_tutorial_reset.yml
index c14d08e87..5a5a00ea4 100644
--- a/playbooks/adhoc/atomic_openshift_tutorial_reset.yml
+++ b/playbooks/adhoc/atomic_openshift_tutorial_reset.yml
@@ -8,7 +8,7 @@
- hosts:
- OSEv3:children
- sudo: yes
+ become: yes
tasks:
- shell: docker ps -a -q | xargs docker stop
diff --git a/playbooks/adhoc/bootstrap-fedora.yml b/playbooks/adhoc/bootstrap-fedora.yml
index 471c41f16..b380a74d6 100644
--- a/playbooks/adhoc/bootstrap-fedora.yml
+++ b/playbooks/adhoc/bootstrap-fedora.yml
@@ -1,4 +1,4 @@
- hosts: OSEv3
tasks:
- name: install python and deps for ansible modules
- raw: dnf install -y python2 python2-dnf libselinux-python libsemanage-python
+ raw: dnf install -y python2 python2-dnf libselinux-python libsemanage-python python2-firewall
diff --git a/playbooks/adhoc/create_pv/pv-template.j2 b/playbooks/adhoc/create_pv/pv-template.j2
index 5654ef6c4..df082614b 100644
--- a/playbooks/adhoc/create_pv/pv-template.j2
+++ b/playbooks/adhoc/create_pv/pv-template.j2
@@ -10,7 +10,7 @@ spec:
storage: {{ vol_size }}Gi
accessModes:
- ReadWriteOnce
- persistentVolumeReclaimPolicy: Recycle
+ persistentVolumeReclaimPolicy: Retain
awsElasticBlockStore:
volumeID: aws://{{ vol_az }}/{{ vol_id }}
fsType: ext4
diff --git a/playbooks/adhoc/metrics_setup/README.md b/playbooks/adhoc/metrics_setup/README.md
new file mode 100644
index 000000000..71aa1e109
--- /dev/null
+++ b/playbooks/adhoc/metrics_setup/README.md
@@ -0,0 +1,25 @@
+## Playbook for adding [Metrics](https://github.com/openshift/origin-metrics) to Openshift
+
+See OSE Ansible [readme](https://github.com/openshift/openshift-ansible/blob/master/README_OSE.md) for general install instructions. Playbook has been tested on OSE 3.1/RHEL7.2 cluster
+
+
+Add the following vars to `[OSEv3:vars]` section of your inventory file
+```
+[OSEv3:vars]
+# Enable cluster metrics
+use_cluster_metrics=true
+metrics_external_service=< external service name for metrics >
+metrics_image_prefix=rcm-img-docker01.build.eng.bos.redhat.com:5001/openshift3/
+metrics_image_version=3.1.0
+```
+
+Run playbook
+```
+ansible-playbook -i $INVENTORY_FILE playbooks/install.yml
+```
+
+## Contact
+Email: hawkular-dev@lists.jboss.org
+
+## Credits
+Playbook adapted from install shell scripts by Matt Mahoney
diff --git a/playbooks/adhoc/metrics_setup/files/metrics-deployer-setup.yaml b/playbooks/adhoc/metrics_setup/files/metrics-deployer-setup.yaml
new file mode 100644
index 000000000..f70e0b18b
--- /dev/null
+++ b/playbooks/adhoc/metrics_setup/files/metrics-deployer-setup.yaml
@@ -0,0 +1,37 @@
+#!/bin/bash
+#
+# Copyright 2014-2015 Red Hat, Inc. and/or its affiliates
+# and other contributors as indicated by the @author tags.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apiVersion: "v1"
+kind: "List"
+metadata:
+ name: metrics-deployer-setup
+ annotations:
+ description: "Required dependencies for the metrics deployer pod."
+ tags: "infrastructure"
+labels:
+ metrics-infra: deployer
+ provider: openshift
+ component: deployer
+items:
+-
+ apiVersion: v1
+ kind: ServiceAccount
+ metadata:
+ name: metrics-deployer
+ secrets:
+ - name: metrics-deployer
diff --git a/playbooks/adhoc/metrics_setup/files/metrics.yaml b/playbooks/adhoc/metrics_setup/files/metrics.yaml
new file mode 100644
index 000000000..d823b2587
--- /dev/null
+++ b/playbooks/adhoc/metrics_setup/files/metrics.yaml
@@ -0,0 +1,116 @@
+#!/bin/bash
+#
+# Copyright 2014-2015 Red Hat, Inc. and/or its affiliates
+# and other contributors as indicated by the @author tags.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+apiVersion: "v1"
+kind: "Template"
+metadata:
+ name: metrics-deployer-template
+ annotations:
+ description: "Template for deploying the required Metrics integration. Requires cluster-admin 'metrics-deployer' service account and 'metrics-deployer' secret."
+ tags: "infrastructure"
+labels:
+ metrics-infra: deployer
+ provider: openshift
+ component: deployer
+objects:
+-
+ apiVersion: v1
+ kind: Pod
+ metadata:
+ generateName: metrics-deployer-
+ spec:
+ containers:
+ - image: ${IMAGE_PREFIX}metrics-deployer:${IMAGE_VERSION}
+ name: deployer
+ volumeMounts:
+ - name: secret
+ mountPath: /secret
+ readOnly: true
+ - name: empty
+ mountPath: /etc/deploy
+ env:
+ - name: PROJECT
+ valueFrom:
+ fieldRef:
+ fieldPath: metadata.namespace
+ - name: IMAGE_PREFIX
+ value: ${IMAGE_PREFIX}
+ - name: IMAGE_VERSION
+ value: ${IMAGE_VERSION}
+ - name: PUBLIC_MASTER_URL
+ value: ${PUBLIC_MASTER_URL}
+ - name: MASTER_URL
+ value: ${MASTER_URL}
+ - name: REDEPLOY
+ value: ${REDEPLOY}
+ - name: USE_PERSISTENT_STORAGE
+ value: ${USE_PERSISTENT_STORAGE}
+ - name: HAWKULAR_METRICS_HOSTNAME
+ value: ${HAWKULAR_METRICS_HOSTNAME}
+ - name: CASSANDRA_NODES
+ value: ${CASSANDRA_NODES}
+ - name: CASSANDRA_PV_SIZE
+ value: ${CASSANDRA_PV_SIZE}
+ - name: METRIC_DURATION
+ value: ${METRIC_DURATION}
+ dnsPolicy: ClusterFirst
+ restartPolicy: Never
+ serviceAccount: metrics-deployer
+ volumes:
+ - name: empty
+ emptyDir: {}
+ - name: secret
+ secret:
+ secretName: metrics-deployer
+parameters:
+-
+ description: 'Specify prefix for metrics components; e.g. for "openshift/origin-metrics-deployer:v1.1", set prefix "openshift/origin-"'
+ name: IMAGE_PREFIX
+ value: "hawkular/"
+-
+ description: 'Specify version for metrics components; e.g. for "openshift/origin-metrics-deployer:v1.1", set version "v1.1"'
+ name: IMAGE_VERSION
+ value: "0.7.0-SNAPSHOT"
+-
+ description: "Internal URL for the master, for authentication retrieval"
+ name: MASTER_URL
+ value: "https://kubernetes.default.svc:443"
+-
+ description: "External hostname where clients will reach Hawkular Metrics"
+ name: HAWKULAR_METRICS_HOSTNAME
+ required: true
+-
+ description: "If set to true the deployer will try and delete all the existing components before trying to redeploy."
+ name: REDEPLOY
+ value: "false"
+-
+ description: "Set to true for persistent storage, set to false to use non persistent storage"
+ name: USE_PERSISTENT_STORAGE
+ value: "true"
+-
+ description: "The number of Cassandra Nodes to deploy for the initial cluster"
+ name: CASSANDRA_NODES
+ value: "1"
+-
+ description: "The persistent volume size for each of the Cassandra nodes"
+ name: CASSANDRA_PV_SIZE
+ value: "1Gi"
+-
+ description: "How many days metrics should be stored for."
+ name: METRIC_DURATION
+ value: "7"
diff --git a/playbooks/adhoc/metrics_setup/playbooks/install.yml b/playbooks/adhoc/metrics_setup/playbooks/install.yml
new file mode 100644
index 000000000..235f775ef
--- /dev/null
+++ b/playbooks/adhoc/metrics_setup/playbooks/install.yml
@@ -0,0 +1,36 @@
+---
+- include: master_config_facts.yml
+- name: "Install metrics"
+ hosts: masters
+ vars:
+ metrics_public_url: "https://{{ metrics_external_service }}/hawkular/metrics"
+ tasks:
+ - name: "Add metrics url to master config"
+ lineinfile: "state=present dest=/etc/origin/master/master-config.yaml regexp='^\ \ metricsPublicURL' insertbefore='^\ \ publicURL' line='\ \ metricsPublicURL: {{ metrics_public_url }}'"
+
+ - name: "Restart master service"
+ service: name=atomic-openshift-master state=restarted
+
+ - name: "Copy metrics-deployer yaml to remote"
+ copy: "src=../files/metrics-deployer-setup.yaml dest=/tmp/metrics-deployer-setup.yaml force=yes"
+
+ - name: "Add metrics-deployer"
+ command: "{{item}}"
+ with_items:
+ - oc project openshift-infra
+ - oc create -f /tmp/metrics-deployer-setup.yaml
+
+ - name: "Give metrics-deployer SA permissions"
+ command: "oadm policy add-role-to-user edit system:serviceaccount:openshift-infra:metrics-deployer"
+
+ - name: "Give heapster SA permissions"
+ command: "oadm policy add-cluster-role-to-user cluster-reader system:serviceaccount:openshift-infra:heapster"
+
+ - name: "Create metrics-deployer secret"
+ command: "oc secrets new metrics-deployer nothing=/dev/null"
+
+ - name: "Copy metrics.yaml to remote"
+ copy: "src=../files/metrics.yaml dest=/tmp/metrics.yaml force=yes"
+
+ - name: "Process yml template"
+ shell: "oc process -f /tmp/metrics.yaml -v MASTER_URL={{ masterPublicURL }},REDEPLOY=true,HAWKULAR_METRICS_HOSTNAME={{ metrics_external_service }},IMAGE_PREFIX={{ metrics_image_prefix }},IMAGE_VERSION={{ metrics_image_version }},USE_PERSISTENT_STORAGE=false | oc create -f -"
diff --git a/playbooks/adhoc/metrics_setup/playbooks/master_config_facts.yml b/playbooks/adhoc/metrics_setup/playbooks/master_config_facts.yml
new file mode 100644
index 000000000..65de11bc4
--- /dev/null
+++ b/playbooks/adhoc/metrics_setup/playbooks/master_config_facts.yml
@@ -0,0 +1,10 @@
+---
+- name: "Load master config"
+ hosts: masters
+ vars:
+ master_config_file: "/tmp/ansible-metrics-{{ ansible_hostname }}"
+ tasks:
+ - name: "Fetch master config from remote"
+ fetch: "src=/etc/origin/master/master-config.yaml dest={{ master_config_file }} flat=yes"
+ - name: "Load config"
+ include_vars: "{{ master_config_file }}"
diff --git a/playbooks/adhoc/metrics_setup/playbooks/uninstall.yml b/playbooks/adhoc/metrics_setup/playbooks/uninstall.yml
new file mode 100644
index 000000000..06c4586ee
--- /dev/null
+++ b/playbooks/adhoc/metrics_setup/playbooks/uninstall.yml
@@ -0,0 +1,16 @@
+---
+- name: "Uninstall metrics"
+ hosts: masters
+ tasks:
+ - name: "Remove metrics url from master config"
+ lineinfile: "state=absent dest=/etc/origin/master/master-config.yaml regexp='^\ \ metricsPublicURL'"
+
+ - name: "Delete metrics objects"
+ command: "{{item}}"
+ with_items:
+ - oc delete all --selector=metrics-infra
+ # - oc delete secrets --selector=metrics-infra
+ # - oc delete sa --selector=metrics-infra
+ - oc delete templates --selector=metrics-infra
+ - oc delete sa metrics-deployer
+ - oc delete secret metrics-deployer
diff --git a/playbooks/adhoc/noc/filter_plugins b/playbooks/adhoc/noc/filter_plugins
deleted file mode 120000
index 99a95e4ca..000000000
--- a/playbooks/adhoc/noc/filter_plugins
+++ /dev/null
@@ -1 +0,0 @@
-../../../filter_plugins \ No newline at end of file
diff --git a/playbooks/adhoc/noc/roles b/playbooks/adhoc/noc/roles
deleted file mode 120000
index 20c4c58cf..000000000
--- a/playbooks/adhoc/noc/roles
+++ /dev/null
@@ -1 +0,0 @@
-../../../roles \ No newline at end of file
diff --git a/playbooks/adhoc/openshift_hosted_logging_efk.yaml b/playbooks/adhoc/openshift_hosted_logging_efk.yaml
new file mode 100644
index 000000000..a3121d046
--- /dev/null
+++ b/playbooks/adhoc/openshift_hosted_logging_efk.yaml
@@ -0,0 +1,6 @@
+---
+- hosts: masters[0]
+ roles:
+ - role: openshift_hosted_logging
+ openshift_hosted_logging_cleanup: no
+
diff --git a/playbooks/adhoc/sdn_restart/oo-sdn-restart.yml b/playbooks/adhoc/sdn_restart/oo-sdn-restart.yml
index 0dc021fbc..08e8f8968 100755
--- a/playbooks/adhoc/sdn_restart/oo-sdn-restart.yml
+++ b/playbooks/adhoc/sdn_restart/oo-sdn-restart.yml
@@ -49,5 +49,4 @@
name: "{{ item }}"
state: restarted
with_items:
- - oso-f22-host-monitoring
- - oso-rhel7-zagg-client
+ - oso-rhel7-host-monitoring
diff --git a/playbooks/adhoc/setupnfs.yml b/playbooks/adhoc/setupnfs.yml
index 5f3631fcf..fd489dc70 100644
--- a/playbooks/adhoc/setupnfs.yml
+++ b/playbooks/adhoc/setupnfs.yml
@@ -1,7 +1,7 @@
---
### This playbook is old and we are currently not using NFS.
- hosts: tag_Name_nfs-v3-stg
- sudo: no
+ become: no
remote_user: root
gather_facts: no
roles:
diff --git a/playbooks/adhoc/uninstall.yml b/playbooks/adhoc/uninstall.yml
index 8b620d9ad..4edd44fe4 100644
--- a/playbooks/adhoc/uninstall.yml
+++ b/playbooks/adhoc/uninstall.yml
@@ -7,221 +7,369 @@
# images
# RPMs
---
-- hosts:
- - OSEv3:children
+- hosts: OSEv3:children
+ become: yes
+ tasks:
+ - name: Detecting Operating System
+ shell: ls /run/ostree-booted
+ ignore_errors: yes
+ failed_when: false
+ register: ostree_output
- sudo: yes
+ # 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 }}"
+- hosts: nodes
+ become: yes
tasks:
- - name: Detecting Operating System
- shell: ls /run/ostree-booted
- ignore_errors: yes
- 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
-
- - name: Stop services
- service: name={{ item }} state=stopped
- with_items:
- - atomic-enterprise-master
- - atomic-enterprise-node
- - atomic-openshift-master
- - atomic-openshift-master-api
- - atomic-openshift-master-controllers
- - atomic-openshift-node
- - etcd
- - haproxy
- - openshift-master
- - openshift-master-api
- - openshift-master-controllers
- - openshift-node
- - openvswitch
- - origin-master
- - origin-master-api
- - origin-master-controllers
- - origin-node
- - pcsd
- failed_when: false
-
- - name: Stop additional atomic services
- service: name={{ item }} state=stopped
- when: is_atomic | bool
- with_items:
- - etcd_container
- failed_when: false
-
- - name: Remove packages
- action: "{{ ansible_pkg_mgr }} name={{ item }} state=absent"
- when: not is_atomic | bool
- with_items:
- - atomic-enterprise
- - atomic-enterprise-master
- - atomic-enterprise-node
- - atomic-enterprise-sdn-ovs
- - atomic-openshift
- - atomic-openshift-clients
- - atomic-openshift-master
- - atomic-openshift-node
- - atomic-openshift-sdn-ovs
- - corosync
- - etcd
- - haproxy
- - openshift
- - openshift-master
- - openshift-node
- - openshift-sdn
- - openshift-sdn-ovs
- - openvswitch
- - origin
- - origin-clients
- - origin-master
- - origin-node
- - origin-sdn-ovs
- - pacemaker
- - pcs
- - tuned-profiles-atomic-enterprise-node
- - tuned-profiles-atomic-openshift-node
- - tuned-profiles-openshift-node
- - tuned-profiles-origin-node
-
- - name: Remove linux interfaces
- shell: ip link del "{{ item }}"
- changed_when: False
- failed_when: False
- with_items:
- - lbr0
- - vlinuxbr
- - vovsbr
-
- - shell: systemctl reset-failed
- changed_when: False
-
- - shell: systemctl daemon-reload
- changed_when: False
-
- - shell: find /var/lib/origin/openshift.local.volumes -type d -exec umount {} \; 2>/dev/null || true
- changed_when: False
-
- - shell: find /var/lib/atomic-enterprise/openshift.local.volumes -type d -exec umount {} \; 2>/dev/null || true
- changed_when: False
-
- - shell: find /var/lib/openshift/openshift.local.volumes -type d -exec umount {} \; 2>/dev/null || true
- changed_when: False
-
- - shell: docker rm -f "{{ item }}"-master "{{ item }}"-node
- changed_when: False
- failed_when: False
- with_items:
- - openshift-enterprise
- - atomic-enterprise
- - origin
-
- - shell: docker ps -a | grep Exited | egrep "{{ item }}" | awk '{print $1}'
- changed_when: False
- failed_when: False
- register: exited_containers_to_delete
- with_items:
- - aep3.*/aep
- - openshift3/ose
- - openshift/origin
-
- - shell: "docker rm {{ item.stdout_lines | join(' ') }}"
- changed_when: False
- failed_when: False
- with_items: "{{ exited_containers_to_delete.results }}"
-
- - shell: docker images | egrep {{ item }} | awk '{ print $3 }'
- changed_when: False
- failed_when: False
- register: images_to_delete
- 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
-
- - name: Remove remaining files
- file: path={{ item }} state=absent
- with_items:
- - "~{{ ansible_ssh_user }}/.kube"
- - /etc/ansible/facts.d/openshift.fact
- - /etc/atomic-enterprise
- - /etc/corosync
- - /etc/etcd
- - /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
- - /etc/sysconfig/atomic-openshift-master-controllers
- - /etc/sysconfig/atomic-openshift-node
- - /etc/sysconfig/openshift-master
- - /etc/sysconfig/openshift-node
- - /etc/sysconfig/origin-master
- - /etc/sysconfig/origin-master-api
- - /etc/sysconfig/origin-master-controllers
- - /etc/sysconfig/origin-node
- - /etc/systemd/system/atomic-openshift-node.service.wants
- - /root/.kube
- - /run/openshift-sdn
- - /usr/share/openshift/examples
- - /var/lib/atomic-enterprise
- - /var/lib/etcd
- - /var/lib/openshift
- - /var/lib/origin
- - /var/lib/pacemaker
- - /usr/lib/systemd/system/atomic-openshift-master-api.service
- - /usr/lib/systemd/system/atomic-openshift-master-controllers.service
- - /usr/lib/systemd/system/origin-master-api.service
- - /usr/lib/systemd/system/origin-master-controllers.service
- - /usr/local/bin/openshift
- - /usr/local/bin/oadm
- - /usr/local/bin/oc
- - /usr/local/bin/kubectl
-
- # Since we are potentially removing the systemd unit files for separated
- # master-api and master-controllers services, so we need to reload the
- # systemd configuration manager
- - name: Reload systemd manager configuration
- command: systemctl daemon-reload
+ - name: Stop services
+ service: name={{ item }} state=stopped
+ with_items:
+ - atomic-enterprise-node
+ - atomic-openshift-node
+ - openshift-node
+ - openvswitch
+ - origin-node
+ failed_when: false
-- hosts: nodes
- sudo: yes
+ - name: unmask services
+ command: systemctl unmask "{{ item }}"
+ changed_when: False
+ failed_when: False
+ with_items:
+ - firewalld
+
+ - name: Remove packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=absent"
+ when: not is_atomic | bool
+ with_items:
+ - atomic-enterprise
+ - atomic-enterprise-node
+ - atomic-enterprise-sdn-ovs
+ - atomic-openshift
+ - atomic-openshift-clients
+ - atomic-openshift-node
+ - atomic-openshift-sdn-ovs
+ - cockpit-bridge
+ - cockpit-docker
+ - cockpit-shell
+ - cockpit-ws
+ - kubernetes-client
+ - openshift
+ - openshift-node
+ - openshift-sdn
+ - openshift-sdn-ovs
+ - openvswitch
+ - origin
+ - origin-clients
+ - origin-node
+ - origin-sdn-ovs
+ - tuned-profiles-atomic-enterprise-node
+ - tuned-profiles-atomic-openshift-node
+ - tuned-profiles-openshift-node
+ - tuned-profiles-origin-node
+
+ - shell: systemctl reset-failed
+ changed_when: False
+
+ - shell: systemctl daemon-reload
+ changed_when: False
+
+ - name: Remove br0 interface
+ shell: ovs-vsctl del-br br0
+ changed_when: False
+ failed_when: False
+
+ - name: Remove linux interfaces
+ shell: ip link del "{{ item }}"
+ changed_when: False
+ failed_when: False
+ with_items:
+ - lbr0
+ - vlinuxbr
+ - vovsbr
+
+ - name: restart docker
+ service: name=docker state=restarted
+
+ - name: restart NetworkManager
+ service: name=NetworkManager state=restarted
+
+ - shell: find /var/lib/origin/openshift.local.volumes -type d -exec umount {} \; 2>/dev/null || true
+ changed_when: False
+
+ - shell: find /var/lib/atomic-enterprise/openshift.local.volumes -type d -exec umount {} \; 2>/dev/null || true
+ changed_when: False
+
+ - shell: find /var/lib/openshift/openshift.local.volumes -type d -exec umount {} \; 2>/dev/null || true
+ changed_when: False
+
+ - shell: docker rm -f "{{ item }}"-master "{{ item }}"-node
+ changed_when: False
+ failed_when: False
+ with_items:
+ - openshift-enterprise
+ - atomic-enterprise
+ - origin
+
+ - shell: docker ps -a | grep Exited | egrep "{{ item }}" | awk '{print $1}'
+ changed_when: False
+ failed_when: False
+ register: exited_containers_to_delete
+ with_items:
+ - aep3.*/aep
+ - aep3.*/node
+ - aep3.*/openvswitch
+ - openshift3/ose
+ - openshift3/node
+ - openshift3/openvswitch
+ - openshift/origin
+
+ - shell: "docker rm {{ item.stdout_lines | join(' ') }}"
+ changed_when: False
+ failed_when: False
+ with_items: "{{ exited_containers_to_delete.results }}"
+
+ - shell: docker images | egrep {{ item }} | awk '{ print $3 }'
+ changed_when: False
+ failed_when: False
+ register: images_to_delete
+ with_items:
+ - registry\.access\..*redhat\.com/openshift3
+ - registry\.access\..*redhat\.com/aep3
+ - registry\.qe\.openshift\.com/.*
+ - registry\.access\..*redhat\.com/rhel7/etcd
+ - docker.io/openshift
+ when: openshift_uninstall_images | default(True) | bool
+
+ - shell: "docker rmi -f {{ item.stdout_lines | join(' ') }}"
+ changed_when: False
+ failed_when: False
+ with_items: "{{ images_to_delete.results }}"
+ when: openshift_uninstall_images | default(True) | bool
+
+ - name: Remove sdn drop files
+ file:
+ path: /run/openshift-sdn
+ state: absent
+
+ - name: Remove remaining files
+ file: path={{ item }} state=absent
+ with_items:
+ - /etc/ansible/facts.d/openshift.fact
+ - /etc/atomic-enterprise
+ - /etc/openshift
+ - /etc/openshift-sdn
+ - /etc/origin
+ - /etc/systemd/system/atomic-openshift-node.service
+ - /etc/systemd/system/atomic-openshift-node-dep.service
+ - /etc/systemd/system/origin-node.service
+ - /etc/systemd/system/origin-node-dep.service
+ - /etc/systemd/system/openvswitch.service
+ - /etc/sysconfig/atomic-enterprise-node
+ - /etc/sysconfig/atomic-openshift-node
+ - /etc/sysconfig/atomic-openshift-node-dep
+ - /etc/sysconfig/origin-node
+ - /etc/sysconfig/origin-node-dep
+ - /etc/sysconfig/openshift-node
+ - /etc/sysconfig/openshift-node-dep
+ - /etc/sysconfig/openvswitch
+ - /etc/sysconfig/origin-node
+ - /etc/systemd/system/atomic-openshift-node.service.wants
+ - /run/openshift-sdn
+ - /var/lib/atomic-enterprise
+ - /var/lib/openshift
+ - /var/lib/origin
+ - /etc/NetworkManager/dispatcher.d/99-origin-dns.sh
+ - /etc/dnsmasq.d/origin-dns.conf
+ - /etc/dnsmasq.d/origin-upstream-dns.conf
+
+- hosts: masters
+ become: yes
tasks:
- - name: restart docker
- service: name=docker state=restarted
+ - name: Stop services
+ service: name={{ item }} state=stopped
+ with_items:
+ - atomic-enterprise-master
+ - atomic-openshift-master
+ - atomic-openshift-master-api
+ - atomic-openshift-master-controllers
+ - openshift-master
+ - openshift-master-api
+ - openshift-master-controllers
+ - origin-master
+ - origin-master-api
+ - origin-master-controllers
+ - pcsd
+ failed_when: false
+
+ - name: unmask services
+ command: systemctl unmask "{{ item }}"
+ changed_when: False
+ failed_when: False
+ with_items:
+ - firewalld
+ - atomic-openshift-master
+
+ - name: Remove packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=absent"
+ when: not is_atomic | bool
+ with_items:
+ - atomic-enterprise
+ - atomic-enterprise-master
+ - atomic-openshift
+ - atomic-openshift-clients
+ - atomic-openshift-master
+ - cockpit-bridge
+ - cockpit-docker
+ - cockpit-shell
+ - cockpit-ws
+ - corosync
+ - kubernetes-client
+ - openshift
+ - openshift-master
+ - origin
+ - origin-clients
+ - origin-master
+ - pacemaker
+ - pcs
+
+ - shell: systemctl reset-failed
+ changed_when: False
+
+ - shell: systemctl daemon-reload
+ changed_when: False
+
+ - name: Remove remaining files
+ file: path={{ item }} state=absent
+ with_items:
+ - "~{{ ansible_ssh_user }}/.kube"
+ - /etc/ansible/facts.d/openshift.fact
+ - /etc/atomic-enterprise
+ - /etc/corosync
+ - /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/origin-master.service
+ - /etc/systemd/system/origin-master-api.service
+ - /etc/systemd/system/origin-master-controllers.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-openshift-master
+ - /etc/sysconfig/atomic-openshift-master-api
+ - /etc/sysconfig/atomic-openshift-master-controllers
+ - /etc/sysconfig/origin-master
+ - /etc/sysconfig/origin-master-api
+ - /etc/sysconfig/origin-master-controllers
+ - /etc/sysconfig/openshift-master
+ - /etc/sysconfig/openvswitch
+ - /etc/sysconfig/origin-master
+ - /etc/sysconfig/origin-master-api
+ - /etc/sysconfig/origin-master-controllers
+ - /root/.kube
+ - /usr/share/openshift/examples
+ - /var/lib/atomic-enterprise
+ - /var/lib/openshift
+ - /var/lib/origin
+ - /var/lib/pacemaker
+ - /var/lib/pcsd
+ - /usr/lib/systemd/system/atomic-openshift-master-api.service
+ - /usr/lib/systemd/system/atomic-openshift-master-controllers.service
+ - /usr/lib/systemd/system/origin-master-api.service
+ - /usr/lib/systemd/system/origin-master-controllers.service
+ - /usr/local/bin/openshift
+ - /usr/local/bin/oadm
+ - /usr/local/bin/oc
+ - /usr/local/bin/kubectl
+
+ # Since we are potentially removing the systemd unit files for separated
+ # master-api and master-controllers services, so we need to reload the
+ # systemd configuration manager
+ - name: Reload systemd manager configuration
+ command: systemctl daemon-reload
+
+- hosts: etcd
+ become: yes
+ tasks:
+ - name: Stop services
+ service: name={{ item }} state=stopped
+ with_items:
+ - etcd
+ failed_when: false
+
+ - name: unmask services
+ command: systemctl unmask "{{ item }}"
+ changed_when: False
+ failed_when: False
+ with_items:
+ - etcd
+ - firewalld
+
+ - name: Stop additional atomic services
+ service: name={{ item }} state=stopped
+ when: is_containerized | bool
+ with_items:
+ - etcd_container
+ failed_when: false
+
+ - name: Remove packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=absent"
+ when: not is_atomic | bool
+ with_items:
+ - etcd
+
+ - shell: systemctl reset-failed
+ changed_when: False
+
+ - shell: systemctl daemon-reload
+ changed_when: False
+
+ - name: Remove remaining files
+ file: path={{ item }} state=absent
+ with_items:
+ - /etc/ansible/facts.d/openshift.fact
+ - /etc/etcd
+ - /etc/systemd/system/etcd_container.service
+ - /var/lib/etcd
+
+- hosts: lb
+ become: yes
+ tasks:
+ - name: Stop services
+ service: name={{ item }} state=stopped
+ with_items:
+ - haproxy
+ failed_when: false
+
+ - name: unmask services
+ command: systemctl unmask "{{ item }}"
+ changed_when: False
+ failed_when: False
+ with_items:
+ - firewalld
+
+ - name: Remove packages
+ action: "{{ ansible_pkg_mgr }} name={{ item }} state=absent"
+ when: not is_atomic | bool
+ with_items:
+ - haproxy
+
+ - shell: systemctl reset-failed
+ changed_when: False
+
+ - shell: systemctl daemon-reload
+ changed_when: False
+
+ - name: Remove remaining files
+ file: path={{ item }} state=absent
+ with_items:
+ - /etc/ansible/facts.d/openshift.fact
+ - /var/lib/haproxy