Improve condition checking about docker registry config

Avoids use of ignore_errors on a task that is only reading the status.

We only use the result code (rc) of the check so the task iself
should not fail regardless if the registry was managed or not.

Improves output of ansible console and confusing false errors.

Change-Id: I0be5f333a7ac6705279820a1a34667b4ec32f760
This commit is contained in:
Sorin Sbarnea 2019-02-16 10:42:20 +00:00
parent be79743b13
commit 0cc18945c6
1 changed files with 5 additions and 5 deletions

View File

@ -8,10 +8,13 @@
command: grep -Fq "# Configured by Ansible container registry role" /etc/sysconfig/docker
register: is_configured
check_mode: false
ignore_errors: true
failed_when: false
changed_when: false
- block:
- name: configure docker registry block
when: not container_registry_skip_reconfiguration or is_configured.rc != 0
become: true
block:
# NOTE(aschultz): LP#1750194 - need to set ip_forward before docker starts
# so lets set it before we install the package if we're managing it.
- name: enable net.ipv4.ip_forward
@ -150,6 +153,3 @@
line: "# Configured by Ansible container registry role"
insertafter: "^# /etc/sysconfig/docker$"
create: yes
become: true
when: not container_registry_skip_reconfiguration or is_configured.rc != 0