--- - name: make sure config directory exists file: path: /etc/whawty/auth/ state: directory - name: create store base directory loop: "{{ whawty_auth_store_instances | dict2items }}" loop_control: label: "{{ item.key }}" file: path: "{{ item.value.config.basedir }}" state: directory mode: "{{ item.value.permissions['dir-mode'] | default(omit) }}" owner: "{{ item.value.permissions.owner | default(omit) }}" group: "{{ item.value.permissions.group | default(omit) }}" - name: generate store config file loop: "{{ whawty_auth_store_instances | dict2items }}" loop_control: label: "{{ item.key }}" copy: content: "{{ item.value.config | to_nice_yaml(indent=2) }}" dest: "/etc/whawty/auth/store-{{ item.key }}.yml" mode: "{{ item.value.permissions['file-mode'] | default(omit) }}" owner: "{{ item.value.permissions.owner | default(omit) }}" group: "{{ item.value.permissions.group | default(omit) }}" - name: install rsync when: "(whawty_auth_store_instances | dict2items | selectattr('value.sync', 'defined') | length) > 0" apt: name: rsync state: present - name: configure sync loop: "{{ whawty_auth_store_instances | dict2items }}" loop_control: label: "{{ item.key }}" when: "'sync' in item.value" include_tasks: "sync-{{ item.value.sync.type }}.yml"