summaryrefslogtreecommitdiffstats
path: root/modules/package
diff options
context:
space:
mode:
authorJesse Luehrs <doy@tozt.net>2018-10-08 03:08:44 -0400
committerJesse Luehrs <doy@tozt.net>2018-10-08 03:08:44 -0400
commit28a100fab7d434471b53c88cf1bf6118bb2b74a2 (patch)
treed354a4a4e872a37c171724db75b8a31db8a144e2 /modules/package
parent6308eae87cad1e899d0531bc996a39e3be236f8e (diff)
downloadpuppet-tozt-28a100fab7d434471b53c88cf1bf6118bb2b74a2.tar.gz
puppet-tozt-28a100fab7d434471b53c88cf1bf6118bb2b74a2.zip
support installing packages with cargo
Diffstat (limited to 'modules/package')
-rw-r--r--modules/package/manifests/cargo.pp26
1 files changed, 26 insertions, 0 deletions
diff --git a/modules/package/manifests/cargo.pp b/modules/package/manifests/cargo.pp
new file mode 100644
index 0000000..9a5af1c
--- /dev/null
+++ b/modules/package/manifests/cargo.pp
@@ -0,0 +1,26 @@
+define package::cargo($user, $ensure) {
+ case $ensure {
+ 'installed': {
+ exec { "cargo install $name":
+ provider => "shell",
+ command => "cargo install $name",
+ unless => "cargo install --list | grep -q '^$name'",
+ require => [
+ User[$user],
+ Rust::User[$user],
+ ];
+ }
+ }
+ 'absent': {
+ exec { "uninstall $name":
+ provider => "shell",
+ command => "cargo uninstall $name",
+ onlyif => "cargo install --list | grep -q '^$name'",
+ require => [
+ User[$user],
+ Rust::User[$user],
+ ];
+ }
+ }
+ }
+}