win_ansible_role_sshd/tasks/other_user_pubkeys.yml
2022-12-29 18:01:10 +01:00

30 lines
928 B
YAML

---
- name: Create .ansible folder
ansible.windows.win_powershell:
script: "[System.IO.Directory]::CreateDirectory('{{ item }}')"
changed_when: _fw.changed
become: true
become_method: runas
become_user: "{{ win_sshd_otheruser }}"
vars:
ansible_become_pass: '{{ win_sshd_otherusepassword }}'
with_items:
- 'C:\Users\{{ win_sshd_otheruser }}\.ansible'
- name: Create .ansible folder
ansible.windows.win_powershell:
script: "attrib +h {{ item }}"
changed_when: _fw.changed
become: true
become_method: runas
become_user: "{{ win_sshd_otheruser }}"
vars:
ansible_become_pass: '{{ win_sshd_otherusepassword }}'
with_items:
- 'C:\Users\{{ win_sshd_otheruser }}\.ansible'
- name: Prepare Pubkey PS1 Script
ansible.windows.win_template:
src: 'templates/ssh_userkeys.ps1'
dest: 'C:\Users\{{ win_sshd_otheruser }}\.ansible\ssh_userkeys.ps1'
notify: 'Install SSH User Keys'