From 9da99176cb93e27da861bb0bbef089fb5de31590 Mon Sep 17 00:00:00 2001 From: Maximilian Friedersdorff Date: Tue, 4 Jun 2019 09:39:16 +0100 Subject: [PATCH] Start implementing git config in saltfiles --- states/dotfiles.sls | 1 + states/git/gentoo.sls | 20 ++++++++++++++++++++ states/git/init.sls | 17 +++++++++++++++++ 3 files changed, 38 insertions(+) create mode 100644 states/git/gentoo.sls create mode 100644 states/git/init.sls diff --git a/states/dotfiles.sls b/states/dotfiles.sls index 6ad7e29..cf4225a 100644 --- a/states/dotfiles.sls +++ b/states/dotfiles.sls @@ -1,2 +1,3 @@ include: - bash + - git diff --git a/states/git/gentoo.sls b/states/git/gentoo.sls new file mode 100644 index 0000000..209abdb --- /dev/null +++ b/states/git/gentoo.sls @@ -0,0 +1,20 @@ +{% set git_useflags = [ + 'gpg' +] %} + +set useflags: + file.managed: + - name: /etc/portage/package.use/git-salt + - contents: + {% for flag in git_useflags %} + - dev-vcs/git {{ flag }} + {% endfor %} + - user: root + - group: root + - mode: 644 + - require_in: + - pkg: git installed + +git installed: + pkg.installed: + - name: dev-vcs/git diff --git a/states/git/init.sls b/states/git/init.sls new file mode 100644 index 0000000..b1dc69e --- /dev/null +++ b/states/git/init.sls @@ -0,0 +1,17 @@ +include: + - git.{{ grains['os'] | lower }} + + +{% set git_vars = { + 'user.name': 'Maximilian Friedersdorff', + 'user.email': 'max@friedersdorff.com' +} +%} + +{% for var,val in git_vars.items() %} +{{ var }}: + git.config_set: + - value: {{ val }} + - global: True + - user: {{ grains['user'] }} +{% endfor %} -- 2.46.2