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

    helindbe

    10/26/2022, 10:06 AM
    What type do you expect the “$config_file_override” to be? I assumed it was a String since it is used as a config file name. In that case (since you want to use selector: You can do like this
    Copy code
    $config_file = $config_file_override ? {
      String[1] => £config_file_override,
      default.  => undef
    }
  • h

    helindbe

    10/26/2022, 10:07 AM
    What type do you expect the “$config_file_override” to be? I assumed it was a String since it is used as a config file name. In that case (since you want to use selector: You can do like this
    Copy code
    $config_file = $config_file_override ? {
      String[1] => $config_file_override,
      default.  => undef
    }
  • p

    Philippe Beaumont

    10/26/2022, 10:08 AM
    I sow it. I was waiting € to prefix your var 😄
  • c

    cruelsmith

    10/26/2022, 10:09 AM
    When it is a path and you use the puppetlabs-stdlib in your enviroment you can also use the Stdlib::Absolutepath type instead of the String[1].
  • c

    cruelsmith

    10/26/2022, 10:19 AM
    @helindbe https://github.com/puppetlabs/puppetlabs-stdlib/blob/main/types/absolutepath.pp#L2
  • h

    helindbe

    10/26/2022, 10:21 AM
    like this then… (since AbsolutePath includes windows version)
    Copy code
    $config_file = $config_file_override ? {
      Stdlib::Absolutepath  => $config_file_override,
      String => fail("config_file_override '${config_file_override}' is not a valid path")
      default.  => undef
    }
  • s

    Slackbot

    10/26/2022, 11:02 AM
    This message was deleted.
    m
    m
    • 3
    • 6
  • m

    ma_garvo

    10/26/2022, 11:04 AM
    Hey, I'm trying to build an AD domain using the autogenerated DSC modules and im hitting an issue where its not applying the resource. I can see it doing a dsc 'get', but no 'set' in the debug output. install.pp
    Copy code
    windowsfeature { 'AD-Domain-Services':
      ensure                 => present,
      installmanagementtools => true,
    }
    
    
    dsc_addomain { 'create_primary_dc':
      dsc_domainname                    => 'example.local',
      dsc_credential                    => {
    	'user'     => 'example.local\administrator',
    	'password' => Sensitive('ExampleP@ssW0rd!'),
      },
      dsc_safemodeadministratorpassword => {
    	'user'     => 'administrator',
    	'password' => Sensitive('ExampleP@ssW0rd!'),
      },
    }
    
    PS C:\Users\Administrator\Documents> puppet apply .\test\install.pp --modulepath .\modules\ --verbose
    [mNotice: Compiled catalog for oitmgndc02-uk in environment production in 0.29 seconds[0m
    puppet : [1;31mError: dsc_addomain: PowerShell DSC resource MSFT_ADDomain  failed to execute Get-TargetResource functionality with error message: System.Exception: 
    Please ensure that the PowerShell module 'ADDSDeployment' is installed. (DRC0009) [0m
    At line:1 char:1
    + puppet apply .\test\install.pp --modulepath .\modules\ --verbose
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: ([1;31mError: d... (DRC0009) [0m:String) [], RemoteException
        + FullyQualifiedErrorId : NativeCommandError
     
    [0;32mInfo: Using environment 'production'[0m
    [0;32mInfo: Applying configuration version '1666779036'[0m
    [mNotice: /Stage[main]/Main/Windowsfeature[AD-Domain-Services]/ensure: created[0m
    [mNotice: Applied catalog in 59.23 seconds[0m
    
    Each subsequent run completes without applying anything:
    PS C:\Users\Administrator\Documents> puppet apply .\test\install.pp --modulepath .\modules\ --verbose
    [mNotice: Compiled catalog for oitmgndc02-uk in environment production in 0.28 seconds[0m
    [0;32mInfo: Using environment 'production'[0m
    [0;32mInfo: Applying configuration version '1666781923'[0m
    [mNotice: Applied catalog in 0.80 seconds[0m
    
    PS C:\Users\Administrator\Documents> puppet module list  --modulepath .\modules\
    C:/Users/Administrator/Documents/modules
    â"œâ"€â"€ dsc-activedirectorydsc ([0;36mv6.2.0-0-0[0m)
    â"œâ"€â"€ puppet-windowsfeature ([0;36mv4.0.0[0m)
    â""â"€â"€ puppetlabs-pwshlib ([0;36mv0.10.2[0m)
  • m

    ma_garvo

    10/26/2022, 11:04 AM
    Hey, I'm trying to build an AD domain using the autogenerated DSC modules and im hitting an issue where its not applying the resource. I can see it doing a dsc 'get', but no 'set' in the debug output. install.pp
    Copy code
    windowsfeature { 'AD-Domain-Services':
      ensure                 => present,
      installmanagementtools => true,
    }
    
    
    dsc_addomain { 'create_primary_dc':
      dsc_domainname                    => 'example.local',
      dsc_credential                    => {
    	'user'     => 'example.local\administrator',
    	'password' => Sensitive('ExampleP@ssW0rd!'),
      },
      dsc_safemodeadministratorpassword => {
    	'user'     => 'administrator',
    	'password' => Sensitive('ExampleP@ssW0rd!'),
      },
    }
    
    PS C:\Users\Administrator\Documents> puppet apply .\test\install.pp --modulepath .\modules\ --verbose
    [mNotice: Compiled catalog for testmgndc02-uk in environment production in 0.29 seconds[0m
    puppet : [1;31mError: dsc_addomain: PowerShell DSC resource MSFT_ADDomain  failed to execute Get-TargetResource functionality with error message: System.Exception: 
    Please ensure that the PowerShell module 'ADDSDeployment' is installed. (DRC0009) [0m
    At line:1 char:1
    + puppet apply .\test\install.pp --modulepath .\modules\ --verbose
    + ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
        + CategoryInfo          : NotSpecified: ([1;31mError: d... (DRC0009) [0m:String) [], RemoteException
        + FullyQualifiedErrorId : NativeCommandError
     
    [0;32mInfo: Using environment 'production'[0m
    [0;32mInfo: Applying configuration version '1666779036'[0m
    [mNotice: /Stage[main]/Main/Windowsfeature[AD-Domain-Services]/ensure: created[0m
    [mNotice: Applied catalog in 59.23 seconds[0m
    
    Each subsequent run completes without applying anything:
    PS C:\Users\Administrator\Documents> puppet apply .\test\install.pp --modulepath .\modules\ --verbose
    [mNotice: Compiled catalog for testmgndc02-uk in environment production in 0.28 seconds[0m
    [0;32mInfo: Using environment 'production'[0m
    [0;32mInfo: Applying configuration version '1666781923'[0m
    [mNotice: Applied catalog in 0.80 seconds[0m
    
    PS C:\Users\Administrator\Documents> puppet module list  --modulepath .\modules\
    C:/Users/Administrator/Documents/modules
    â"œâ"€â"€ dsc-activedirectorydsc ([0;36mv6.2.0-0-0[0m)
    â"œâ"€â"€ puppet-windowsfeature ([0;36mv4.0.0[0m)
    â""â"€â"€ puppetlabs-pwshlib ([0;36mv0.10.2[0m)
  • s

    Slackbot

    10/26/2022, 11:16 AM
    This message was deleted.
    b
    • 2
    • 1
  • s

    sameer

    10/26/2022, 11:17 AM
    Hello, we already have a production galera cluster with 3 nodes and using proxysql for load balancing in the puppet......Can i use the exisiting puppet module for testing env as well which is currently used by production galera cluster ....This is just to create a new test env to test some use cases so that we don't harm the production unit.... Note: I would add a new test node definition in manifest and add the exisiting module to it...........Please tell if this will work and doesn't cause any impact on production cluster
  • b

    Brian Schonecker

    10/26/2022, 12:16 PM
    Question for those deploying MariaDB: "Should I use the Puppet Mysql module or a mariadb-specific puppet module? Both are pretty active. Is there really that much difference? The puppet mysql module makes mention of MariaDB but it's Ubuntu centric. The mariadb module makes use of puppet-mysql but before I get too far into things, I want to ensure I'm approaching this the correct way. I'm betting the mariadb module is the right way.
  • b

    Brian Schonecker

    10/26/2022, 12:16 PM
    Question for those deploying MariaDB: "Should I use the Puppet Mysql module or a mariadb-specific puppet module? Both are pretty active. Is there really that much difference?
  • b

    Brian Schonecker

    10/26/2022, 12:18 PM
    Question for those deploying MariaDB: "Should I use the Puppet Mysql module or a mariadb-specific puppet module? Both are pretty active. Is there really that much difference? The puppet mysql module makes mention of MariaDB but it's Ubuntu centric.
  • b

    Brian Schonecker

    10/26/2022, 12:20 PM
    Question for those deploying MariaDB: "Should I use the Puppet Mysql module or a mariadb-specific puppet module? Both are pretty active. Is there really that much difference? The puppet mysql module makes mention of MariaDB but it's Ubuntu centric. The mariadb module makes use of puppet-mysql but before I get too far into things, I want to ensure I'm approaching this the correct way. I'm betting the mariadb module is the right way.
  • s

    Slackbot

    10/26/2022, 12:51 PM
    This message was deleted.
    j
    n
    • 3
    • 2
  • s

    Slackbot

    10/26/2022, 1:29 PM
    This message was deleted.
    🆘 1
    c
    a
    • 3
    • 2
  • s

    Slackbot

    10/26/2022, 2:03 PM
    This message was deleted.
    d
    f
    • 3
    • 3
  • s

    Slackbot

    10/26/2022, 6:25 PM
    This message was deleted.
    b
    c
    +2
    • 5
    • 13
  • s

    Slackbot

    10/26/2022, 7:16 PM
    This message was deleted.
    b
    s
    r
    • 4
    • 4
  • s

    sameer

    10/26/2022, 7:27 PM
    if i update the repo manually in /etc/apt/sources.list.d/proxysql_repo.list and run apt update and then puppet agent, will it install the package ?
  • s

    sameer

    10/26/2022, 7:27 PM
    message has been deleted
  • a

    Allahshukur Ahmadzada

    10/26/2022, 8:25 PM
    message has been deleted
  • w

    William Myers

    10/26/2022, 10:44 PM
    If there's a specific set of modules I want a group of machines to apply by default, I'd do that via profile correct?
  • n

    natemccurdy

    10/26/2022, 10:50 PM
    Technically, at a high level, you’d do that via the node classification process. Which is a
    node
    definition in code or via an External Node Classifier (ENC). At a lower level, and to make it convenient to do what you want, people follow the Roles and Profiles method where each node has a class from the
    role
    module applied to it via the classification process. And if there’s a common set of modules/classes/code you want to apply to a set of roles, you’d put all that into a
    profile
    class and include that profile in each role as needed.
  • w

    William Myers

    10/26/2022, 10:50 PM
    Let's say that I want to apply a few defaults specifically to linux hosts. - management agents, sshd config, service accounts, etc
  • w

    William Myers

    10/26/2022, 10:51 PM
    Trying to avoid site.pp getting pretty cluttered
  • n

    natemccurdy

    10/26/2022, 10:54 PM
    So that kind of thing is generally handled a common “base” profile or “common” profile that all nodes/roles get on them. And within that profile you can have conditional logic to apply more code based on operating system or other facts. For example:
    Copy code
    class profile::base {
    
      case $facts['os']['family'] {
        'RedHat', 'Debian' : { include profile::base::linux }
        'Windows': { include profile::base::windows }
        default: { }
      }
    
    }
    And to declare the
    profile::base
    class on all nodes, you could either explicitly add
    include profile::base
    to reach role class, or put
    include profile::base
    outside of a
    node
    definition or within the
    default
    node definition in
    site.pp
  • n

    natemccurdy

    10/26/2022, 10:55 PM
    So for your example, you’d need to also make a class called
    profile::base::linux
    that handles sshd config, service accoutns, etc…
  • g

    Greg Bristol

    10/26/2022, 10:56 PM
    that's basically how we do that stuff, just our ENC includes base and the role
1...217218219...428Latest