Skip to content

Commit

Permalink
add topgrade w/ it's configuration and update doc
Browse files Browse the repository at this point in the history
  • Loading branch information
Giancarmine committed Aug 30, 2024
1 parent 0887250 commit cd1846f
Show file tree
Hide file tree
Showing 5 changed files with 61 additions and 2 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ NETRC=/dev/null ansible-galaxy collection install community.general
| --------- | -------------------------------------------------------------------------------------------------------------------- | ------------- | ------------------ |
| base | APT: wget, copyq, curl, fwupd, git, zip, unrar, unzip, net-tools, python3-pip, software-properties-common SNAP: NONE | NONE | :white_check_mark: |
| ohmyzsh | zsh and ohmyzsh config | NONE | :white_check_mark: |
| topgrade | NONE | NONE | :white_check_mark: |
| vscode | NONE | NONE | :white_check_mark: |
| docker | NONE | NONE | :white_check_mark: |
| k8s_tools | kops, kubectl, kubelogin, istioctl, helm, kustomize | NONE | :white_check_mark: |
Expand Down
2 changes: 2 additions & 0 deletions group_vars/all.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,3 +39,5 @@ binaries:
zsh_completion: https://raw.githubusercontent.com/docker/compose/$(docker-compose --version | awk 'NR==1{print $NF}')/contrib/completion/zsh/_docker-compose

oh_my_zsh_version: 0.9.20

topgrade_version: "15.0.0"
50 changes: 50 additions & 0 deletions roles/topgrade/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
---
- name: Install Topgrade
become: true
get_url:
url: "https://github.com/topgrade-rs/topgrade/releases/download/v{{ topgrade_version }}/topgrade-v{{ topgrade_version }}-x86_64-unknown-linux-gnu.tar.gz"
dest: "/usr/local/bin/topgrade"
mode: "0755"

- name: Make Topgrade executable
become: true
command: chmod +x /usr/local/bin/topgrade

- name: Check if .profile file exist
become: true
stat:
path: "{{ home }}/.profile"
register: profile_stat

- name: Create .profile file if it doesn't exist
become: true
file:
path: "{{ home }}/.profile"
state: touch
when: not profile_stat.stat.exists

- name: Configure Topgrade
become: true
template:
src: topgrade.j2
dest: "{{ home }}/.profile"
mode: "0644"

- name: Reload shell
become: true
shell: |
echo "Reloading shell..."
if [[ -n "$SHELL" ]]; then
eval "$(echo $SHELL)"
fi
if [[ -n "$HOME" ]]; then
cd ~
fi
if [[ -f ~/.profile ]]; then
source ~/.profile
else
echo "Warning: .profile file not found."
fi
args:
executable: /bin/bash
creates: "{{ home }}/.profile"
5 changes: 5 additions & 0 deletions roles/topgrade/templates/topgrade.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
#!/bin/bash
set -euo pipefail
export PATH="/usr/local/bin:$PATH"
curl -fsSL https://github.com/topgrade-rs/topgrade/releases/download/v{{ topgrade_version }}/topgrade | sudo tee /usr/local/bin/topgrade
sudo chmod +x /usr/local/bin/topgrade
5 changes: 3 additions & 2 deletions ubuntu.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
---
- name: Configuring Local Environment - Asus Zenbook 13
- name: Configuring Local Environment - El_Giancar
hosts: all
connection: local
environment:
NETRC: "/dev/null"
roles:
- role: base
- role: ohmyzsh
- role: vscode
- role: topgrade
- role: docker
- role: k8s_tools
- role: vscode
handlers:
- name: Restart Galaxy
supervisorctl:
Expand Down

0 comments on commit cd1846f

Please sign in to comment.