ansible-edda/playbooks/roles/music/user/tasks/main.yml

35 lines
913 B
YAML
Raw Normal View History

2023-02-27 21:10:28 +01:00
---
- name: "create user"
ansible.builtin.user:
name: "{{ music_user_name }}"
create_home: true
home: "{{ music_user_home_directory }}"
password: "{{ music_user_password }}"
register: music_user_create
- name: "set default shell"
ansible.builtin.user:
name: "{{ music_user_name }}"
shell: "/usr/bin/bash"
- name: "set home directory ownership"
ansible.builtin.file:
path: "{{ music_user_home_directory }}"
state: "directory"
owner: "{{ music_user_name }}"
group: "{{ music_user_name }}"
recurse: true
when:
music_user_create.changed
- ansible.builtin.import_role:
name: "system/base/user"
vars:
system_base_user_become_user: "{{ music_user_name }}"
- name: "set authorized key"
ansible.posix.authorized_key:
user: "{{ music_user_name }}"
state: "present"
key: "{{ lookup('ansible.builtin.file', music_user_public_key_file) }}"