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