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: - block:
- name: "clone tmux dotfiles" - name: "clone tmux dotfiles"
ansible.builtin.git: ansible.builtin.git:
repo: "https://git.wojciechkozlowski.eu/config/tmux.git" repo: "https://git.wojciechkozlowski.eu/config/tmux.git"
dest: ".tmux" dest: "{{ system_base_user_become_user_home_directory }}/.tmux"
recursive: true recursive: true
# On first tmux launch install plugins with <Ctrl + a + I> # On first tmux launch install plugins with <Ctrl + a + I>
- name: "configure tmux" - name: "configure tmux"
ansible.builtin.copy: ansible.builtin.copy:
src: "./tmux.conf" src: "./tmux.conf"
dest: ".tmux.conf" dest: "{{ system_base_user_become_user_home_directory }}/.tmux.conf"
mode: 0644 mode: 0644
- name: "configure bashrc" - name: "configure bashrc"
ansible.builtin.copy: ansible.builtin.copy:
src: "./bashrc" src: "./bashrc"
dest: ".bashrc" dest: "{{ system_base_user_become_user_home_directory }}/.bashrc"
mode: 0644 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 }}"