From 71532a6d25fd6323f2fd93bbf52f732641ec583a Mon Sep 17 00:00:00 2001 From: Tuan-Dat Tran Date: Wed, 22 Jan 2025 00:06:35 +0100 Subject: [PATCH] refactor(lint,fqdn-names): Full FQDN names for modules Signed-off-by: Tuan-Dat Tran --- inventory | 2 +- roles/setup/tasks/apt.yml | 7 +-- roles/setup/tasks/docker.yml | 21 ++++---- roles/setup/tasks/fira_code_fonts.yml | 10 ++-- roles/setup/tasks/ghostty.yml | 10 ++-- roles/setup/tasks/git_delta_atuin.yml | 8 ++-- roles/setup/tasks/lazygit_ripgrep.yml | 16 +++---- roles/setup/tasks/main.yml | 48 +++++++++++++------ roles/setup/tasks/nvim_rust.yml | 4 +- roles/setup/tasks/pacstall_ledger.yml | 8 ++-- roles/setup/tasks/paisa.yml | 18 +++---- roles/setup/tasks/protonvpn.yml | 12 ++--- roles/setup/tasks/remove_ubuntu_banner.yml | 6 +-- roles/setup/tasks/snap.yml | 8 ++-- .../setup/tasks/starship_eurkey_veracrypt.yml | 14 +++--- 15 files changed, 107 insertions(+), 85 deletions(-) diff --git a/inventory b/inventory index ce96218..7225d93 100644 --- a/inventory +++ b/inventory @@ -1,2 +1,2 @@ [local] -test ansible_ssh_host=192.168.30.123 ansible_ssh_port=22 +test ansible_connection=local diff --git a/roles/setup/tasks/apt.yml b/roles/setup/tasks/apt.yml index 9d308e2..1aaf6b7 100644 --- a/roles/setup/tasks/apt.yml +++ b/roles/setup/tasks/apt.yml @@ -1,6 +1,6 @@ --- - name: Install apt packages - apt: + ansible.builtin.apt: name: - ansible - bat @@ -28,7 +28,8 @@ - xsel - zsh state: present - update_cache: yes + update_cache: true + become: true - name: Update tldr database - command: tldr --update + ansible.builtin.command: tldr --update diff --git a/roles/setup/tasks/docker.yml b/roles/setup/tasks/docker.yml index aafa2a2..ef98e0b 100644 --- a/roles/setup/tasks/docker.yml +++ b/roles/setup/tasks/docker.yml @@ -1,36 +1,37 @@ --- - name: Install prerequisites for Docker - apt: + ansible.builtin.apt: name: - ca-certificates - curl state: present - update_cache: yes + update_cache: true + become: true - name: Create /etc/apt/keyrings directory - file: + ansible.builtin.file: path: /etc/apt/keyrings state: directory mode: "0755" - name: Download Docker GPG key - get_url: + ansible.builtin.get_url: url: https://download.docker.com/linux/ubuntu/gpg dest: /etc/apt/keyrings/docker.asc mode: "0644" - name: Add Docker repository - apt_repository: + ansible.builtin.apt_repository: repo: "deb [arch={{ ansible_architecture }} signed-by=/etc/apt/keyrings/docker.asc] https://download.docker.com/linux/ubuntu {{ ansible_lsb.codename }} stable" filename: docker state: present - name: Update apt cache after adding Docker repo - apt: - update_cache: yes + ansible.builtin.apt: + update_cache: true - name: Install Docker packages - apt: + ansible.builtin.apt: name: - docker-ce - docker-ce-cli @@ -40,7 +41,7 @@ state: present - name: Add current user to docker group - user: + ansible.builtin.user: name: "{{ ansible_user_id }}" groups: docker - append: yes + append: true diff --git a/roles/setup/tasks/fira_code_fonts.yml b/roles/setup/tasks/fira_code_fonts.yml index e7b3f15..5d6f05f 100644 --- a/roles/setup/tasks/fira_code_fonts.yml +++ b/roles/setup/tasks/fira_code_fonts.yml @@ -1,27 +1,27 @@ --- - name: Create fonts directory - file: + ansible.builtin.file: path: "{{ ansible_env.HOME }}/.fonts" state: directory mode: "0755" - name: Download FiraCode Nerd Font zip - get_url: + ansible.builtin.get_url: url: https://github.com/ryanoasis/nerd-fonts/releases/download/v3.3.0/FiraMono.zip dest: "/tmp/FiraMono.zip" - name: Extract FiraCode from zip - unarchive: + ansible.builtin.unarchive: src: "/tmp/FiraMono.zip" dest: "{{ ansible_env.HOME }}/.fonts" remote_src: yes - name: Remove FiraMono.zip - file: + ansible.builtin.file: path: "/tmp/FiraMono.zip" state: absent - name: Refresh font cache - shell: fc-cache -fv + ansible.builtin.shell: fc-cache -fv args: warn: false diff --git a/roles/setup/tasks/ghostty.yml b/roles/setup/tasks/ghostty.yml index 05bdbc3..0d767fd 100644 --- a/roles/setup/tasks/ghostty.yml +++ b/roles/setup/tasks/ghostty.yml @@ -1,28 +1,28 @@ --- - name: Get OS release info - shell: source /etc/os-release && echo $VERSION_ID + ansible.builtin.shell: source /etc/os-release && echo $VERSION_ID register: version_id changed_when: false - name: Get Ghostty DEB URL - shell: | + ansible.builtin.shell: | curl -s https://api.github.com/repos/mkasberg/ghostty-ubuntu/releases/latest | grep -oP "https://github.com/mkasberg/ghostty-ubuntu/releases/download/[^\s/]+/ghostty_[^\s/_]+_amd64_{{ version_id.stdout }}.deb" register: ghostty_deb_url changed_when: false - name: Download Ghostty deb file - get_url: + ansible.builtin.get_url: url: "{{ ghostty_deb_url.stdout }}" dest: "/tmp/{{ ghostty_deb_url.stdout | basename }}" mode: "0755" - name: Install Ghostty - apt: + ansible.builtin.apt: deb: "/tmp/{{ ghostty_deb_url.stdout | basename }}" state: present - name: Remove Ghostty deb file - file: + ansible.builtin.file: path: "/tmp/{{ ghostty_deb_url.stdout | basename }}" state: absent diff --git a/roles/setup/tasks/git_delta_atuin.yml b/roles/setup/tasks/git_delta_atuin.yml index 4ce1ce1..3afe101 100644 --- a/roles/setup/tasks/git_delta_atuin.yml +++ b/roles/setup/tasks/git_delta_atuin.yml @@ -1,22 +1,22 @@ --- - name: Download git-delta deb - get_url: + ansible.builtin.get_url: url: https://github.com/dandavison/delta/releases/download/0.18.2/git-delta-musl_0.18.2_amd64.deb dest: "/tmp/git-delta-musl_0.18.2_amd64.deb" - name: Install git-delta - apt: + ansible.builtin.apt: deb: "/tmp/git-delta-musl_0.18.2_amd64.deb" state: present - name: Remove git-delta deb - file: + ansible.builtin.file: path: "/tmp/git-delta-musl_0.18.2_amd64.deb" state: absent - name: Install atuin become: false - shell: curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh + ansible.builtin.shell: curl --proto '=https' --tlsv1.2 -LsSf https://setup.atuin.sh | sh args: creates: "{{ ansible_env.HOME }}/.config/atuin" # Adjust based on atuin installation diff --git a/roles/setup/tasks/lazygit_ripgrep.yml b/roles/setup/tasks/lazygit_ripgrep.yml index 8ce3cb3..c54a9ce 100644 --- a/roles/setup/tasks/lazygit_ripgrep.yml +++ b/roles/setup/tasks/lazygit_ripgrep.yml @@ -1,31 +1,31 @@ --- - name: Get latest lazygit version - shell: | + ansible.builtin.shell: | curl -s "https://api.github.com/repos/jesseduffield/lazygit/releases/latest" | grep -Po '"tag_name": *"v\K[^"]*' register: lazygit_version changed_when: false - name: Download lazygit tar.gz - get_url: + ansible.builtin.get_url: url: "https://github.com/jesseduffield/lazygit/releases/download/v{{ lazygit_version.stdout }}/lazygit_{{ lazygit_version.stdout }}_Linux_x86_64.tar.gz" dest: "/tmp/lazygit.tar.gz" - name: Extract lazygit binary - unarchive: + ansible.builtin.unarchive: src: "/tmp/lazygit.tar.gz" dest: "/tmp" creates: "/tmp/lazygit" remote_src: yes - name: Install lazygit - copy: + ansible.builtin.copy: src: "/tmp/lazygit" dest: /usr/local/bin/lazygit mode: "0755" - name: Remove lazygit tar.gz and binary - file: + ansible.builtin.file: path: "{{ item }}" state: absent loop: @@ -33,16 +33,16 @@ - "/tmp/lazygit" - name: Download ripgrep deb - get_url: + ansible.builtin.get_url: url: https://github.com/BurntSushi/ripgrep/releases/download/14.1.0/ripgrep_14.1.0-1_amd64.deb dest: "/tmp/ripgrep_14.1.0-1_amd64.deb" - name: Install ripgrep - apt: + ansible.builtin.apt: deb: "/tmp/ripgrep_14.1.0-1_amd64.deb" state: present - name: Remove ripgrep deb - file: + ansible.builtin.file: path: "/tmp/ripgrep_14.1.0-1_amd64.deb" state: absent diff --git a/roles/setup/tasks/main.yml b/roles/setup/tasks/main.yml index b1c5d9a..875dfc2 100644 --- a/roles/setup/tasks/main.yml +++ b/roles/setup/tasks/main.yml @@ -1,15 +1,35 @@ --- -- import_tasks: apt.yml -- import_tasks: snap.yml -- import_tasks: nvim_rust.yml -- import_tasks: ghostty.yml -- import_tasks: pacstall_ledger.yml -- import_tasks: git_delta_atuin.yml -- import_tasks: starship_eurkey_veracrypt.yml -- import_tasks: fira_code_fonts.yml -- import_tasks: remove_ubuntu_banner.yml -- import_tasks: protonvpn.yml -- import_tasks: docker.yml -- import_tasks: paisa.yml -- import_tasks: lazygit_ripgrep.yml -- import_tasks: hashicorp_vagrant.yml +- name: Install apt packages + ansible.builtin.import_tasks: apt.yml +- name: Install snap packages + ansible.builtin.import_tasks: snap.yml +- name: Install nvim + ansible.builtin.import_tasks: nvim_rust.yml +- name: Install Rust +- name: Ghostty + ansible.builtin.import_tasks: ghostty.yml +- name: Install pacstall +- name: Install ledger + ansible.builtin.import_tasks: pacstall_ledger.yml +- name: Install git-delta +- name: Install atuin + ansible.builtin.import_tasks: git_delta_atuin.yml +- name: Install Starship +- name: Install EurKey +- name: Install Veracrypt + ansible.builtin.import_tasks: starship_eurkey_veracrypt.yml +- name: Install FiraCode + ansible.builtin.import_tasks: fira_code_fonts.yml +- name: Remove Ubuntu Pro Banner + ansible.builtin.import_tasks: remove_ubuntu_banner.yml +- name: Install ProtonVPN + ansible.builtin.import_tasks: protonvpn.yml +- name: Install Docker + ansible.builtin.import_tasks: docker.yml +- name: Install paisa.fyi + ansible.builtin.import_tasks: paisa.yml +- name: Install lazygit +- name: Install ripgrep + ansible.builtin.import_tasks: lazygit_ripgrep.yml +- name: Install Vagrant + ansible.builtin.import_tasks: hashicorp_vagrant.yml diff --git a/roles/setup/tasks/nvim_rust.yml b/roles/setup/tasks/nvim_rust.yml index 06f5a34..0ae3d9c 100644 --- a/roles/setup/tasks/nvim_rust.yml +++ b/roles/setup/tasks/nvim_rust.yml @@ -1,11 +1,11 @@ --- - name: Install neovim npm package globally - npm: + ansible.builtin.npm: name: neovim global: yes - name: Install Rust (via rustup) become: false - shell: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y + ansible.builtin.shell: curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y args: creates: "{{ ansible_env.HOME }}/.cargo/bin/rustc" diff --git a/roles/setup/tasks/pacstall_ledger.yml b/roles/setup/tasks/pacstall_ledger.yml index f0e4359..5ecabf9 100644 --- a/roles/setup/tasks/pacstall_ledger.yml +++ b/roles/setup/tasks/pacstall_ledger.yml @@ -1,19 +1,19 @@ --- - name: Install Pacstall - shell: bash -c "$(curl -fsSL https://pacstall.dev/q/install)" + ansible.builtin.shell: bash -c "$(curl -fsSL https://pacstall.dev/q/install)" args: creates: /usr/local/bin/pacstall # Adjust based on pacstall install path - name: Add Ledger PPA - apt_repository: + ansible.builtin.apt_repository: repo: ppa:mbudde/ledger state: present - name: Update apt cache after adding Ledger PPA - apt: + ansible.builtin.apt: update_cache: yes - name: Install ledger - apt: + ansible.builtin.apt: name: ledger state: present diff --git a/roles/setup/tasks/paisa.yml b/roles/setup/tasks/paisa.yml index 4eff467..c84d7cd 100644 --- a/roles/setup/tasks/paisa.yml +++ b/roles/setup/tasks/paisa.yml @@ -1,48 +1,48 @@ --- - name: Backup current sources.list - copy: + ansible.builtin.copy: src: /etc/apt/sources.list dest: /etc/apt/sources.list.bak remote_src: yes - name: Add universe repository temporarily - lineinfile: + ansible.builtin.lineinfile: path: /etc/apt/sources.list line: "deb http://archive.ubuntu.com/ubuntu jammy main universe" insertafter: EOF - name: Update apt cache - apt: + ansible.builtin.apt: update_cache: yes - name: Upgrade all packages - apt: + ansible.builtin.apt: upgrade: dist - name: Install dependencies for Paisa - apt: + ansible.builtin.apt: name: - libwebkit2gtk-4.0-dev - webkit2gtk state: present - name: Restore original sources.list - copy: + ansible.builtin.copy: src: /etc/apt/sources.list.bak dest: /etc/apt/sources.list remote_src: yes - name: Download Paisa app deb - get_url: + ansible.builtin.get_url: url: https://github.com/ananthakumaran/paisa/releases/download/v0.7.1/paisa-app-linux-amd64.deb dest: "/tmp/paisa-app-linux-amd64.deb" - name: Install Paisa - apt: + ansible.builtin.apt: deb: "/tmp/paisa-app-linux-amd64.deb" state: present - name: Remove Paisa deb - file: + ansible.builtin.file: path: "/tmp/paisa-app-linux-amd64.deb" state: absent diff --git a/roles/setup/tasks/protonvpn.yml b/roles/setup/tasks/protonvpn.yml index 01125fa..f89d411 100644 --- a/roles/setup/tasks/protonvpn.yml +++ b/roles/setup/tasks/protonvpn.yml @@ -1,25 +1,25 @@ --- - name: Download ProtonVPN release deb - get_url: + ansible.builtin.get_url: url: https://repo.protonvpn.com/debian/dists/stable/main/binary-all/protonvpn-stable-release_1.0.6_all.deb dest: "/tmp/protonvpn-stable-release_1.0.6_all.deb" - name: Verify ProtonVPN deb checksum - shell: echo "e5e03976d0980bafdf07da2f71b14fbc883c091e72b16772199742c98473002f /tmp/protonvpn-stable-release_1.0.6_all.deb" | sha256sum --check - + ansible.builtin.shell: echo "e5e03976d0980bafdf07da2f71b14fbc883c091e72b16772199742c98473002f /tmp/protonvpn-stable-release_1.0.6_all.deb" | sha256sum --check - register: checksum_result failed_when: "'FAILED' in checksum_result.stdout" - name: Install ProtonVPN release package - apt: + ansible.builtin.apt: deb: "/tmp/protonvpn-stable-release_1.0.6_all.deb" state: present - name: Update apt cache after ProtonVPN repo added - apt: + ansible.builtin.apt: update_cache: yes - name: Install ProtonVPN GNOME desktop - apt: + ansible.builtin.apt: name: - proton-vpn-gnome-desktop - libayatana-appindicator3-1 @@ -28,6 +28,6 @@ state: present - name: Remove ProtonVPN release deb - file: + ansible.builtin.file: path: "/tmp/protonvpn-stable-release_1.0.6_all.deb" state: absent diff --git a/roles/setup/tasks/remove_ubuntu_banner.yml b/roles/setup/tasks/remove_ubuntu_banner.yml index 2dd08cc..1f594ea 100644 --- a/roles/setup/tasks/remove_ubuntu_banner.yml +++ b/roles/setup/tasks/remove_ubuntu_banner.yml @@ -1,14 +1,14 @@ --- - name: Backup Ubuntu Pro banner configuration - command: mv /etc/apt/apt.conf.d/20apt-esm-hook.conf /etc/apt/apt.conf.d/20apt-esm-hook.conf.bak + ansible.builtin.command: mv /etc/apt/apt.conf.d/20apt-esm-hook.conf /etc/apt/apt.conf.d/20apt-esm-hook.conf.bak args: removes: /etc/apt/apt.conf.d/20apt-esm-hook.conf - name: Create empty Ubuntu Pro banner configuration - file: + ansible.builtin.file: path: /etc/apt/apt.conf.d/20apt-esm-hook.conf state: touch - name: Update apt cache - apt: + ansible.builtin.apt: update_cache: yes diff --git a/roles/setup/tasks/snap.yml b/roles/setup/tasks/snap.yml index 759df06..b9d6446 100644 --- a/roles/setup/tasks/snap.yml +++ b/roles/setup/tasks/snap.yml @@ -1,22 +1,22 @@ --- - name: Install snap packages - bottom - snap: + ansible.builtin.snap: name: bottom state: present - name: Install snap packages - signal-desktop - snap: + ansible.builtin.snap: name: signal-desktop state: present - name: Install snap packages - nvim - snap: + ansible.builtin.snap: name: nvim classic: true state: present - name: Install snap packages - zellij - snap: + ansible.builtin.snap: name: zellij classic: true state: present diff --git a/roles/setup/tasks/starship_eurkey_veracrypt.yml b/roles/setup/tasks/starship_eurkey_veracrypt.yml index 8c1959c..2e53e13 100644 --- a/roles/setup/tasks/starship_eurkey_veracrypt.yml +++ b/roles/setup/tasks/starship_eurkey_veracrypt.yml @@ -1,36 +1,36 @@ --- - name: Install starship become: false - shell: curl -sS https://starship.rs/install.sh | sh -s -- -y + ansible.builtin.shell: curl -sS https://starship.rs/install.sh | sh -s -- -y args: creates: "{{ ansible_env.HOME }}/.config/starship.toml" # Adjust based on where starship installs - name: Download EurKey deb - get_url: + ansible.builtin.get_url: url: https://eurkey.steffen.bruentjen.eu/download/debian/eurkey.deb dest: "/tmp/eurkey.deb" - name: Install EurKey - apt: + ansible.builtin.apt: deb: "/tmp/eurkey.deb" state: present - name: Remove EurKey deb - file: + ansible.builtin.file: path: "/tmp/eurkey.deb" state: absent - name: Download Veracrypt deb - get_url: + ansible.builtin.get_url: url: https://launchpad.net/veracrypt/trunk/1.26.14/+download/veracrypt-1.26.14-Debian-12-amd64.deb dest: "/tmp/veracrypt.deb" - name: Install Veracrypt - apt: + ansible.builtin.apt: deb: "/tmp/veracrypt.deb" state: present - name: Remove Veracrypt deb - file: + ansible.builtin.file: path: "/tmp/veracrypt.deb" state: absent