Add management of ~/.opt

This commit is contained in:
2020-02-25 21:37:11 +01:00
parent 6b0e4d46c8
commit 9981985835
2 changed files with 31 additions and 0 deletions

View File

@@ -208,6 +208,7 @@
stat:
path: "/home/{{ user.name }}/bin"
register: bin_stat
tags: [bin]
- name: remove ~/bin if not a link
file:
@@ -216,7 +217,36 @@
when:
- bin_stat.stat.exists
- not bin_stat.stat.islnk
tags: [bin]
- name: create ~/.opt and ~/.optbin
file:
path: "{{ item }}"
state: directory
with_items:
- ~/.opt/
- ~/.optbin/
tags: [bin]
- name: symlink opt programs
file:
state: link
force: true
follow: false
path: "/home/{{ user.name }}/.optbin/{{ item.name }}"
src: "/home/{{ user.name }}/.opt/{{ item.optpath }}"
owner: "{{ user.name }}"
group: "{{ user_group_name }}"
with_items:
- name: terraform
optpath: terraform
- name: kubectl
optpath: kubectl
- name: hugo
optpath: hugo
- name: drone
optpath: drone
tags: [bin]
- name: link bin directory
file:

View File

@@ -1,4 +1,5 @@
_path=("$HOME/bin"
"$HOME/.optbin
"/usr/local/sbin"
"/usr/local/bin"
"/usr/sbin"