Make the user role more flexible for users

This commit is contained in:
Wojciech Kozlowski 2023-02-27 21:09:02 +01:00
parent 483780a828
commit e91babde35
2 changed files with 19 additions and 4 deletions

View File

@ -0,0 +1,7 @@
---
argument_specs:
main:
options:
system_base_user_become_user:
type: "str"
required: true

View File

@ -1,23 +1,31 @@
---
- name: "get user home directory"
ansible.builtin.getent:
database: "passwd"
key: "{{ system_base_user_become_user }}"
- block:
- name: "clone tmux dotfiles"
ansible.builtin.git:
repo: "https://git.wojciechkozlowski.eu/config/tmux.git"
dest: ".tmux"
dest: "{{ system_base_user_become_user_home_directory }}/.tmux"
recursive: true
# On first tmux launch install plugins with <Ctrl + a + I>
- name: "configure tmux"
ansible.builtin.copy:
src: "./tmux.conf"
dest: ".tmux.conf"
dest: "{{ system_base_user_become_user_home_directory }}/.tmux.conf"
mode: 0644
- name: "configure bashrc"
ansible.builtin.copy:
src: "./bashrc"
dest: ".bashrc"
dest: "{{ system_base_user_become_user_home_directory }}/.bashrc"
mode: 0644
become: false
become_user: "{{ system_base_user_become_user }}"
vars:
system_base_user_become_user_home_directory: "\
{{ getent_passwd[system_base_user_become_user].4 }}"