Puppet for Junos

  • 1.  How are manifest updates automatically pulled by junos devices ?

    Posted 02-19-2013 15:31

    According to the puppet config guide I've been following, once my agent has pulled a config successfully, it should automatically fetch new configurations when it (the manifest) changes.

     

    I don't see that happening on the junos side.  (it's been 45 minutes since I updated my manifest and no change).

    Also, I don't see any evidence of any puppet processes running on the junos device, or cron jobs that would cause an update check.   Does the puppet master "poke" the agent to let it know?

     

    /doug



  • 2.  RE: How are manifest updates automatically pulled by junos devices ?
    Best Answer

    Posted 02-20-2013 04:01

    Hi Doug,

     

    So the real answer is "it depends".  Each organization can decide how the puppet agent is "kicked" to run.  There are a number of options here, and I would encourage you to read through the postings on the Puppet Labs support website as well.

     

    The way *I* run my puppet agent is: "puppet agent -t --no-daemonize".  This basically makes the puppet agent run once.  I've been told that most folks do not run the puppet agent in daemon mode.

     

    So how do you get a "repeat performance"?  Some people use cron to do this.  So if you want to do this as well, here is what you can do in your manifest node definition - add a 'cron' resource definition.  The following kicks the puppet agent to run every 10 minute.

     

       cron { puppetrun:
          environment => "PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/sbin:/opt/bin:/opt/sdk/juniper/bin",
          command => "puppet agent --onetime --no-daemonize > /tmp/puppetrun.txt 2>&1",
          user => puppet,
          minute => '*/10',
       }

     

    If you login to the box as user=puppet, and you can verify that the cron was installed using:

    % crontab -l
    # HEADER: This file was autogenerated at Wed Feb 20 03:57:57 -0800 2013 by puppe                                         t.
    # HEADER: While it can still be managed manually, it is definitely not recommend                                         ed.
    # HEADER: Note particularly that the comments starting with 'Puppet Name' should
    # HEADER: not be deleted, as doing so could cause duplicate cron jobs.
    # Puppet Name: puppetrun
    PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/sbin:/opt/bin:/opt/sdk/juniper/bin
    */10 * * * * puppet agent --onetime --no-daemonize > /tmp/puppetrun.txt 2>&1
    % crontab -l
    # HEADER: This file was autogenerated at Wed Feb 20 03:57:57 -0800 2013 by puppet.
    # HEADER: While it can still be managed manually, it is definitely not recommended.
    # HEADER: Note particularly that the comments starting with 'Puppet Name' should
    # HEADER: not be deleted, as doing so could cause duplicate cron jobs.
    # Puppet Name: puppetrun
    PATH=/bin:/usr/bin:/sbin:/usr/sbin:/opt/sbin:/opt/bin:/opt/sdk/juniper/bin
    */10 * * * * puppet agent --onetime --no-daemonize > /tmp/puppetrun.txt 2>&1
    </pre>

     

    For more details on the common Puppet resource types, check here:

    http://docs.puppetlabs.com/references/latest/type.html

     

    Please note that Puppet for Junos does not support all of the standard resource types.  I have tested the cron resource type, and it's shown to work.

     

    Hope this helps,

    -- Jeremy



  • 3.  RE: How are manifest updates automatically pulled by junos devices ?

    Posted 02-20-2013 20:40

    Thanks Jeremy - I was just looking at exactly the same "issue" and wondering how to kick it off  : )