# Pastebin uvJ97zVH [centos@aschultz-undercloud foo]$ cat test.yaml - hosts: localhost connection: local name: Run update serial: 1 gather_facts: no any_errors_fatal: yes tasks: - set_fact: container_registry_insecure_registries: - 192.168.24.1:8787 container_registry_login: true container_registry_logins: docker.io: username: pa55word '192.0.2.1:8787': registry_username: password - name: ensure podman and deps are installed package: name: podman state: latest - copy: content: '' dest: /etc/cni/net.d/87-podman-bridge.conflist force: true ignore_errors: true name: Remove default cni config for cni0 if exists - command: ip link delete cni0 ignore_errors: true name: Delete cni0 interface if exists - ini_file: option: registries path: /etc/containers/registries.conf section: registries.insecure value: '{{ container_registry_insecure_registries }}' name: configure insecure registries /etc/containers/registries.conf when: container_registry_insecure_registries | length > 0 - environment: REGISTRY: '{{ item.key }}' REGISTRY_PASSWORD: '{{ lookup(''dict'', item.value).value }}' REGISTRY_USERNAME: '{{ lookup(''dict'', item.value).key }}' loop: '{{ lookup(''dict'', container_registry_logins) }}' name: Perform container registry login(s) shell: echo podman login --username=$REGISTRY_USERNAME --password=$REGISTRY_PASSWORD $REGISTRY when: - container_registry_login | bool - container_registry_logins | length > 0 [centos@aschultz-undercloud foo]$ ansible-playbook test.yaml [WARNING]: provided hosts list is empty, only localhost is available. Note that the implicit localhost does not match 'all' PLAY [Run update] ********************************************************************************************************************************************* TASK [set_fact] *********************************************************************************************************************************************** ok: [localhost] TASK [ensure podman and deps are installed] ******************************************************************************************************************* ok: [localhost] TASK [Remove default cni config for cni0 if exists] *********************************************************************************************************** ok: [localhost] TASK [Delete cni0 interface if exists] ************************************************************************************************************************ fatal: [localhost]: FAILED! => {"changed": true, "cmd": ["ip", "link", "delete", "cni0"], "delta": "0:00:00.004999", "end": "2019-07-10 18:10:30.748110", "msg": "non-zero return code", "rc": 1, "start": "2019-07-10 18:10:30.743111", "stderr": "Cannot find device \"cni0\"", "stderr_lines": ["Cannot find device \"cni0\""], "stdout": "", "stdout_lines": []} ...ignoring TASK [configure insecure registries /etc/containers/registries.conf] ****************************************************************************************** ok: [localhost] TASK [Perform container registry login(s)] ******************************************************************************************************************** changed: [localhost] => (item={'key': u'192.0.2.1:8787', 'value': {u'registry_username': u'password'}}) changed: [localhost] => (item={'key': u'docker.io', 'value': {u'username': u'pa55word'}}) PLAY RECAP **************************************************************************************************************************************************** localhost : ok=6 changed=2 unreachable=0 failed=0