cb6a79ccc4
Restrict network from gathering of unrelated facts. That can be slow on systems with complex network configurations. Change-Id: I2c58e5c1175ea9d77136c45fd58109bdacda8cef Signed-off-by: Bogdan Dobrelya <bdobreli@redhat.com>
71 lines
2.0 KiB
YAML
71 lines
2.0 KiB
YAML
---
|
|
# Copyright 2019 Red Hat, Inc.
|
|
# All Rights Reserved.
|
|
#
|
|
# 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.
|
|
|
|
- name: Load vars if needed
|
|
when: tripleo_podman_purge_packages is undefined or tripleo_podman_purge_packages|length == 0
|
|
import_tasks: load_vars.yaml
|
|
|
|
- name: Check if docker has some data
|
|
stat:
|
|
path: /var/lib/docker
|
|
register: docker_path_stat
|
|
|
|
- name: Docker purge block
|
|
when:
|
|
- docker_path_stat.stat.exists | bool
|
|
become: true
|
|
block:
|
|
- name: Check docker service state
|
|
systemd:
|
|
name: docker
|
|
register: docker_service_state
|
|
|
|
- name: Run docker system prune
|
|
shell: docker system prune -a -f
|
|
when:
|
|
- (docker_service_state.status['SubState'] | lower) == 'running'
|
|
|
|
- name: Stop and disable Docker service
|
|
systemd:
|
|
name: docker
|
|
state: stopped
|
|
enabled: false
|
|
when:
|
|
- (docker_service_state.status['ActiveState'] | lower) != 'inactive'
|
|
|
|
- name: Uninstall Docker rpm
|
|
package:
|
|
name: "{{ tripleo_podman_purge_packages }}"
|
|
state: absent
|
|
|
|
- name: Refresh hardware facts
|
|
setup:
|
|
gather_subset:
|
|
- '!all'
|
|
- '!min'
|
|
- hardware
|
|
|
|
- name: Un-mount docker directories
|
|
mount:
|
|
path: "{{ item.mount }}"
|
|
state: unmounted
|
|
loop: "{{ ansible_mounts | selectattr('mount', 'search', 'docker') | list }}"
|
|
|
|
- name: Purge /var/lib/docker
|
|
file:
|
|
path: /var/lib/docker
|
|
state: absent
|