Ask Your Question
0

hiera: no error,but no changes

asked 2015-11-07 13:13:40 -0500

tagomasa gravatar image

I still tryng to update cron via hiera and puppet I configure as this

hiera.yaml

    ---
:backends:
  - yaml
  - json
:yaml:
  :datadir: /etc/puppet/hieradata
:json:
  :datadir: /etc/puppet/hieradata
:hierarchy:
  - "%{::environment}/%{::role}"
  - "%{::role}"
  - common

/etc/puppet/hieradata/serverftp/cron.yaml

cron::job { 'yum':
  minute      => '*/33',
  hour        => '*',
  date        => '*',
  month       => '*',
  weekday     => '*',
  user        => 'root',
  command     => 'yum -y update >/dev/null 2>&1',
  environment => [ 'MAILTO=root', 'PATH="/sbin:/usr/sbin:/usr/bin:/bin"', ],
}

Apply with puppet,no error

After did puppet agent -t Nothing change :(

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2015-11-08 19:57:50 -0500

stoney27 gravatar image

Your cron.yaml is not yaml.

You would need something like this in your cron.yaml.

cron::job:
    yum:
        minute: '*/33',
        hour: '*',
        date: '*',
        month: '*',
        weekday: '*',
        user: 'root',
        command: 'yum -y update >/dev/null 2>&1',
        environment: 
            -'MAILTO=root'
            -'PATH="/sbin:/usr/sbin:/usr/bin:/bin"'

Then in your puppet code call a hiera_hash and then a create resource:

$cron_jobs = hiera_hash('cron::jobs', {})

create_resources('cron', $cron_jobs)

I have not tested this so I am not sure the environment: variable is correct but it should be close to being correct.

edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2015-11-07 13:13:40 -0500

Seen: 204 times

Last updated: Nov 07 '15