Search code examples
ubuntupuppetspotifyapt

Install spotify-client on Ubuntu using puppet via Apt module


What puppet code do I need to install the spotify-client on Ubuntu using puppet's Apt module?

The spotify installation instructions are:

  1. Add the Spotify repository signing key to be able to verify downloaded packages sudo apt-key adv --keyserver hkp://keyserver.ubuntu.com:80 --recv-keys BBEBDCB318AD50EC6865090613B00F1FD2C19886

  2. Add the Spotify repository echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list

  3. Update list of available packages sudo apt-get update

  4. Install Spotify sudo apt-get install spotify-client

To add a repository (Step 1), Puppet's Apt module says to do this:

apt::key { 'spotify':
    id      => 'BBEBDCB318AD50EC6865090613B00F1FD2C19886',
    server  => 'hkp://keyserver.ubuntu.com:80',
}

However, I'm not sure how to do step 2, and add the repository. How do I translate this: echo deb http://repository.spotify.com stable non-free | sudo tee /etc/apt/sources.list.d/spotify.list into my puppet manifest using Apt?


Solution

  • You can actually use the apt module to create the apt source files, rather than having to manage them manually as files.

    Something like this should work:

    apt::key { 'spotify':
      id      => 'BBEBDCB318AD50EC6865090613B00F1FD2C19886',
      server  => 'hkp://keyserver.ubuntu.com:80',
    }
    ->
    apt::source {'spotify':
      location => "http://repository.spotify.com",
      release => "stable",
      repos => "non-free",
    }
    ->
    package {'spotify-client':
      ensure => "installed",
    }