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

    Slackbot

    06/08/2023, 6:26 PM
    This message was deleted.
    s
    d
    +2
    • 5
    • 12
  • d

    Dr Bunsen Honeydew

    06/08/2023, 6:26 PM
    See the
    razorsedge-network
    module at https://forge.puppet.com/razorsedge/network?src=slack&channel=puppet
  • s

    Slackbot

    06/08/2023, 6:33 PM
    This message was deleted.
    r
    c
    v
    • 4
    • 20
  • c

    CVQuesty

    06/08/2023, 6:36 PM
    you have to explicitly declare the removal. So, if you did something like
    Copy code
    package { 'foo':
      ensure => 'installed',
    }
    You have to intentionally remove it:
    Copy code
    package { 'foo':
      ensure => 'absent',
    }
  • c

    Code_Bleu

    06/08/2023, 6:36 PM
    I did, but it left the other dependency packages
  • c

    CVQuesty

    06/08/2023, 6:37 PM
    Puppet can’t be responsible for the underlying OS package manager’s operation. All Puppet does is “Hey, OS. Tell your package manager to remove nginx”. After that, it’s out of Puppet’s hands. The OS just says “0" or “1” back to indicate whether the request was succesaful or not
  • c

    Code_Bleu

    06/08/2023, 6:39 PM
    I get it, but I'm new to puppet and am use to Ansible. What is the proper way to completely uninstall a package and its dependencies with Puppet then?
  • c

    CVQuesty

    06/08/2023, 6:39 PM
    I’m digging through the nginx module to see what it might take as options
  • c

    CVQuesty

    06/08/2023, 6:40 PM
    same with Ansible. If you use ansible to install nginx and then tell it to remove it, all ansible will do is talk to yum/dnf or apt and do the same thing.
  • s

    Slackbot

    06/08/2023, 6:41 PM
    This message was deleted.
    s
    c
    • 3
    • 2
  • c

    CVQuesty

    06/08/2023, 6:42 PM
    You MIGHT get some further help by doing:
    Copy code
    class { 'nginx':
      package_ensure => 'absent',
    }
  • c

    Code_Bleu

    06/08/2023, 6:42 PM
    Thanks. Where is the best place to find info about the nginx module you were talking about?
  • c

    CVQuesty

    06/08/2023, 6:43 PM
    first, you can find basic information at forge.puppetlabs.com
  • c

    CVQuesty

    06/08/2023, 6:44 PM
    Onve you look through the docs on the module, if you’re not getting any joy, you can go to the developer’s git repo and look at the options that the module will take. I’m here: https://github.com/voxpupuli/puppet-nginx/blob/master/manifests/init.pp#L200
  • c

    CVQuesty

    06/08/2023, 6:44 PM
    I went there to see how Puppet was actually doing the install. The parameter is set to a default of “installed”, so I surmised the opposite
  • c

    CVQuesty

    06/08/2023, 6:56 PM
    it doesn't understand the option "purge"
  • s

    smortex

    06/08/2023, 6:59 PM
    https://www.puppet.com/docs/puppet/7/types/package.html#package-attribute-ensure
  • s

    smortex

    06/08/2023, 6:59 PM
    "purged"
  • c

    CVQuesty

    06/08/2023, 7:00 PM
    HAH! I was just about to paste that URL in
  • s

    smortex

    06/08/2023, 7:00 PM
    But this remove config, not unneeded dependencies.
    ✅ 1
  • c

    Code_Bleu

    06/08/2023, 7:00 PM
    with purged it does the same thing. Not removing everything.
  • s

    smortex

    06/08/2023, 7:01 PM
    in my config, unattended-upgrades does remove automatic packages, but it might not fit your use case
    ☝🏻 1
    ☝️ 1
  • c

    Code_Bleu

    06/08/2023, 7:03 PM
    @smortex I just want a simple uninstall of package with dependencies is all 🙂 I would have thought this would have been simpler than this.
  • s

    smortex

    06/08/2023, 7:05 PM
    It's not the way the provider work unfortunately (for good reasons I guess). From a reporting point of view, puppet removing 'foobar' because it is needed by no other packages should be part of managing which resource?
  • s

    smortex

    06/08/2023, 7:06 PM
    The simple solution is to orchestrate the removal of orphan packages.
  • s

    smortex

    06/08/2023, 7:07 PM
    Another one is to have a resource that ensure that no package is orphan (exec? hugh 😢)
  • c

    Code_Bleu

    06/08/2023, 7:08 PM
    OK, I figured out "A" solution for now:
    node 'puppet.puppetlab.local' {
    $packages = ['nginx', 'nginx-core', 'nginx-common']
    package { $packages:
    ensure => 'purged',
    }
    service { 'nginx':
    ensure => stopped,
    enable => false
    }
    }
  • r

    ramindk

    06/08/2023, 7:09 PM
    Can't you set autoremove policy in /etc/apt/ so it runs every time you interact with apt? Or am I misremembering?
  • r

    ramindk

    06/08/2023, 7:18 PM
    /etc/apt/apt.conf.d/99_local_policy
    Copy code
    APT::Install-Recommends "false";
    APT::Install-Suggests "false";
    APT::Delete-Unused "true";
    something like this solves it for everything though might be a bit heavy handed. https://www.debian.org/doc/manuals/aptitude/ch02s05s05.en.html#configAptPurge-Unused if you want to live dangerously. Probably fine for dev environments.
1...373374375...428Latest