summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHugo Hörnquist <hugo@lysator.liu.se>2022-10-02 18:46:12 +0200
committerHugo Hörnquist <hugo@lysator.liu.se>2022-10-02 18:46:12 +0200
commit0f3839734465de39c27ac0abcb91e9bdeef5e93d (patch)
tree443a64921db3add5e5c9ecb95450b793cf4c6ad6
parentSplit workstation into X and non-X part. (diff)
downloadprofiles-0f3839734465de39c27ac0abcb91e9bdeef5e93d.tar.gz
profiles-0f3839734465de39c27ac0abcb91e9bdeef5e93d.tar.xz
Move cowsay and envirnoment setup to own profiles.
-rw-r--r--manifests/cowsay.pp14
-rw-r--r--manifests/environment.pp15
-rw-r--r--manifests/workstation.pp18
3 files changed, 30 insertions, 17 deletions
diff --git a/manifests/cowsay.pp b/manifests/cowsay.pp
new file mode 100644
index 0000000..5f995c5
--- /dev/null
+++ b/manifests/cowsay.pp
@@ -0,0 +1,14 @@
+class profiles::cowsay (
+ Array[String] $cowpath = [
+ '/usr/share/cows',
+ '/usr/local/share/cows',
+ ],
+) {
+ ensure_packages(['cowsay'])
+
+ # TODO see profiles::environment
+ concat::fragment { 'Cowsay paths':
+ target => '/etc/environment',
+ content => epp('profiles/keyvalue.epp', { values => { 'COWPATH' => $cowpath.join(':') }}),
+ }
+}
diff --git a/manifests/environment.pp b/manifests/environment.pp
new file mode 100644
index 0000000..6759127
--- /dev/null
+++ b/manifests/environment.pp
@@ -0,0 +1,15 @@
+# Manage global environment variables.
+# TODO this should be moved to its own module, and provide propper
+# resource types.
+class profiles::environment {
+ concat { '/etc/environment':
+ ensure => 'present',
+ }
+
+ $user_environment = lookup('environment', undef, 'hash', {})
+ concat::fragment { 'User environment':
+ target => '/etc/environment',
+ content => epp('profiles/keyvalue.epp', { values => $user_environment }),
+ }
+
+}
diff --git a/manifests/workstation.pp b/manifests/workstation.pp
index a121042..a60973f 100644
--- a/manifests/workstation.pp
+++ b/manifests/workstation.pp
@@ -44,23 +44,7 @@ class profiles::workstation (
}}),
}
- $cowpath = [
- '/usr/share/cows',
- '/usr/local/share/cows',
- ]
-
- # Merge everything from hiera, but provide defeaults for
- # non-overwritten values.
- $default_environment = {
- 'COWPATH' => $cowpath.join(':'),
- }
- $user_environment = lookup('environment', undef, 'hash', {})
- $environment = $default_environment + $user_environment
-
- file { '/etc/environment':
- content => epp('profiles/keyvalue.epp', { values => $environment }),
- }
-
+ include ::profiles::cowsay
include ::profiles::sudo
include ::profiles::mounts
}