Impostazione di zsh solo per additional_user.

This commit is contained in:
Emiliano Vavassori 2024-12-23 23:50:00 +01:00
parent d312ffb24b
commit e09d5060e0

View File

@ -4,57 +4,29 @@
- name: Fixing base settings - name: Fixing base settings
ansible.builtin.include_tasks: "{{ ansible_os_family | lower }}.yml" ansible.builtin.include_tasks: "{{ ansible_os_family | lower }}.yml"
- name: Applying modifications to {{ additional_user }} - name: Set zsh as default shell for user
when: ansible_user_id == 'root' ansible.builtin.user:
become: true name: "{{ additional_user }}"
block: shell: /usr/bin/zsh
become_user: root
- name: Set zsh as default shell for user - name: Creating personal folder for customization
ansible.builtin.user: ansible.builtin.file:
name: "{{ additional_user }}" path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.zsh/conf.d"
shell: /usr/bin/zsh state: directory
become_user: root mode: '0755'
become_user: "{{ additional_user }}"
- name: Creating personal folder for customization - name: Removing previous file if present
ansible.builtin.file: ansible.builtin.file:
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.zsh/conf.d" path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.zshrc"
state: directory state: absent
mode: '0755' become_user: "{{ additional_user }}"
become_user: "{{ additional_user }}"
- name: Removing previous file if present - name: Linking main file
ansible.builtin.file: ansible.builtin.file:
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.zshrc" src: "{{ dotfdir }}/zshrc"
state: absent dest: "{{ lookup('ansible.builtin.env', 'HOME') }}/.zshrc"
become_user: "{{ additional_user }}" state: link
force: true
- name: Linking main file become_user: "{{ additional_user }}"
ansible.builtin.file:
src: "{{ dotfdir }}/zshrc"
dest: "{{ lookup('ansible.builtin.env', 'HOME') }}/.zshrc"
state: link
force: true
become_user: "{{ additional_user }}"
- name: Applying results to {{ ansible_user_id }}
when: ansible_user_id != 'root'
block:
- name: Set zsh as default shell for user
ansible.builtin.user:
name: "{{ ansible_user_id }}"
shell: /usr/bin/zsh
become_user: root
become: true
- name: Creating personal folder for customization
ansible.builtin.file:
path: "{{ lookup('ansible.builtin.env', 'HOME') }}/.zsh/conf.d"
state: directory
mode: '0755'
- name: Linking main file
ansible.builtin.file:
src: "{{ dotfdir }}/zshrc"
dest: "{{ lookup('ansible.builtin.env', 'HOME') }}/.zshrc"
state: link