Keeping youtube-dl Updated with Puppet

The youtube-dl project is a swiss-army knife of video production tools. While the developers do a great job keeping the project updated, package maintainers aren’t able to keep pace. It seems like Debian’s “stable” policy might even require it to ship a version that doesn’t work? Somebody please clarify below if you know!

Anyway, the project maintainers do releases to the Python PIP infrastructure, and puppet knows how to use PIP as a package provider, so we can easily automate keeping youtube-dl updated. Here’s a simple class:

class youtube_dl {

  package { 'youtube-dl' :
    ensure   => latest,
    provider => pip3,
    require  => Package['python3-pip'],

} # class youtube_dl

Declare it for your host or template:

class { 'youtube_dl' : }

and on the next run you should see something like:

Notice: /Stage[main]/Youtube_dl/Package[youtube-dl]/ensure: ensure changed '2020.5.8' to '2020.7.28'

And, there we go – your scripts shouldn’t break anymore, or at the very worse not for longer than it takes the developers to push an update.