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

    vchepkov

    07/15/2022, 4:12 PM
    Copy code
    class ntp (
      String $service_name,
    ) {
      file { '/some/file':
        content => epp("${module_name}/template.epp, {
          service_name => $service_name,
        )}
      }
    }
  • v

    vchepkov

    07/15/2022, 4:13 PM
    Copy code
    class ntp (
      String $service_name,
    ) {
      file { '/some/file':
        content => epp("${module_name}/template.epp, {
          service_name => $service_name,
        )}
      }
    }
  • j

    Jason Grammenos

    07/15/2022, 4:18 PM
    i would, but i am still using erb templates
  • j

    Jason Grammenos

    07/15/2022, 4:19 PM
    and trying to lookup a value that isnt automatic lookup
  • v

    vchepkov

    07/15/2022, 4:24 PM
    Copy code
    $manifest_variable = lookup('ntp::service_name')
    
    .erb
    <%= @manifest_variable %>
  • j

    Jason Grammenos

    07/15/2022, 4:24 PM
    ok, that makes sense. so there is no way to do it directly in erb?
    🤷 1
  • j

    Jason Grammenos

    07/15/2022, 4:26 PM
    @vchepkov thank you for your assistance
  • j

    Jason Grammenos

    07/15/2022, 4:27 PM
    @vchepkov ++
    👍 1
  • d

    Dr Bunsen Honeydew

    07/15/2022, 4:27 PM
    vchepkov leveled up! (Karma: 7)
  • s

    Skylar Thompson

    07/15/2022, 4:30 PM
    If you didn't want to copy the
    lookup
    boiler-plate to every class that uses the template, you could write a function that accepts whatever other parameters need to be in-scope for the template, does the
    lookup
    , and then renders the template.
  • n

    natemccurdy

    07/15/2022, 4:39 PM
    You can technically do the
    lookup()
    in an ERB template, but I’m not going to recommend that. IMO, your ERB templates should be dumb and as simple as possible, only taking inputs from a single place and scope (which ideally would be where the
    template()
    function is called). Adding another data lookup inside the template itself muddies the waters and makes things harder to troubleshoot and refactor.
    💯 3
  • n

    natemccurdy

    07/15/2022, 4:39 PM
    You can technically do the
    lookup()
    in an ERB template, but I’m not going to recommend that. IMO, your ERB templates should be dumb and as simple as possible, only taking inputs from a single place and scope (which ideally would be where the
    template()
    function is called). Adding another data lookup inside the template itself muddies the waters and makes things harder to troubleshoot and refactor.
  • j

    jhoblitt

    07/15/2022, 5:13 PM
    EL8, I hate you.
    error while loading shared libraries: libreadline.so.6: cannot open shared object file: No such file or directory
  • j

    jhoblitt

    07/15/2022, 5:14 PM
    EL8, I hate you.
    error while loading shared libraries: libreadline.so.6: cannot open shared object file: No such file or directory
  • j

    jhoblitt

    07/15/2022, 5:16 PM
    Why doesn't such a common library use symbol versions?
  • v

    vchepkov

    07/15/2022, 5:18 PM
    puppet can't help for sure 😎
  • j

    jhoblitt

    07/15/2022, 5:18 PM
    oh, it can... it is going to install a symlink...
  • s

    Slackbot

    07/15/2022, 7:11 PM
    This message was deleted.
    n
    c
    g
    • 4
    • 4
  • r

    romil surti

    07/15/2022, 9:30 PM
    message has been deleted
  • s

    Slackbot

    07/15/2022, 9:32 PM
    This message was deleted.
    n
    r
    • 3
    • 7
  • r

    romil surti

    07/15/2022, 10:15 PM
    We use open-source puppet and we use puppetdb. This log from the vm console where puppet run and apply catalog and right after that it showed this sql error
    Copy code
    <vm hostname>
    Info: Using configured environment 'pre_prod'
    Info: Retrieving pluginfacts
    Info: Retrieving plugin
    Info: Loading facts
    Info: Caching catalog for <vm hostname>
    Info: Applying configuration version '<config version>'
    Notice: /Stage[main]/Profiles::Base::Linux::Sudo/Exec[chmod 0440 *]/returns: executed successfully (corrective)
    Notice: Applied catalog in 4.43 seconds
    Fri Jul 15 20:14:22 GMT 2022
    ERROR [execute-4]: HHH000315: Exception executing batch [java.sql.BatchUpdateException: Duplicate entry 'a0750v2rapp0441-91c6d8c9-4071-4d86-b1f7-74554d416558' for key 'PRIMARY'], SQL: insert into resource_log (exit_status, system_user, timer, time_stamp, resource_name, run_id) values (?, ?, ?, ?, ?, ?)
    ERROR [execute-4]: Duplicate entry 'a0750v2rapp0441-91c6d8c9-4071-4d86-b1f7-74554d416558' for key 'PRIMARY'
    ERROR [execute-4]: javax.persistence.PersistenceException: org.hibernate.exception.ConstraintViolationException: could not execute batch
  • n

    natemccurdy

    07/15/2022, 10:20 PM
    Can you try a manual Puppet run but add
    --http_debug
    to it, then see if that SQL error comes back? e.g.
    Copy code
    sudo puppet agent -t --http_debug
  • s

    sameer

    07/17/2022, 9:48 AM
    message has been deleted
  • s

    Slackbot

    07/17/2022, 9:49 AM
    This message was deleted.
    b
    s
    +2
    • 5
    • 8
  • s

    sameer

    07/17/2022, 9:51 AM
    So i would like to remove unwanted files ( /var/cache and old kernels in /boot) to free up some space using puppet script and add this script to puppet master to automatically run once every month. I am new to puppet and would like your help with the below script to be corrected if wrong. exec { 'apt-autoremove': command => '/usr/bin/apt autoremove' age => ‘1m’ } exec { 'apt-clean': command => '/usr/bin/apt clean' age => ‘1m’ } Thanks
  • s

    sameer

    07/17/2022, 9:52 AM
    So i would like to remove unwanted files ( /var/cache and old kernels in /boot) to free up some space using puppet script and add this script to puppet master to automatically run once every month. I am new to puppet and would like your help with the below script to be corrected if wrong. exec { 'apt-autoremove': command => '/usr/bin/apt autoremove', age => ‘1m’, recurse => 1, } exec { 'apt-clean': command => '/usr/bin/apt clean', age => ‘1m’, recurse => 1, } Thanks
  • m

    Moe

    07/17/2022, 5:46 PM
    Systemd has a builtin functionality for exactly this usecase. I would try to utilize this instead of building your own solution. https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html Err sorry I misread your question. Nothing to see here 😄
  • i

    it is just display name

    07/18/2022, 4:01 PM
    message has been deleted
  • i

    it is just display name

    07/18/2022, 4:02 PM
    message has been deleted
  • i

    it is just display name

    07/18/2022, 5:02 PM
    message has been deleted
1...979899...428Latest