I do not know if this is a bug or I do not know how to use when: with the
loop:
The tasks
- name: debug backuppc_client_mysql_dump
ansible.builtin.debug:
msg: "{{ backuppc_client_mysql_dump }}"
when: backuppc_client_mysql_dump is defined
tags: backuppc
- name: set up backuppc user MySQL dump authorized_keys
ansible.posix.authorized_key:
user: "{{ backuppc_client_item.0.username }}"
state: "present"
key_options: "{{ backuppc_client_item.0.key_options }}"
key: "{{ backuppc_client_item.1 }}"
manage_dir: true
loop: "{{{backuppc_client_mysql_dump|subelements('authorized_keys') }}"
loop_control:
loop_var: backuppc_client_item
when: backuppc_client_mysql_dump is defined
tags: backuppc
Ansible run
TASK [backuppc-client : debug backuppc_client_mysql_dump]
**********************
skipping: [docker.*.com]
TASK [backuppc-client : set up backuppc user MySQL dump authorized_keys]
*******
fatal: [docker.*.com]: FAILED! => {"msg": "obj must be a list of dicts or a
nested dict"}
The debug task is skipped because backuppc_client_mysql_dump is not
defined. I expect the MySQL dump authorized_keys task to be skipped too but
it's not.
Any help?
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/2126286d-150d-4646-8684-753ee437d67dn%40googlegroups.com.