# ansible-playbook [-i /path/to/file] \ (1) ~/openshift-ansible/playbooks/adhoc/uninstall.yml
You can uninstall OKD hosts in your cluster by running the uninstall.yml playbook. This playbook deletes OKD content installed by Ansible, including:
Configuration
Containers
Default templates and image streams
Images
RPM packages
The playbook deletes content for any hosts defined in the inventory file that you specify when running the playbook.
Before you uninstall your cluster, review the following list of scenarios and make sure that uninstalling is the best option:
|
To uninstall OKD across all hosts in your cluster, change to the playbook directory and run the playbook using the inventory file you used most recently:
# ansible-playbook [-i /path/to/file] \ (1) ~/openshift-ansible/playbooks/adhoc/uninstall.yml
1 | If your inventory file is not in the /etc/ansible/hosts directory,
specify -i and the path to the inventory file. |
To uninstall node components from specific hosts using the uninstall.yml playbook while leaving the remaining hosts and cluster alone:
Use this method only when attempting to uninstall specific node hosts, not specific masters or etcd hosts. Uninstalling master or etcd hosts requires more configuration changes in the cluster. |
Follow the steps in Deleting Nodes to remove the node object from the cluster.
Create a different inventory file that references only those hosts. For example, to delete content from only one node:
[OSEv3:children] nodes (1) [OSEv3:vars] ansible_ssh_user=root openshift_deployment_type=origin [nodes] node3.example.com openshift_node_group_name='node-config-infra' (2)
1 | Include only the sections that apply to the hosts to uninstall. |
2 | Include only the hosts to uninstall. |
Change to the playbook directory and run the uninstall.yml playbook:
# ansible-playbook -i /path/to/new/file \ (1) ~/openshift-ansible/playbooks/adhoc/uninstall.yml
1 | Specify the path to the new inventory file. |
When the playbook completes, all OKD content is removed from the specified hosts.