Cac3a
Cac3a

Reputation: 126

Running puppet agent for puppetlabs-apache module with sudo

I've got a ubuntu 14.04 with latest puppet agent installed. My user 'ubuntu' is part of root and sudo groups. I have password disabled for sudo and I can't get the puppet manifest to use puppetlabs-apache module. It is complaining about Permission Denied on /var/lib/dpkg/lock file. I checked the file isn't even there.

This seem as such trivial problem, but even if I run sudo puppet it is still complaining about the permission.

My manifest looks like this

node default {
        include apache

        apache::vhost { 'st.site.com':

                servername => 'st.site.com',
                port    => '80',
                docroot => '/var/www/html/sources/prod/',
                docroot_owner => 'www-data',
                docroot_group => 'www-data',
            }   
}

How can I enable to run it with sudo privileges ?

The part that it is blowing up on is (when I run it manually with sudo it does work fine)

 /usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install apache2

The error that I get is :

Error: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install apache2' returned 100: E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?
Error: /Stage[main]/Apache/Package[httpd]/ensure: change from purged to present failed: Execution of '/usr/bin/apt-get -q -y -o DPkg::Options::=--force-confold install apache2' returned 100: E: Could not open lock file /var/lib/dpkg/lock - open (13: Permission denied)
E: Unable to lock the administration directory (/var/lib/dpkg/), are you root?

Upvotes: 0

Views: 273

Answers (1)

Cac3a
Cac3a

Reputation: 126

I think I found my own answer in the documentation. Need to install agent as root or run it as root. As simple as that....

Upvotes: 1

Related Questions