summaryrefslogtreecommitdiffstats
path: root/roles/go/tasks
diff options
context:
space:
mode:
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