I have it working and I can run puppet device to send configuration to device.

Now, I would like to configure the agent proxy so I don't have to manually run puppet device to send configuration to devices, but to puppet agent doing it for me in every run. Is this possible, how do I have to do it?

        I'm trying it with this manifest:

node default {

  include cisco_ios::proxy

  exec {'run puppet device':
command => '/opt/puppetlabs/bin/puppet device --verbose --logdest syslog',
    require => Class['cisco_ios::proxy'],
  }

  device_manager {'switch_cisco_pruebas':
    type => 'cisco_ios',
    credentials => {
      address => '10.54.1.111',
      port => '22',
      username => 'test',
      password => 'test123',
      enable_password => '123test',
    },
  }

}

node switch_cisco_pruebas {

  ntp_server { '1.2.3.5':
    ensure => 'present',
    key => 94,
    prefer => true,
    minpoll => 4,
    maxpoll => 14,
  }

  ios_config { 'prueba_comandos':
    command  => "
      default interface Gi1/0/2
      int gi1/0/2
      description Prueba Puppet
    ",
  }
}

With this manifest, the "run puppet device" exec is done in every puppet agent run, sending configuration to device, and works with ntp_server and banner resources, but it doesn't work with ios_config one, I get the error

Dec 5 14:23:55 leo10 puppet-agent[66368]: Could not retrieve catalog from remote server: Error 500 on SERVER: Server Error: Evaluation Error: Error while evaluating a Resource Statement, Could not autoload puppet/type/ios_config: no such file to load -- puppet/resource_api (file: /etc/puppetlabs/code/environments/production/manifests/site.pp, line: 33, column: 2) on node switch_cisco_pruebas

        The same manifest, applied with puppet device works without any problem.

        What do I have to do to automatically configure device in every puppet 
run?

El 5/12/18 a las 12:11, Will Meek escribió:
Hi Angel,

Thank you for the detail so far!

The only way I can reproduce this on my setup is with having puppetlabs-cisco_ios 0.5.0 installed in the production environment, whereby puppet tries to pick up the old 'ios' provider rather than the >0.6.0 'cisco_ios' provider.

puppet device --verbose --target switch_cisco_pruebas --modulepath /etc/puppetlabs/code/environments/ciscotest/modules --resource ntp_server

Error: Could not autoload puppet/provider/ntp_server/ios: superclass mismatch for class NtpServer



puppet module list

/etc/puppetlabs/code/environments/production/modules

└── puppetlabs-cisco_ios (v0.5.0)

puppet module list --environment ciscotest

/etc/puppetlabs/code/environments/ciscotest/modules

├── puppetlabs-cisco_ios (v0.6.1)



Do you have an old version of the cisco_ios module installed in any environments?

This should be addressed by the resolution of Puppet ticket https://tickets.puppetlabs.com/browse/PUP-8766, hopefully early 2019.

In the meantime, if you add a --libdir are you successful?

eg.

sudo puppet device --verbose --target switch_cisco_pruebas --modulepath /etc/puppetlabs/code/environments/ciscotest/modules --resource ntp_server --libdir /etc/puppetlabs/code/environments/ciscotest/modules/cisco_ios/lib/

Info: retrieving resource: ntp_server from switch_cisco_pruebas at file:///etc/puppetlabs/puppet/devices/switch_cisco_pruebas.conf

ntp_server { '1.2.3.5':

key => 94,

minpoll => 4,

maxpoll => 14,

prefer => true,

ensure => 'present',

}


Out of interest - what version of Puppet are you running?

puppet --version
6.0.4

Thanks
Will

On Friday, November 30, 2018 at 1:29:16 PM UTC, amateo wrote:

    I'm beginning with puppetlabs/cisco_ios module. For the moment, just a
    proof of concept.

    These are the modules I have installed:

    /etc/puppetlabs/code/environments/ciscotest/modules
    ├── puppetlabs-cisco_ios (v0.6.1)
    ├── puppetlabs-concat (v5.1.0)
    ├── puppetlabs-device_manager (v2.7.0)
    ├── puppetlabs-hocon (v1.0.1)
    ├── puppetlabs-netdev_stdlib (v0.17.0)
    ├── puppetlabs-puppetserver_gem (v1.0.0)
    ├── puppetlabs-resource_api (v1.0.0)
    └── puppetlabs-stdlib (v5.1.0)

    In _manifests/site.pp_ I have:
    node default {
        device_manager {'switch_cisco_pruebas':
          type => 'cisco_ios',
          credentials => {
            address => '1.2.3.4',
            port => '22',
            username => 'test',
            password => 'password',
            enable_password => 'enablepassword',
          },
        }
    }

    The problem I have is that running puppet agent gives no error, but the
    device command doesn't work. I have the error:

    root@leo10:/etc/puppetlabs/code/environments/ciscotest# puppet device
    --verbose --target switch_cisco_pruebas --apply ~/manifest.pp --noop
    Error: Could not autoload puppet/provider/ntp_server/cisco_ios:
    superclass mismatch for class Device
    Error: Could not autoload puppet/type/ntp_server: Could not autoload
    puppet/provider/ntp_server/cisco_ios: superclass mismatch for class
    Device
    Error: Evaluation Error: Error while evaluating a Resource Statement,
    Could not autoload puppet/type/ntp_server: Could not autoload
    puppet/provider/ntp_server/cisco_ios: superclass mismatch for class
    Device (file: /home/amateo_adm/manifest.pp, line: 1, column: 1) on node
    switch_cisco_pruebas

    Could anybody help me?

-- Angel L. Mateo Martínez
    Sección de Telemática
    Área de Tecnologías de la Información
    y las Comunicaciones Aplicadas (ATICA)
    http://www.um.es/atica
    Tfo: 868889150
    Fax: 868888337

--
You received this message because you are subscribed to the Google Groups "Puppet Users" group. To unsubscribe from this group and stop receiving emails from it, send an email to puppet-users+unsubscr...@googlegroups.com <mailto:puppet-users+unsubscr...@googlegroups.com>. To view this discussion on the web visit https://groups.google.com/d/msgid/puppet-users/ef8056dd-83f3-4ed6-907b-42eec15cf9fc%40googlegroups.com <https://groups.google.com/d/msgid/puppet-users/ef8056dd-83f3-4ed6-907b-42eec15cf9fc%40googlegroups.com?utm_medium=email&utm_source=footer>.
For more options, visit https://groups.google.com/d/optout.

--
Angel L. Mateo Martínez
Sección de Telemática
Área de Tecnologías de la Información
y las Comunicaciones Aplicadas (ATICA)
http://www.um.es/atica
Tfo: 868889150
Fax: 868888337

--
You received this message because you are subscribed to the Google Groups "Puppet 
Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to puppet-users+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/puppet-users/93ae439f-3998-4bbd-114f-8c8242e9f64b%40um.es.
For more options, visit https://groups.google.com/d/optout.

Reply via email to