Search code examples
vagrantpuppet

Can't figure out how to use puppet apt module


I'm trying to provision debian box with vagrant using puppet. And I want to add postgresql repository to sources list using puppetlabs/apt module. However, whatever I try, I keep getting this error:

==> default: Syntax error at '{'; expected '}' at /etc/puppet/modules/apt/manifests/init.pp:18 on node packer-debian-7

This is what I have in my default.pp file:

include 'apt'
class { 'apt': }

apt::source { 'pgdg':
    location => 'http://apt.postgresql.org',
    repos => 'main',
    key => {
        source => 'https://www.postgresql.org/media/keys/ACCC4CF8.asc'
   },
}

Can someone tell what am I doing wrong? I'm new to puppet and ruby in general.


Solution

  • Definitely you have a problem with apt instantiation. Use class (not recommended) or include (I recommend this approach: explanation). If you use include, remove quotation marks.

    In summary, change:

    include 'apt'
    class { 'apt': }
    

    to:

    include apt