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

    todd.seidenberg

    01/18/2023, 3:43 PM
    wow. ok.
  • t

    todd.seidenberg

    01/18/2023, 3:43 PM
    i did not know this. And now i do.
    👍 1
  • t

    todd.seidenberg

    01/18/2023, 3:44 PM
    ok - i'll report back if I have issues.
  • v

    vchepkov

    01/18/2023, 3:46 PM
    same with other resources, say you include class chrony in your profile class. you need to contain chrony class within profile class if you expect resources created by chrony class to follow relationship of the profile
  • d

    David Sandilands

    01/18/2023, 3:48 PM
    @todd.seidenberg see https://www.puppet.com/docs/puppet/7/lang_containment.html for details
    👍 1
  • s

    Slackbot

    01/18/2023, 3:49 PM
    This message was deleted.
    t
    v
    • 3
    • 90
  • n

    Neeloj

    01/18/2023, 4:02 PM
    @Yury Bushmelev of course, I leave the file custom.conf on the server and I use the ignore attribute suggestion.
    Copy code
    file { 'copy_check_test':
                      ensure             => 'directory',
                      source             => 'puppet:///modules/check_test',
                      path               => '/etc/check_test',
                      ignore               => 'custom.conf',
    }
    file { 'create_custom_conf':
                            ensure             => file,
                            path               => '/etc/check_test/custom.conf',
                            replace            => false,
                            source             => 'puppet:///modules/check_test/custom.conf',
                            require => File['copy_check_test'],
    }
    So not puppet will copy the directory content to /etc/check_test and overwrite it every time except ( ignore ) the custom.conf file By second file resource type I copy the custom.conf file to the /etc/check_test Now the second run for puppet agent -t the all files will be overwritten in /etc/check_test except custom.conf
  • y

    Yury Bushmelev

    01/18/2023, 4:16 PM
    it is
    path
    for the
    file
    resource.. other resources have other “namevars” (e.g. it is
    name
    for
    package
    resource)
  • y

    Yury Bushmelev

    01/18/2023, 4:20 PM
    there is “namevars and name” chapter below too
  • n

    Neeloj

    01/18/2023, 4:20 PM
    You are right thank you, And here you can see it https://www.puppet.com/docs/puppet/7/types/file.html#file-attribute-path path: (Namevar: If omitted, this attribute's value defaults to the resource's title.) Namevars :-) I’ll change my code to use namevars :-) thank you so much @Yury Bushmelev
  • r

    rismoney

    01/18/2023, 4:31 PM
    wasn't sure i saw this in operators- is there a not in array syntax?
  • r

    rismoney

    01/18/2023, 4:34 PM
    Copy code
    ! ($var in [ 'one', 'two' ]) # guess i could do this
  • n

    natemccurdy

    01/18/2023, 5:20 PM
    @rismoney In that case, I'd usually use
    unless
    which is the equivalent of "if not". For example:
    Copy code
    $array = ['cat', 'dog', 'mouse']
    
    if 'dog' in $array {
      notice('dog is in the array')
    }
    
    unless 'rabbit' in $array {
      notice('rabbit is not in the array')
    }
    Copy code
    $ puppet apply example.pp
    Notice: Scope(Class[main]): dog is in the array
    Notice: Scope(Class[main]): rabbit is not in the array
  • n

    natemccurdy

    01/18/2023, 5:21 PM
    @rismoney In that case, I'd usually use
    unless
    which is the equivalent of "if not". For example:
    Copy code
    $array = ['cat', 'dog', 'mouse']
    
    if 'dog' in $array {
      notice('dog is in the array')
    }
    
    unless 'rabbit' in $array {
      notice('rabbit is not in the array')
    }
    Copy code
    $ puppet apply example.pp
    Notice: Scope(Class[main]): dog is in the array
    Notice: Scope(Class[main]): rabbit is not in the array
  • n

    natemccurdy

    01/18/2023, 5:23 PM
    If you don't want to use
    unless
    , then yeah, what you mentioned will also work as long as you make sure you're negating the correct part of the expression (which you did, and which in this case is the result of
    <foo> in $array
    ): For example:
    Copy code
    if !('rabbit' in $array) {
      notice('rabbit is not in the array')
    }
  • n

    natemccurdy

    01/18/2023, 5:24 PM
    If you don't want to use
    unless
    , then yeah, what you mentioned will also work as long as you make sure you're negating the correct part of the expression (which you did): For example:
    Copy code
    if !('rabbit' in $array) {
      notice('rabbit is not in the array')
    }
  • n

    natemccurdy

    01/18/2023, 5:26 PM
    If you don't want to use
    unless
    , then yeah, what you mentioned will also work as long as you make sure you're negating the correct part of the expression (which you did, and which in this case is the result of
    <foo> in $array
    ): For example:
    Copy code
    if !('rabbit' in $array) {
      notice('rabbit is not in the array')
    }
  • t

    todd.seidenberg

    01/18/2023, 6:58 PM
    so the first hint is the anything from the Ivanti class
  • p

    Pat Riehecky

    01/18/2023, 6:59 PM
    PQL question: I've got a structured fact:
    Copy code
    my_subsystems:
    - ssh
    - nginx
    - nfsclient
    How do I write a query that will find the
    fqdn
    of all hosts with
    my_subsystems=nginx
    I've tried
    ["from", "facts", ["and", ["=", "name", "my_subsystems"], ["=", "value", "nginx"]]]
    but that returns no results, but
    ["from", "facts", ["and", ["=", "name", "my_subsystems"]]
    shows the fact is in the DB and listed as an array
  • t

    todd.seidenberg

    01/18/2023, 7:03 PM
    and its not
  • s

    Slackbot

    01/18/2023, 7:06 PM
    This message was deleted.
    p
    n
    • 3
    • 2
  • n

    natemccurdy

    01/18/2023, 7:07 PM
    @Pat Riehecky Have you tried this?
    Copy code
    puppet query 'inventory[certname] { "nginx" in facts.my_subsystems }"
  • p

    Pat Riehecky

    01/18/2023, 7:07 PM
    Interesting, that syntax escaped my notice
  • n

    natemccurdy

    01/18/2023, 7:07 PM
    @Pat Riehecky Have you tried this?
    Copy code
    puppet query 'inventory[certname] { "nginx" in facts.my_subsystems }'
  • s

    Slackbot

    01/18/2023, 7:08 PM
    This message was deleted.
    n
    • 2
    • 1
  • b

    brokencode

    01/18/2023, 7:09 PM
    Hey guys. Is it possible to have hiera and eyaml hiera content in the same file? At the moment, we have separate eyaml files for encrypted variables but then there are problems with YAML hashes that are not merged (I know hiera supports merges, but than it's another thing users have to be careful about). Can I have encrypted and non-encrypted content in a single YAML file for hiera?
  • n

    natemccurdy

    01/18/2023, 7:10 PM
    @brokencode Yes, definitely possible. Use the eymal backend exclusively. It can handle both yaml and eyaml files and encrypted and non-encrypted values within the same file, no problem.
    👍 1
  • b

    brokencode

    01/18/2023, 7:10 PM
    Thanks!
  • s

    Slackbot

    01/18/2023, 7:18 PM
    This message was deleted.
    g
    l
    b
    • 4
    • 21
  • g

    gary

    01/18/2023, 7:19 PM
    I've run into a situation when using a module with its core fact is preventing a custom fact from using the external fact (overriding said module core fact) with
    Facter.value
    . Any ideas whats going on / what am I doing wrong? Note this is only when I set the external fact (/etc/facter/facts.d/fact.json). The custom fact work fine when running without the module. Pasting snippets in this thread so I don't spam everyone.
1...278279280...428Latest