summaryrefslogtreecommitdiffstats
path: root/roles/go/tasks
diff options
context:
space:
mode:
authorAhmed Abdelhalim <[email protected]>2025-09-02 18:52:42 +0200
committerAhmed Abdelhalim <[email protected]>2025-09-02 18:52:42 +0200
commite1d3cc942662a132d8a86d3211857ab5e92d296e (patch)
treeee462edd2b3ff911275d5bcbd4a9b00285c889ac /roles/go/tasks
parent9c775d0d9ceb52b74d44decfb8757b7750969750 (diff)
Initial go role draft implementation
Diffstat (limited to 'roles/go/tasks')
-rw-r--r--roles/go/tasks/main.yml25
1 files changed, 25 insertions, 0 deletions
diff --git a/roles/go/tasks/main.yml b/roles/go/tasks/main.yml
new file mode 100644
index 00000000..27515584
--- /dev/null
+++ b/roles/go/tasks/main.yml
@@ -0,0 +1,25 @@
+---
+- name: "Add Go to shell profile"
+ ansible.builtin.blockinfile:
+ path: "{{ ansible_env.HOME }}/.bashrc"
+ state: "present"
+ prepend_newline: true
+ append_newline: true
+ marker: "# ==== {mark} ANSIBLE GO CONFIG"
+ block: |
+ if command -v go 1>/dev/null 2>&1; then
+ export PATH="$HOME/go/bin:$PATH"
+ fi
+
+- name: "Instal Go versions"
+ community.general.homebrew:
+ name:
+ - "go@{{ item }}"
+ with_items: "{{ go_versions }}"
+
+- name: "Set global go version"
+ ansible.builtin.command:
+ cmd: "brew link go@{{ go_global_version }}"
+ environment:
+ PATH: "/home/linuxbrew/.linuxbrew/bin:{{ ansible_env.PATH }}"
+ changed_when: false