Add tmux to music user

This commit is contained in:
Wojciech Kozlowski 2023-02-27 21:10:28 +01:00
parent 7ff22fe753
commit 5ca7161517
8 changed files with 62 additions and 56 deletions

View File

@ -4,15 +4,17 @@
roles:
- role: "music/datasets"
tags: "music:datasets"
- role: "music/user"
tags: "music:user"
vars:
music_user_public_key_file: "\
{% if (the_nine_worlds_production | bool) %}\
~/.ssh/yggdrasil.pub\
{% else %}\
~/.ssh/debian-virt.pub\
{% endif %}"
- role: "music/rip"
tags: "music:rip"
vars:
music_rip_public_key_file: "\
{% if (the_nine_worlds_production | bool) %}\
~/.ssh/yggdrasil.pub\
{% else %}\
~/.ssh/debian-virt.pub\
{% endif %}"
- role: "backups/snapshots/user"
vars:
backups_snapshots_user_name: "{{ music_user_name }}"

View File

@ -5,9 +5,6 @@ argument_specs:
music_user_name:
type: "str"
required: true
music_user_password:
type: "str"
required: true
music_user_samba_password:
type: "str"
required: true
@ -17,6 +14,3 @@ argument_specs:
music_user_data_directory:
type: "str"
required: true
music_rip_public_key_file:
type: "str"
required: true

View File

@ -1,37 +0,0 @@
---
- name: "user : create user"
ansible.builtin.user:
name: "{{ music_user_name }}"
create_home: true
home: "{{ music_user_home_directory }}"
password: "{{ music_user_password }}"
register: music_rip_user_create
- name: "rip : set default shell"
ansible.builtin.user:
name: "{{ music_user_name }}"
shell: "/usr/bin/bash"
- block:
- name: "user : set home directory ownership"
ansible.builtin.file:
path: "{{ music_user_home_directory }}"
state: "directory"
owner: "{{ music_user_name }}"
group: "{{ music_user_name }}"
recurse: true
- name: "user : ensure XDG_RUNTIME_DIR is set"
ansible.builtin.shell: |
echo '\nexport XDG_RUNTIME_DIR=/run/user/$(id -u)' >> \
{{ music_user_home_directory }}/.bashrc
when:
music_rip_user_create.changed
- name: "user : set authorized key"
ansible.posix.authorized_key:
user: "{{ music_user_name }}"
state: "present"
key: "{{ lookup('ansible.builtin.file', music_rip_public_key_file) }}"

View File

@ -1,9 +1,4 @@
---
- name: "play:music : role:rip : tasks:user"
ansible.builtin.import_tasks: "include/user.yml"
tags:
- "music:rip:user"
- name: "play:music : role:rip : tasks:directories"
ansible.builtin.import_tasks: "include/directories.yml"
tags:

View File

@ -0,0 +1,16 @@
---
argument_specs:
main:
options:
music_user_name:
type: "str"
required: true
music_user_password:
type: "str"
required: true
music_user_home_directory:
type: "str"
required: true
music_user_public_key_file:
type: "str"
required: true

View File

@ -0,0 +1,34 @@
---
- 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) }}"

View File

@ -98,6 +98,8 @@
tags:
- "system:base"
- "system:base:user"
vars:
system_base_user_become_user: "{{ system_base_ssh_user }}"
- name: "system : asgard:&zfs"
hosts: "asgard:&zfs"

2
roles

@ -1 +1 @@
Subproject commit 483780a828ed5d2b8a197bbf1c8270a9c994f00d
Subproject commit e91babde35eb600750e0dad30e28c4f0b4455e8e