--- # cli_productivity/tasks/main.yml - name: Enable EPEL repository become: true ansible.builtin.dnf: name: epel-release state: latest update_cache: true when: cli_use_epel | bool - name: Refresh DNF metadata after enabling EPEL become: true ansible.builtin.command: dnf makecache changed_when: false when: cli_use_epel | bool - name: Install base CLI productivity packages become: true ansible.builtin.dnf: name: "{{ cli_base_packages }}" state: present - name: Install common CLI productivity packages become: true ansible.builtin.dnf: name: "{{ cli_extra_packages }}" state: present update_cache: true - name: Install optional CLI productivity packages when available become: true ansible.builtin.dnf: name: "{{ item }}" state: present loop: "{{ cli_optional_packages }}" register: cli_optional_package_install failed_when: false - name: Report optional CLI packages that could not be installed ansible.builtin.debug: msg: "Optional package was not installed: {{ item.item }} - {{ item.failures | default(item.msg | default('unknown reason')) }}" loop: "{{ cli_optional_package_install.results | default([]) }}" when: - item.rc is defined - item.rc != 0 - name: Check whether Starship is installed ansible.builtin.stat: path: "{{ cli_starship_bin_path }}" register: cli_starship_binary when: cli_enable_starship | bool - name: Install Starship prompt become: true ansible.builtin.shell: | set -o pipefail curl -fsSL https://starship.rs/install.sh | sh -s -- --yes --bin-dir "$(dirname {{ cli_starship_bin_path }})" args: executable: /bin/bash when: - cli_enable_starship | bool - not cli_starship_binary.stat.exists changed_when: true - name: Ensure fish config directory exists become: true ansible.builtin.file: path: "{{ cli_fish_config_dir }}" state: directory owner: "{{ cli_user }}" group: "{{ cli_group }}" mode: "0755" when: cli_enable_fish_config | bool - name: Ensure Starship config directory exists become: true ansible.builtin.file: path: "{{ cli_starship_config_dir }}" state: directory owner: "{{ cli_user }}" group: "{{ cli_group }}" mode: "0755" when: cli_enable_starship | bool - name: Deploy Starship config become: true ansible.builtin.template: src: starship.toml.j2 dest: "{{ cli_starship_config_dir }}/starship.toml" owner: "{{ cli_user }}" group: "{{ cli_group }}" mode: "0644" when: cli_enable_starship | bool - name: Deploy fish config become: true ansible.builtin.template: src: config.fish.j2 dest: "{{ cli_fish_config_dir }}/config.fish" owner: "{{ cli_user }}" group: "{{ cli_group }}" mode: "0644" when: cli_enable_fish_config | bool - name: Deploy tmux config become: true ansible.builtin.template: src: tmux.conf.j2 dest: "{{ cli_config_home }}/.tmux.conf" owner: "{{ cli_user }}" group: "{{ cli_group }}" mode: "0644" when: cli_enable_tmux_config | bool - name: Ensure SSH config directory exists become: true ansible.builtin.file: path: "{{ cli_ssh_config_dir }}" state: directory owner: "{{ cli_user }}" group: "{{ cli_group }}" mode: "0700" when: cli_enable_ssh_config | bool #- name: Deploy SSH client config # become: true # ansible.builtin.template: # src: ssh_config.j2 # dest: "{{ cli_ssh_config_dir }}/config" # owner: "{{ cli_user }}" # group: "{{ cli_group }}" # mode: "0600" # when: cli_enable_ssh_config | bool - name: Deploy Git config become: true ansible.builtin.template: src: gitconfig.j2 dest: "{{ cli_config_home }}/.gitconfig" owner: "{{ cli_user }}" group: "{{ cli_group }}" mode: "0644" when: cli_enable_git_config | bool - name: Get fish shell path ansible.builtin.command: command -v fish register: cli_fish_path changed_when: false when: cli_set_fish_as_default_shell | bool - name: Ensure fish is listed in /etc/shells become: true ansible.builtin.lineinfile: path: /etc/shells line: "{{ cli_fish_path.stdout }}" state: present when: cli_set_fish_as_default_shell | bool - name: Set fish as default shell become: true ansible.builtin.user: name: "{{ cli_user }}" shell: "{{ cli_fish_path.stdout }}" when: cli_set_fish_as_default_shell | bool