๐Ÿ“— Ansible playbooks and roles for building an idempotent, interconnected and scalable infrastructure
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
ansible-playbooks/roles/smb/tasks/script_generate.yml

37 lines
1.0 KiB

- 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