Puppet for Junos

  • 1.  More than one netdev_vlan resource always causes a Junos commit?

    Posted 09-19-2015 18:23

    Before beginning, I confirm my device has no vlans configured:

    {master:0}
    user@s0> show configuration vlans

    {master:0}
    user@s0>

     

    I have a very simple manifest:

     

    node 's0.example.com' {
      netdev_device { $hostname: }
      netdev_vlan { 'accounting': vlan_id => 100, description => "Accounting Dept" }
    }

     

     

    The first time I run the puppet agent, the vlan is successfully added:

     

    % puppet agent -t
    Info: Retrieving pluginfacts
    Info: Retrieving plugin
    ldapname is deprecated and will be removed in a future version
    Info: Caching catalog for s0.example.com
    Info: Applying configuration version '1442711200'
    Notice: /Stage[main]/Main/Node[s0.example.com]/Netdev_vlan[accounting]/ensure: created
    Info: JUNOS: Committing 1 changes.
    Notice: JUNOS:

    [edit]
    + vlans {
    + accounting {
    + description "Accounting Dept";
    + vlan-id 100;
    + }
    + }

    kill: 2155: No such process
    kill: 2159: No such process
    Notice: JUNOS: OK: COMMIT success!
    Notice: Finished catalog run in 3.80 seconds
    %

     

    I confirm the configuration shows the vlan:

     

    {master:0}
    user@s0> show configuration vlans
    accounting {
        description "Accounting Dept";
        vlan-id 100;
    }

     

    {master:0}
    user@s0>

     

    As expected, when I rerun the puppet agent, no changes are needed:

     

    % puppet agent -t
    Info: Retrieving pluginfacts
    Info: Retrieving plugin
    ldapname is deprecated and will be removed in a future version
    Info: Caching catalog for s0.example.com
    Info: Applying configuration version '1442711425'
    Notice: Finished catalog run in 0.53 seconds
    %

     

     

    I now add a second vlan to my manifest:

     

    node 's0.example.com' {
      netdev_device { $hostname: }
      netdev_vlan { 'accounting': vlan_id => 100, description => "Accounting Dept" }
      netdev_vlan { 'hardware': vlan_id => 101, description => "Hardware Dev" }
    }

     

     

    The next time I run the puppet agent, the new vlan is added as expected, but there are some weird messages about the new vlan being a "change":

     

    % puppet agent -t
    Info: Retrieving pluginfacts
    Info: Retrieving plugin
    ldapname is deprecated and will be removed in a future version
    Info: Caching catalog for s0.example.com
    Info: Applying configuration version '1442711633'
    Notice: /Stage[main]/Main/Node[s0.example.com]/Netdev_vlan[hardware]/description: description changed 'Accounting Dept' to 'Hardware Dev'
    Notice: /Stage[main]/Main/Node[s0.example.com]/Netdev_vlan[hardware]/vlan_id: vlan_id changed '100' to '101'
    Info: JUNOS: Committing 1 changes.
    Notice: JUNOS:

    [edit vlans]
    + hardware {
    + description "Hardware Dev";
    + vlan-id 101;
    + }

    kill: 2661: No such process
    Notice: JUNOS: OK: COMMIT success!
    Notice: Finished catalog run in 3.75 seconds
    %

     

    {master:0}
    user@s0> show configuration vlans
    accounting {
        description "Accounting Dept";
        vlan-id 100;
    }
    hardware {
        description "Hardware Dev";
        vlan-id 101;
    }

     

    {master:0}
    user@s0>

     

     

    Now, every time the puppet agent runs again, it reports the same messages about the vlan changing. It also reports a "Error: JUNOS: Unmanaged VLAN interface:", and it performs a Junos commit even though there were no changes to the configuration:

     

    % puppet agent -t
    Info: Retrieving pluginfacts
    Info: Retrieving plugin
    ldapname is deprecated and will be removed in a future version
    Info: Caching catalog for s0.example.com
    Info: Applying configuration version '1442711874'
    Notice: /Stage[main]/Main/Node[s0.example.com]/Netdev_vlan[hardware]/description: description changed 'Accounting Dept' to 'Hardware Dev'
    Notice: /Stage[main]/Main/Node[s0.example.com]/Netdev_vlan[hardware]/vlan_id: vlan_id changed '100' to '101'
    Error: JUNOS: Unmanaged VLAN interface:
    Info: JUNOS: Committing 1 changes.
    Notice: JUNOS:


    kill: 3088: No such process
    Notice: JUNOS: OK: COMMIT success!
    Notice: Finished catalog run in 3.78 seconds
    %

     

    {master:0}
    user@s0> show configuration vlans
    accounting {
        description "Accounting Dept";
        vlan-id 100;
    }
    hardware {
        description "Hardware Dev";
        vlan-id 101;
    }

     

    {master:0}
    user@s0> show configuration | compare rollback 1

     

    {master:0}
    user@s0>

     

    Why are these change and error messages being generated? Why is an empty commit being applied?

     

    Thanks,

    --Stacy



  • 2.  RE: More than one netdev_vlan resource always causes a Junos commit?
    Best Answer

    Posted 09-24-2015 23:37

    Looks like this issue: https://github.com/Juniper/puppet-netdev-stdlib-junos/issues/15

     

    Try this:

    #puppet module upgrade juniper-netdev_stdlib_junos --version 2.0.1 


  • 3.  RE: More than one netdev_vlan resource always causes a Junos commit?

    Posted 09-25-2015 09:45

    Thanks. That indeed seems to be the issue.

     

    One minor change to your workaround. The 2.0.1 version is not available. It's been pulled. However, there is a 2.0.1-beta version available and I have confirmed that it does indeed address my issue.