Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Installing docker-ce through puppet

Tags:

docker

puppet

Im trying to install docker-ce through puppet and i have a couple of questions.

1: Does apt::key automatically do a 'apt-get update' afterwards?

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 would i use the apt::ppa to include distribution and release?

This is the whole puppet 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 using the 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}
}
like image 485
A.Jac Avatar asked Oct 18 '25 03:10

A.Jac


1 Answers

Here's how I'm installing this:

  apt::key { '9DC858229FC7DD38854AE2D88D81803C0EBFCD88':
    source => 'https://download.docker.com/linux/ubuntu/gpg',
  } ->
  apt::source { 'docker-ce':
    architecture => 'amd64',
    location     => 'https://download.docker.com/linux/ubuntu',
    repos        => 'stable',
    release      => $::lsbdistcodename,
  } ->
  package { 'docker-ce':
    ensure  => 'latest',
    require => Exec['apt_update'],
  }
like image 108
Anthony Sottile Avatar answered Oct 20 '25 18:10

Anthony Sottile