From 9c2b4e195f82c85d4f6bd91cf181af158e3cd261 Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Mon, 11 May 2020 09:55:35 +0200 Subject: [PATCH] added GoBulletTrain --- salt/README.md | 3 +++ salt/pillars/packages.sls | 2 ++ salt/pillars/top.sls | 1 + salt/pillars/user.sls | 2 ++ salt/states/gbt.sls | 18 ++++++++++++++++++ salt/states/top.sls | 1 + 6 files changed, 27 insertions(+) create mode 100644 salt/README.md create mode 100644 salt/pillars/user.sls create mode 100644 salt/states/gbt.sls diff --git a/salt/README.md b/salt/README.md new file mode 100644 index 0000000..c9888f3 --- /dev/null +++ b/salt/README.md @@ -0,0 +1,3 @@ +``` +sudo salt-call --local "$@" +``` diff --git a/salt/pillars/packages.sls b/salt/pillars/packages.sls index 827da71..d567b9b 100644 --- a/salt/pillars/packages.sls +++ b/salt/pillars/packages.sls @@ -4,3 +4,5 @@ packages: curl: htop: terminator: + borgbackup: + go: diff --git a/salt/pillars/top.sls b/salt/pillars/top.sls index 535b8fd..8dfce2f 100644 --- a/salt/pillars/top.sls +++ b/salt/pillars/top.sls @@ -1,5 +1,6 @@ base: '*': + - user - packages - repositories diff --git a/salt/pillars/user.sls b/salt/pillars/user.sls new file mode 100644 index 0000000..bfe2532 --- /dev/null +++ b/salt/pillars/user.sls @@ -0,0 +1,2 @@ +user: + username: jonas diff --git a/salt/states/gbt.sls b/salt/states/gbt.sls new file mode 100644 index 0000000..70dbbf9 --- /dev/null +++ b/salt/states/gbt.sls @@ -0,0 +1,18 @@ +# Install GoBulleTrain, +# Highly configurable prompt builder for Bash, ZSH and PowerShell written in Go. + +Make sure go directory exists: + file.directory: + - name: {{ salt['user.info']( pillar['user']['username']).home }}/go + - user: {{ pillar['user']['username'] }} + - group: users + - mode: "0755" + +{% if not salt['file.directory_exists']('{}/go/src/github.com/jtyr/gbt'.format(salt['user.info']( pillar['user']['username']).home)) %} +Go get GBT: + cmd.run: + - name: go get github.com/jtyr/gbt/cmd/gbt + - runas: {{ pillar['user']['username'] }} + - env: + - GOPATH: {{ salt['user.info']( pillar['user']['username']).home }}/go +{% endif %} diff --git a/salt/states/top.sls b/salt/states/top.sls index ce24952..932b19e 100644 --- a/salt/states/top.sls +++ b/salt/states/top.sls @@ -2,3 +2,4 @@ base: '*': - repositories - packages + - gbt