Installing docker-ce via puppet

I am trying to install docker-ce via puppet and I have a couple of questions.

1: Does apt :: key automatically update apt-get after that?

2: How can I use the apt: ppa module to add the docker-ce repository ? this is done with:

sudo add-apt-repository \
   "deb [arch=amd64] https://download.docker.com/linux/ubuntu \
   $(lsb_release -cs) \
   stable"

      

But how can I use apt :: ppa to enable distribution and release?

This is the whole doll block:

class docker {

  $prerequisites = ['apt-transport-https', 'ca-certificates', 'curl']
  package { $prerequisites: ensure => installed}

  apt::key { 'docker-ce':
    ensure    => present,
    id        => '9DC858229FC7DD38854AE2D88D81803C0EBFCD88',
    options   => 'https://download.docker.com/linux/ubuntu/gpg',
  }

  apt::ppa {''}

  package {'docker-ce': ensure  => installed}
}

      

EDIT:

Ended up with apt module with apt :: source, hardcoded release because I know all my systems will run it.

class docker {
  include apt

  $prerequisites = ['apt-transport-https', 'ca-certificates']
  package { $prerequisites: ensure => installed} ->

  apt::key { 'docker-ce':
     ensure    => present,
     id        => '9DC858229FC7DD38854AE2D88D81803C0EBFCD88',
     options   => 'https://download.docker.com/linux/ubuntu/gpg',
  } ->

  apt::source {'docker-ce':
     location  => 'https://download.docker.com/linux/ubuntu',
     release   => 'xenial'
  } ->

  exec { 'apt-get-update':
     command   => '/usr/bin/apt-get update'
  } ->

  package {'docker-ce': ensure  => installed}
}

      

+3


source to share


1 answer


This is how I set it up:



  apt::key { '9DC858229FC7DD38854AE2D88D81803C0EBFCD88':
    source => 'https://download.docker.com/linux/ubuntu/gpg',
  } ->
  apt::source { 'docker-ce':
    architecture => 'amd64',
    location     => 'https://download.docker.com/linux/ubuntu',
    release      => "${::lsbdistcodename} stable",
  } ->
  package { 'docker-ce':
    ensure  => 'latest',
    require => Exec['apt_update'],
  }

      

+2


source







All Articles