- name: select a share than can hold scripts set_fact: script_share: "{{ smb_shares | selectattr('has_scripts', 'defined') | selectattr('has_scripts', 'equalto', true) | list | first }}" - name: fail if share is missing fail: msg: "cannot generate scripts, script share is missing" when: (script_share | length) == 0 - name: create psr directory file: path: "{{ smb_storage_dir }}/{{ script_share.name }}/psr" state: directory mode: "2750" owner: "{{ smb_guest_user }}" group: "{{ smb_guest_group }}" - name: template items to script share template: src: "scripts/{{ item.src }}" dest: "{{ smb_storage_dir }}/{{ script_share.name }}/{{ item.dst }}" force: yes mode: 0750 owner: "{{ smb_guest_user }}" group: "{{ smb_guest_group }}" loop: - src: psr-ps1.j2 dst: psr/Setup-PSRemoting.ps1 - src: psr-cmd.j2 dst: psr/Setup-PSRemoting.cmd - src: psr-reset-ps1.j2 dst: psr/Reset-PSRemoting.ps1 - src: psr-reset-cmd.j2 dst: psr/Reset-PSRemoting.cmd