summaryrefslogtreecommitdiff
path: root/roles/dotfiles/tasks
diff options
context:
space:
mode:
authorDmitry Ilvokhin <d@ilvokhin.com>2025-03-30 22:53:33 +0200
committerDmitry Ilvokhin <d@ilvokhin.com>2025-03-30 22:53:33 +0200
commitb09418c57891a475b3ebdf8b8d41a66e0545a1cc (patch)
tree341c5bfffd5ba2f48ead4c594fff9ed1fbb6d3f4 /roles/dotfiles/tasks
parentdf1774241c827b06d1cbc877994b2c738930ef97 (diff)
downloadinfra-master.tar.gz
infra-master.tar.bz2
infra-master.zip
Configure Go environmentHEADmaster
Diffstat (limited to 'roles/dotfiles/tasks')
-rw-r--r--roles/dotfiles/tasks/main.yml31
1 files changed, 31 insertions, 0 deletions
diff --git a/roles/dotfiles/tasks/main.yml b/roles/dotfiles/tasks/main.yml
index 17228a5..4def4d4 100644
--- a/roles/dotfiles/tasks/main.yml
+++ b/roles/dotfiles/tasks/main.yml
@@ -138,6 +138,37 @@
dest: '{{ homedir }}/.muttrc'
when: has_mutt.rc == 0
+- name: Configure go if installed
+ tags: go
+ block:
+ - name: Check if go is installed
+ ansible.builtin.command: go version
+ changed_when: false
+ failed_when: false
+ register: has_go
+
+ - name: Set go config directory for macOS
+ set_fact:
+ go_conf_dir: '{{ homedir }}/Library/Application Support/go'
+ when: has_go.rc == 0 and ansible_os_family == "Darwin"
+
+ - name: Set go config directory for Linux
+ set_fact:
+ go_conf_dir: '{{ homedir }}/.config/go'
+ when: has_go.rc == 0 and ansible_os_family != "Darwin"
+
+ - name: Create go config directory
+ ansible.builtin.file:
+ path: '{{ go_conf_dir }}'
+ state: directory
+ owner: '{{ user }}'
+
+ - name: Configure go enviroment
+ ansible.builtin.template:
+ src: misc/dotfiles/goenv.j2
+ dest: '{{ go_conf_dir }}/env'
+ when: has_go.rc == 0
+
- name: Copy templates files if necessary
tags: templates
block: