Index: modules/adblockplus/manifests/web/static/hook.pp |
=================================================================== |
new file mode 100644 |
--- /dev/null |
+++ b/modules/adblockplus/manifests/web/static/hook.pp |
@@ -0,0 +1,49 @@ |
+# == Type: adblockplus::web::static::hook |
+# |
+# Manage custom hooks to be triggered via ssh commands |
+# |
+# === Parameters: |
+# |
+# [*file*] |
+# Overwrite the default configuration for the hook. |
+# |
+# === Examples: |
+# |
+# adblockplus::web::static::hook {'deploy': |
+# 'file' => { |
+# source => 'puppet:///modules/adblockplus/web/deploy.py', |
+# path => '/usr/local/bin/deploy.py', |
+# }, |
+# 'own-uname' => { |
mathias
2018/03/27 14:46:51
This seems like a fragment that doesn't belong her
f.lopez
2018/03/27 19:29:50
Oh, I didn't delete the other example, I'll fix it
|
+# content => 'uname -a', |
+# }, |
+# } |
+# |
+define adblockplus::web::static::hook ( |
+ $file = {}, |
+) { |
+ |
+ File { |
+ mode => '0755', |
+ owner => $adblockplus::web::static::deploy_user, |
+ group => $adblockplus::web::static::deploy_user, |
+ } |
+ |
+ ensure_resource('file', "/usr/local/bin/commands", { |
mathias
2018/03/27 14:46:51
You shall not create a global command called "comm
f.lopez
2018/03/27 19:29:50
Acknowledged.
|
+ ensure => ensure_file_state($adblockplus::web::static::ensure), |
+ content => template('adblockplus/web/commands.sh.erb'), |
+ }) |
+ |
+ ensure_resource('file', "/home/$adblockplus::web::static::deploy_user/bin", { |
mathias
2018/03/27 14:46:51
As long as adblockplus::web::static is a class thi
f.lopez
2018/03/27 19:29:50
Acknowledged.
|
+ ensure => ensure_directory_state($adblockplus::web::static::ensure), |
+ }) |
+ |
+ ensure_resource('file', |
mathias
2018/03/27 14:46:51
Now which convention was the base for the kind of
f.lopez
2018/03/27 19:29:50
The line would be 80+ if I didn't split it up, so
|
+ "script#${name}", |
mathias
2018/03/27 14:46:51
Using "script#" as a local context prefix for file
f.lopez
2018/03/27 19:29:50
Acknowledged.
|
+ merge({ |
+ ensure => ensure_file_state($adblockplus::web::static::ensure), |
+ path => "/home/$adblockplus::web::static::deploy_user/bin/${name}", |
+ }, $file)) |
mathias
2018/03/27 14:46:51
The "path" should be merged after $file (maybe "en
f.lopez
2018/03/27 19:29:50
Acknowledged.
|
+ |
+} |
+ |