aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-10-02 19:34:49 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-10-02 19:34:49 +0200
commit6989902ff19692b7620d8a59e8b38cd7e7123b08 (patch)
tree9101a35851715927e5edac12962ecee6cfc9165c
downloadenvvar-6989902ff19692b7620d8a59e8b38cd7e7123b08.tar.gz
envvar-6989902ff19692b7620d8a59e8b38cd7e7123b08.tar.xz
Initial commit.
-rw-r--r--README.md6
-rw-r--r--manifests/init.pp12
-rw-r--r--manifests/setup.pp13
-rw-r--r--metadata.json32
4 files changed, 63 insertions, 0 deletions
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..015d9de
--- /dev/null
+++ b/README.md
@@ -0,0 +1,6 @@
+Envvar
+======
+
+Module for managing global environment modules.
+
+Currently uses `/etc/environment`, so requires logind.
diff --git a/manifests/init.pp b/manifests/init.pp
new file mode 100644
index 0000000..efc961b
--- /dev/null
+++ b/manifests/init.pp
@@ -0,0 +1,12 @@
+# Manage a single global environment variables.
+define envvar (
+ String $value,
+ String $key = $name,
+) {
+ include ::envvar::setup
+
+ concat::fragment { 'User environment':
+ target => '/etc/environment',
+ content => "${key}=${value}\n",
+ }
+}
diff --git a/manifests/setup.pp b/manifests/setup.pp
new file mode 100644
index 0000000..dcf9964
--- /dev/null
+++ b/manifests/setup.pp
@@ -0,0 +1,13 @@
+class envvar::setup (
+) {
+ concat { '/etc/environment':
+ ensure => 'present',
+ }
+
+ lookup('environment', undef, 'hash', {}).map |$key, $value| {
+ envvar{ $key:
+ value => $value,
+ }
+ }
+
+}
diff --git a/metadata.json b/metadata.json
new file mode 100644
index 0000000..1b9403f
--- /dev/null
+++ b/metadata.json
@@ -0,0 +1,32 @@
+{
+ "name": "HugoNikanor-envvar",
+ "version": "0.1.0",
+ "author": "Hugo Hörnquist",
+ "license": "None",
+ "summary": "Sets global environment variables.",
+ "source": "https://git.hornquist.se/puppet/envvar",
+ "dependencies": [
+ {
+ "name": "puppetlabs/concat",
+ "version_requirement": ">= 7.2.0 < 8.0.0"
+ }
+ ],
+ "operatingsystem_support": [
+ {
+ "operatingsystem": "Archlinux"
+ },
+ {
+ "operatingsystem": "Ubuntu",
+ "operatingsystemrelease": [
+ "16", "18", "20", "22"
+ ]
+ },
+ {
+ "operatingsystem": "Debian",
+ "operatingsystemrelease": [
+ "8", "9", "10", "11", "12"
+ ]
+ }
+ ]
+
+}