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

    tuxmea

    04/21/2023, 10:06 AM
    I need some Ruby help: https://github.com/puppetlabs/puppetlabs-apt/blob/main/lib/puppet/provider/apt_key/apt_key.rb#L194
  • t

    tuxmea

    04/21/2023, 10:07 AM
    does
    false && true
    evaluate to true or false?
  • y

    Yury Bushmelev

    04/21/2023, 10:07 AM
    should be false from my understanding..
  • y

    Yury Bushmelev

    04/21/2023, 10:08 AM
    AND gives you true only if both args are true
  • y

    Yury Bushmelev

    04/21/2023, 10:08 AM
    Hint: I’m using
    irb
    to check if I’m not sure
  • t

    tuxmea

    04/21/2023, 10:08 AM
    Which means that the first if clause will never be used?
  • y

    Yury Bushmelev

    04/21/2023, 10:10 AM
    .nil?
    and `""`/`{}`/`[]` are different
  • y

    Yury Bushmelev

    04/21/2023, 10:10 AM
    I’m not sure what is the value there usually
  • t

    tuxmea

    04/21/2023, 10:10 AM
    source has a value, content does not have a value
  • y

    Yury Bushmelev

    04/21/2023, 10:11 AM
    let me craft something in irb
  • y

    Yury Bushmelev

    04/21/2023, 10:20 AM
    sorry, my asdf ruby installation seems broken.. reinstalling 🙂
  • y

    Yury Bushmelev

    04/21/2023, 10:21 AM
    actually, yes, if either
    source
    or
    content
    is set 1st clause is not used
  • y

    Yury Bushmelev

    04/21/2023, 10:22 AM
    though
    source
    or
    content
    can be set to an empty value.. then I’m not sure where it’ll end up (one of those elsifs or else)
  • b

    binford2k

    04/21/2023, 5:40 PM
    added an integration to this channel: linen.dev
  • v

    vchepkov

    04/21/2023, 5:48 PM
    use the pattern in @Yorokobi example and all will be zen
  • k

    Ken

    04/21/2023, 5:50 PM
    part of my issue earlier was that the puppet documentation mentions that the 'elseif' is 'elsif' https://www.puppet.com/docs/puppet/7/lang_conditional.html
  • n

    natemccurdy

    04/21/2023, 5:58 PM
    I don't see
    elseif
    in that document.
  • k

    Ken

    04/21/2023, 6:09 PM
    what I meant was elsif doesn't work. but, moving on! now that I've got my conditional statement hammered out (thanks @natemccurdy!) how do I insert my '$vip' variable into a file? I've tried this every way I can find on the internet. Here's my latest attempt file_line { "/etc/rc.conf": # line => 'ifconfig_em0_alias0="inet vhid 10 pass supersecret 192.168.1.245/24" ', line => 'ifconfig_em0_alias0="inet vhid 10 pass supersecret %{vip}" ', path => "/etc/rc.conf", } and results of all attempts: ifconfig_em0_alias0="inet vhid 10 pass supersecret 192.168.1.245/24" ifconfig_em0_alias0="inet vhid 10 pass supersecret $vip" ifconfig_em0_alias0="inet vhid 10 pass supersecret ${vip}" ifconfig_em0_alias0="inet vhid 10 pass supersecret $::{vip}" ifconfig_em0_alias0="inet vhid 10 pass supersecret %{::vip}" ifconfig_em0_alias0="inet vhid 10 pass supersecret %{vip}"
  • v

    vchepkov

    04/21/2023, 6:10 PM
    short answer - you don't :)
  • v

    vchepkov

    04/21/2023, 6:11 PM
    manage file in it's entirety is the best approach
  • v

    vchepkov

    04/21/2023, 6:11 PM
    if rc.conf is an ini file, you can use puppetlabs/inifile
  • d

    Dr Bunsen Honeydew

    04/21/2023, 6:11 PM
    See the
    puppetlabs-inifile
    module at https://forge.puppet.com/puppetlabs/inifile?src=slack&channel=puppet
  • k

    Ken

    04/21/2023, 6:12 PM
    but...but...all my servers will require an entirely seperate file, isn't the whole point of heira is to variabilize the one or two things in a file that are different?
  • s

    Slackbot

    04/21/2023, 6:13 PM
    This message was deleted.
    k
    v
    • 3
    • 10
  • v

    vchepkov

    04/21/2023, 6:14 PM
    and that's not a point of hiera
  • v

    vchepkov

    04/21/2023, 6:14 PM
    that what templates are for
  • v

    vchepkov

    04/21/2023, 6:15 PM
    good reading - https://dev.to/camptocamp-ops/how-to-manage-files-with-puppet-55e4
    🙌 1
  • d

    Dagan McGregor

    04/24/2023, 3:30 AM
    Is it possible to use a settings value inside a manifest to be able to reference Puppet config? I am looking at using
    file_line
    to set value in
    puppet.conf
    , can I use the
    $confdir
    or
    $config
    values for the file path?
  • d

    Dagan McGregor

    04/24/2023, 3:31 AM
    https://www.puppet.com/docs/puppet/7/configuration.html#confdir
  • d

    Dagan McGregor

    04/24/2023, 3:35 AM
    We previously used
    ::settings::confdir
    but I don't know if that is supported
1...352353354...428Latest