Simplify tripleo_container_rm to not check binaries

There is no need to check container cli binaries; since we have
tripleo_container_cli variable, we should expect that binary to be
installed.

At scale, when used with tripleo_container_manage, these stat tasks end
up being run too many times. Let's clean it.

The code was done in the context of:
https://bugs.launchpad.net/tripleo/+bug/1836531

But there is no docker engine anymore, we use Podman since Stein;
so we shouldn't need it anymore.

Change-Id: If0d6d8a737a22b85ed38e6c64c11d9df81ef3a9b
This commit is contained in:
Emilien Macchi 2020-04-16 18:15:09 -04:00
parent dd75d7fbdf
commit e071866543
1 changed files with 4 additions and 29 deletions

View File

@ -14,32 +14,7 @@
# License for the specific language governing permissions and limitations
# under the License.
- block:
- name: Check for docker cli
stat:
path: "/var/run/docker.sock"
register: check_docker_cli
check_mode: false
- include_tasks: "tripleo_{{ tripleo_container_cli }}_container_rm.yml"
vars:
container: "{{ item }}"
with_items: "{{ tripleo_containers_to_rm }}"
when: check_docker_cli.stat.exists|bool
when:
- tripleo_container_cli == 'docker'
- block:
- name: Check for podman cli
command: "command -v podman"
register: check_podman_cli
failed_when: false
check_mode: false
- include_tasks: "tripleo_{{ tripleo_container_cli }}_container_rm.yml"
vars:
container: "{{ item }}"
with_items: "{{ tripleo_containers_to_rm }}"
when: check_podman_cli.rc == 0
when:
- tripleo_container_cli == 'podman'
- include_tasks: "tripleo_{{ tripleo_container_cli }}_container_rm.yml"
vars:
container: "{{ item }}"
with_items: "{{ tripleo_containers_to_rm }}"