2020-01-26 16:09:52 +00:00
|
|
|
---
|
|
|
|
# Common/Usersetup: Auto-setup a user shell and prepare dotfiles - CentOS Version
|
|
|
|
# Will run once per user, because of lockfile `~/.ansbl-common-usersetup`
|
|
|
|
|
2023-04-28 21:25:25 +00:00
|
|
|
- name: Usersetup - Check, if usersetup already ran
|
2021-08-28 14:58:03 +00:00
|
|
|
ansible.builtin.stat:
|
2022-06-16 09:07:42 +00:00
|
|
|
path: "{{ ansible_user_dir }}/.ansbl-common-usersetup"
|
2020-01-26 16:09:52 +00:00
|
|
|
register: common_usersetup
|
|
|
|
|
2023-04-28 21:25:25 +00:00
|
|
|
- name: Usersetup - Change login shell to zsh for current user
|
2022-02-13 19:52:22 +00:00
|
|
|
when:
|
|
|
|
- common_usersetup.stat.exists == false and usersetup_chsh == true
|
2023-04-28 21:25:25 +00:00
|
|
|
become: true
|
2021-08-28 14:58:03 +00:00
|
|
|
ansible.builtin.user:
|
2020-01-26 16:09:52 +00:00
|
|
|
name: "{{ ansible_user_id }}"
|
|
|
|
shell: /bin/zsh
|
|
|
|
|
|
|
|
# TODO: adapt to CentOS/ RHEL systems, if needed
|
2023-04-28 21:25:25 +00:00
|
|
|
# - name: Usersetup - Install locales package
|
|
|
|
# become: true
|
2021-08-28 14:58:03 +00:00
|
|
|
# ansible.builtin.apt:
|
2020-01-26 16:09:52 +00:00
|
|
|
# name: locales
|
|
|
|
# state: present
|
2023-04-28 21:25:25 +00:00
|
|
|
# diff: false
|
2020-01-26 16:09:52 +00:00
|
|
|
|
2023-04-28 21:25:25 +00:00
|
|
|
# - name: Usersetup - Setup locale en_US
|
2022-02-13 19:52:22 +00:00
|
|
|
# when:
|
|
|
|
# - common_usersetup.stat.exists == false
|
2023-04-28 21:25:25 +00:00
|
|
|
# become: true
|
2021-08-28 14:58:03 +00:00
|
|
|
# ansible.builtin.locale_gen:
|
2020-01-26 16:09:52 +00:00
|
|
|
# name: en_US.UTF-8
|
|
|
|
# state: present
|
2023-04-28 21:25:25 +00:00
|
|
|
# - name: Usersetup - Setup locale de_DE
|
2020-01-26 16:09:52 +00:00
|
|
|
# when:
|
|
|
|
# - common_usersetup.stat.exists == false
|
2023-04-28 21:25:25 +00:00
|
|
|
# become: true
|
2021-08-28 14:58:03 +00:00
|
|
|
# ansible.builtin.locale_gen:
|
2020-01-26 16:09:52 +00:00
|
|
|
# name: de_DE.UTF-8
|
|
|
|
# state: present
|
|
|
|
|
2023-04-28 21:25:25 +00:00
|
|
|
- name: Usersetup - Create lockfile
|
2022-02-13 19:52:22 +00:00
|
|
|
when:
|
|
|
|
- common_usersetup.stat.exists == false
|
2021-08-28 14:58:03 +00:00
|
|
|
ansible.builtin.file:
|
2022-06-16 09:07:42 +00:00
|
|
|
path: "{{ ansible_user_dir }}/.ansbl-common-usersetup"
|
2020-01-26 16:09:52 +00:00
|
|
|
state: touch
|