Puppet bolt plan in yaml format

332 Views Asked by At

I am trying to put a together Puppet bolt plan in YAML format.

I got it working in .pp file and here is the plan

plan profiles::chg123456(
  TargetSpec $nodes,
) {
  apply($nodes) {
    logrotate::rule {'proftpd':
      path          => ['/var/log/proftpd/*.log', '/var/log/xferlog', '/var/log/proftpd.system.log', '/var/log/sftp.log', '/var/log/sftp-xferlog',],
      maxsize       => '100m',
      rotate_every  => 'week',
      compress      => true,
      ifempty       => true,
      missingok     => true,
      sharedscripts => true,
      postrotate    => 'test -f /var/lock/subsys/proftpd && /usr/bin/killall -HUP proftpd || :'
    }
  }
}

It worked and created /etc/logrotate.d/proftpd with all the correct settings.

Now I want to convert to YAML format but no idea how to do that.

Here is what I guessed but bolt plan show keep saying

$ bolt plan show
Parse error in step "chg123456":
 No valid action detected (file: C:/Users/puppet/msys64/home/puppet/.puppetlabs/bolt/modules/profiles/plans/chg123456.yaml)

My YAML plan looks like follows

parameters:
  nodes:
    type: TargetSpec

steps:
  - name: chg123456
    target: $nodes
    logrotate::rules:
      proftpd:
        path:
          - '/var/log/proftpd/*.log'
          - '/var/log/xferlog'
          - '/var/log/proftpd.system.log'
          - '/var/log/sftp.log'
          - '/var/log/sftp-xferlog'
        maxsize: '100m'
        compress: true
        ifempty: true
        missingok: true
        sharedscripts: true
        postrotate: 'test -f /var/lock/subsys/proftpd && /usr/bin/killall -HUP proftpd || :'

return: $chg123456

What am I doing wrong?

Thanks

1

There are 1 best solutions below

0
On

You'll want to use a resources step, and list the resources you want to use in yaml (documentation):

parameters:
  nodes:
    type: TargetSpec

steps:
  - name: chg123456
    target: $nodes
    resources:
      - logrotate::rules: proftpd
        parameters:
          path:
            - '/var/log/proftpd/*.log'
            - '/var/log/xferlog'
            - '/var/log/proftpd.system.log'
            - '/var/log/sftp.log'
            - '/var/log/sftp-xferlog'
          maxsize: '100m'
          compress: true
          ifempty: true
          missingok: true
          sharedscripts: true
          postrotate: 'test -f /var/lock/subsys/proftpd && /usr/bin/killall -HUP proftpd || :'

return: $chg123456

In response to one comment, bolt plan convert is only used to convert yaml plans into Puppet plans, not the other way around.