From 6ba2a64393f79d79456862f4b9fe32d90f3b62ee Mon Sep 17 00:00:00 2001 From: Jonas Forsberg Date: Sat, 9 May 2020 11:17:42 +0200 Subject: [PATCH] added salt-cal local states and pillars --- .functions.sh | 4 ++++ salt/pillars/hosts/exsilio.sls | 10 ++++++++++ salt/pillars/packages.sls | 6 ++++++ salt/pillars/repositories.sls | 9 +++++++++ salt/pillars/top.sls | 7 +++++++ salt/states/packages.sls | 6 ++++++ salt/states/repositories.sls | 10 ++++++++++ salt/states/top.sls | 4 ++++ 8 files changed, 56 insertions(+) create mode 100644 salt/pillars/hosts/exsilio.sls create mode 100644 salt/pillars/packages.sls create mode 100644 salt/pillars/repositories.sls create mode 100644 salt/pillars/top.sls create mode 100644 salt/states/packages.sls create mode 100644 salt/states/repositories.sls create mode 100644 salt/states/top.sls diff --git a/.functions.sh b/.functions.sh index ee5ff45..4edbc50 100644 --- a/.functions.sh +++ b/.functions.sh @@ -58,3 +58,7 @@ function ip_to_hex(){ IFS=. read oct1 oct2 oct3 oct4 <<< "$1" printf '0x%02x%02x%02x%02x\n' $oct1 $oct2 $oct3 $oct4 } + +function salt-call(){ + sudo salt-call --local "$@" +} diff --git a/salt/pillars/hosts/exsilio.sls b/salt/pillars/hosts/exsilio.sls new file mode 100644 index 0000000..d146ade --- /dev/null +++ b/salt/pillars/hosts/exsilio.sls @@ -0,0 +1,10 @@ +packages: + teams: + +repositories: + msteams: + humanname: Microsoft Teams + baseurl: https://packages.microsoft.com/yumrepos/ms-teams + enabled: True + gpgautoimport: True + refresh: True diff --git a/salt/pillars/packages.sls b/salt/pillars/packages.sls new file mode 100644 index 0000000..827da71 --- /dev/null +++ b/salt/pillars/packages.sls @@ -0,0 +1,6 @@ +packages: + vim: + git: + curl: + htop: + terminator: diff --git a/salt/pillars/repositories.sls b/salt/pillars/repositories.sls new file mode 100644 index 0000000..3784a13 --- /dev/null +++ b/salt/pillars/repositories.sls @@ -0,0 +1,9 @@ +{% if grains['lsb_distrib_id'] == "openSUSE Leap" %} +repositories: + packman: + humanname: packman + baseurl: https://ftp.gwdg.de/pub/linux/misc/packman/suse/openSUSE_Leap_{{ grains['lsb_distrib_release'] }}/ + enabled: True + gpgautoimport: True + refresh: True +{% endif %} diff --git a/salt/pillars/top.sls b/salt/pillars/top.sls new file mode 100644 index 0000000..535b8fd --- /dev/null +++ b/salt/pillars/top.sls @@ -0,0 +1,7 @@ +base: + '*': + - packages + - repositories + + 'exsilio': + - hosts.exsilio diff --git a/salt/states/packages.sls b/salt/states/packages.sls new file mode 100644 index 0000000..143e942 --- /dev/null +++ b/salt/states/packages.sls @@ -0,0 +1,6 @@ +{% for pkg in salt['pillar.get']('packages', []) %} +Install {{ pkg }}: + pkg.installed: + - name: {{ pkg }} + - refresh: false +{% endfor %} diff --git a/salt/states/repositories.sls b/salt/states/repositories.sls new file mode 100644 index 0000000..ec39af1 --- /dev/null +++ b/salt/states/repositories.sls @@ -0,0 +1,10 @@ +{% for repo, args in salt['pillar.get']('repositories', {}).items() %} +Add {{ repo }} repository: + pkgrepo.managed: + - name: {{ repo }} + - humanname: {{ args['humanname'] }} + - baseurl: {{ args['baseurl'] }} + - enabled: {{ args['enabled'] }} + - gpgautoimport: {{ args['gpgautoimport'] }} + - refresh: {{ args['refresh'] }} +{% endfor %} diff --git a/salt/states/top.sls b/salt/states/top.sls new file mode 100644 index 0000000..ce24952 --- /dev/null +++ b/salt/states/top.sls @@ -0,0 +1,4 @@ +base: + '*': + - repositories + - packages