大网数据广告活动
服务器运维问答

Puppet run command on master

· 52CE 我爱测

I am trying to create a letsencrypt module in Puppet. Basically, what I am trying to achieve is the following: Adding a new node and importing my module: class { "letsencrypt": url => "example.com" } The puppet master will then c…

问题原文

原帖链接 · Hellstorm · CC BY-SA 3.0

I am trying to create a letsencrypt module in Puppet. Basically, what I am trying to achieve is the following:

  1. Adding a new node and importing my module: class { "letsencrypt": url => "example.com" }
  2. The puppet master will then check in his file folder if there is already a private key and a CSR for the given URL and then either:
    • copy the private key and the CSR to the node, or
    • run openssl openssl genrsa 4096 > example.com.key (and one key for the letsencrypt account and the certificate signing request), save it to the puppet files folder and run step 2 again.
  3. Setup a cron job on the node to run acme-tiny once every three months.
  4. Run acme-tiny once on the node and get the first certificate and reload/start the web server.

Basically my problem is how to do run a command on the puppet master. I would like to run the key generation on the puppet master and have the private key there, and only have the certificate request run on the node.

Is this even possible with Puppet? Or should I pass the complete procedure to the node entirely, not tracking anything in Puppet at all (just setting up the cronjob etc)?

Thanks!

已采纳解答

原帖链接 · Jeffrey Froman · CC BY-SA 3.0

Puppet provides a function named generate, which will populate a local manifest variable with the output of an arbitrary local command. It could be used to call a custom local script that performs the key generation, installs the public key locally, and returns the private key content, which can then be installed as a file resource on the puppet agent. For example:

file { "/path/to/private/key": ensure => present, content => generate("/path/to/my/custom/script"), ... }

摘自公开归档,保留原文语言,版式经整理,外部媒体与邮箱地址已移除。

资料来源与适用范围

资料来源
Server Fault
适用范围
以原帖系统、软件版本与发布日期为准(2016-03-24)
内容语言
中文;命令、路径和错误标识保留技术原文
本地收录日期
2026-11-15
授权说明
CC BY-SA 3.0

正文与所需资源由本站本地存储。查看来源及更新记录 ↗

请按适用版本和实际日志确认原因;本站没有对每一种系统或设备逐项执行文中的操作。