Files
ansible/roles/reverse_proxy/tasks/00_go_install.yaml
Tuan-Dat Tran ef652fac20 refactor: yml -> yaml
Signed-off-by: Tuan-Dat Tran <tuan-dat.tran@tudattr.dev>
2025-11-07 20:44:14 +01:00

46 lines
1.1 KiB
YAML

---
- name: Install prerequisites for Caddy
ansible.builtin.apt:
name:
- debian-keyring
- debian-archive-keyring
- apt-transport-https
- curl
- qemu-guest-agent
state: present
update_cache: true
become: true
- name: Remove existing Go installation
ansible.builtin.file:
path: /usr/local/go
state: absent
become: true
- name: Download Go tarball
ansible.builtin.get_url:
url: "https://go.dev/dl/go{{ go_version }}.linux-amd64.tar.gz"
dest: "/tmp/go{{ go_version }}.linux-amd64.tar.gz"
mode: "0755"
- name: Extract Go tarball to /usr/local
ansible.builtin.unarchive:
src: /tmp/go1.23.4.linux-amd64.tar.gz
dest: /usr/local
remote_src: true
become: true
register: go_install
- name: Ensure Go binary path is added to /etc/profile
ansible.builtin.lineinfile:
path: /etc/profile
line: "PATH=$PATH:/usr/local/go/bin"
state: present
regexp: "^PATH=.*:/usr/local/go/bin$"
become: true
- name: Source /etc/profile to update PATH for the current session
ansible.builtin.shell: "source /etc/profile"
args:
executable: /bin/bash