infra-role-beacon-node-windows/tasks/user.yml

36 lines
1.1 KiB
YAML
Raw Normal View History

---
- name: Create service user
win_user:
name: '{{ beacon_node_service_user_name }}'
profile: '{{ beacon_node_service_home }}'
home_directory: '{{ beacon_node_service_home }}'
password: '{{ beacon_node_service_user_pass }}'
password_expired: false
password_never_expires: true
- name: Create user profile
win_user_profile:
username: '{{ beacon_node_service_user_name }}'
- name: Create folder for SSH authorized keys
win_file:
path: '{{ beacon_node_service_home }}\.ssh'
state: 'directory'
# Otherwise Set-Content fails because Get-Content read from the same file.
- name: Remove old SSH authorized keys for nimbus
win_file:
path: '{{ beacon_node_service_home }}\.ssh\authorized_keys'
state: 'absent'
- name: Copy SSH authorized keys from all users
win_shell: |
Get-Content C:\Users\*\.ssh\authorized_keys \
| Set-Content -Force {{ beacon_node_service_home }}\.ssh\authorized_keys
- name: Fix permissions on the SSH folder
win_owner:
path: '{{ beacon_node_service_home }}\.ssh'
user: '{{ beacon_node_service_user_name }}'
recurse: true