win_ansible_role_sshd/tasks/other_user_pubkeys.yml
2023-09-18 14:23:55 +02:00

30 lines
960 B
YAML

---
- name: Create .ansible folder
ansible.windows.win_powershell:
script: "[System.IO.Directory]::CreateDirectory('{{ item }}')"
changed_when: _fw.changed
become: true
become_method: ansible.builtin.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: ansible.builtin.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'