diff options
author | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-12-29 20:13:55 +0100 |
---|---|---|
committer | Hugo Hörnquist <hugo@lysator.liu.se> | 2021-12-29 20:13:55 +0100 |
commit | d04542e000b8f8fadce45af96d93fb904ca99115 (patch) | |
tree | e85ee2bb0472d9f83f051f31d2629bf4c96bb755 /modules/pass/lib | |
parent | Setup new site.pp. (diff) | |
parent | Migrate stuff from ansible. (diff) | |
download | webdav_server-d04542e000b8f8fadce45af96d93fb904ca99115.tar.gz webdav_server-d04542e000b8f8fadce45af96d93fb904ca99115.tar.xz |
Merge branch 'master' of /home/hugo/puppet into production
Diffstat (limited to 'modules/pass/lib')
-rw-r--r-- | modules/pass/lib/puppet/functions/pass.rb | 21 |
1 files changed, 21 insertions, 0 deletions
diff --git a/modules/pass/lib/puppet/functions/pass.rb b/modules/pass/lib/puppet/functions/pass.rb new file mode 100644 index 0000000..176e7e9 --- /dev/null +++ b/modules/pass/lib/puppet/functions/pass.rb @@ -0,0 +1,21 @@ +# require 'open3' + +Puppet::Functions.create_function(:pass) do + dispatch :method do + param 'String', :path + optional_param 'String', :salt + end + + def method(path, salt = path) + # Salt was an attempt to not regenerate the entry every run. + # This however failed, since the command is still run, and puppet + # doesn't diff betwen runs + # -salt #{salt} + # + # TODO fetch passwords in some slightly more portable way + `openssl passwd -apr1 $(sudo -Hu hugo pass #{path})` + # Open3.popen3("sudo -Hu hugo pass #{path}") do |stdin, stdout, stderr, thread| + # stdout.read.chomp + # end + end +end |