https://www.puppet.com/community logo
Join Slack
Powered by
# voxpupuli
  • b

    bastelfreak

    05/06/2022, 11:54 AM
    do you have
    /opt/puppetlabs/puppet/cache/lib/puppet/type/sshd_config.rb
    on the agent?
  • s

    Sam

    05/06/2022, 11:54 AM
    Managing ssh through cem_linux module
  • s

    Sam

    05/06/2022, 11:55 AM
    I just only want to change 2 values for 3 nodes Hence, writing a custom module
  • s

    Sam

    05/06/2022, 11:58 AM
    Yes, I have
    /opt/puppetlabs/puppet/cache/lib/puppet/type/sshd_config.rb
    on the agent
  • s

    Sam

    05/06/2022, 11:58 AM
    @bastelfreak
  • b

    bastelfreak

    05/06/2022, 12:00 PM
    mhm odd
  • b

    bastelfreak

    05/06/2022, 12:01 PM
    no idea at the moment why it fails. maybe it cannot parse the type and then fails to load it
  • s

    Sam

    05/06/2022, 12:05 PM
    did this "sshd_config" resource type works?
  • b

    bastelfreak

    05/06/2022, 12:05 PM
    I havent used this one in the past, but in general the augeas providers work fine
  • b

    bastelfreak

    05/06/2022, 12:06 PM
    you could switch from the forge releases to the lastst master branch
  • s

    Sam

    05/06/2022, 12:06 PM
    Sorry, I did not get you
  • b

    bastelfreak

    05/06/2022, 12:08 PM
    at the moment you pull from the forge
  • b

    bastelfreak

    05/06/2022, 12:09 PM
    but you can also deploy modules from github
  • b

    bastelfreak

    05/06/2022, 12:09 PM
    and the forge releases are a bit old
  • s

    Sam

    05/06/2022, 12:23 PM
    Got it Added both the modules in .fixtures.yml
  • s

    Sam

    05/06/2022, 12:24 PM
    It Worked Code PASSED
  • b

    bastelfreak

    05/06/2022, 12:29 PM
    ah you're running unit tests? 😄
  • s

    Sam

    05/06/2022, 1:00 PM
    yes
  • b

    bastelfreak

    05/06/2022, 1:01 PM
    important detail
  • h

    hbui

    05/06/2022, 1:07 PM
    metadata.json deps are only really processed by human eyes, I'm not aware of any tools that use them beyond formatting documentation. Any module (and all of its dependencies) will need to be in your .fixtures.yml file for doing unit tests and then they will also need to be in the Puppetfile of your environment in addition to your module.
  • b

    bastelfreak

    05/06/2022, 1:11 PM
    if you use custom types from other modules, you might see errors if this module isn't listed as dependency in metadata.json
  • s

    Sam

    05/06/2022, 1:21 PM
    My Code has some problem: Every time I modify sshd_config file, sshd service needs to be restarted as per cem_linux Tried resolving it, but, puppet says cannot declare sshd service restart 2 times:
    Copy code
    class corp::profile::ssh_setup {
    
    	sshd_config { "AllowTcpForwarding":
      		ensure    => present,
      		condition => "Host tcp-pub-app*-<http://bla.bbb-qc.aws.aaa.com|bla.bbb-qc.aws.aaa.com>",
      		value     => "yes",
            notify    => Service['sshd'],
    	}
    
    	sshd_config { "MaxStartups":
      		ensure    => present,
      		condition => "Host tcp-pub-app*-<http://bla.bbb-qc.aws.aaa.com|bla.bbb-qc.aws.aaa.com>",
      		value     => "100",
            notify    => Service['sshd'],
    	}
        service { 'sshd':
          ensure => 'running',
          enable => true,
        }
      }
    }
  • s

    Sam

    05/06/2022, 1:21 PM
    My Code has some problem: Every time I modify sshd_config file, sshd service needs to be restarted as per cem_linux Tried resolving it, but, puppet says cannot declare sshd service restart 2 times:
    Copy code
    class corp::profile::ssh_setup {
    
    	sshd_config { "AllowTcpForwarding":
      		ensure    => present,
      		condition => "Host tcp-pub-app*-<http://bla.bbb-qc.aws.aaa.com|bla.bbb-qc.aws.aaa.com>",
      		value     => "yes",
            notify    => Service['sshd'],
    	}
    
    	sshd_config { "MaxStartups":
      		ensure    => present,
      		condition => "Host tcp-pub-app*-<http://bla.bbb-qc.aws.aaa.com|bla.bbb-qc.aws.aaa.com>",
      		value     => "100",
            notify    => Service['sshd'],
    	}
        service { 'sshd':
          ensure => 'running',
          enable => true,
        }
      }
    }
  • h

    hbui

    05/06/2022, 1:22 PM
    something else is likely declaring the
    service { 'sshd': ...}
    so you shouldn't add it in your profile
  • h

    hbui

    05/06/2022, 1:23 PM
    message has been deleted
  • s

    Sam

    05/06/2022, 1:23 PM
    What does that mean?
  • s

    Sam

    05/06/2022, 1:23 PM
    What does that mean?
  • h

    hbui

    05/06/2022, 1:25 PM
    In the error message about the duplicate declaration, it will tell you where the other declaration is
  • h

    hbui

    05/06/2022, 1:26 PM
    Puppet only allows one resource to own a thing, also this is a discussion that makes more sense in the main #puppet channel
  • s

    Sam

    05/06/2022, 1:29 PM
    You're right It is already declared in some other manifest while modifying sshd_config file
1...262728...648Latest