Puppet 使用不同的用户运行多个

Puppet 使用不同的用户运行多个

我有个问题,在 puppet 中是否可以以不同的用户身份执行操作,例如我想以 root 身份安装 git、vim、curl,并以 vagrant 身份安装 postgresql。可以这样做吗?

class apt_update {
        exec { "aptGetUpdate":
                command => "sudo apt-get update",
                path => ["/bin", "/usr/bin"],
                user => root,
        }
}

class othertools {
        package { "git":
              ensure => latest,
              require => Exec["aptGetUpdate"],

        }

        package { "vim-common":
              ensure => latest,
              require => Exec["aptGetUpdate"],
        }

        package { "curl":
              ensure => present,
              require => Exec["aptGetUpdate"],
        }

        package { "htop":
                ensure => present,
                require => Exec["aptGetUpdate"],
        }
}


node "vagrant-ubuntu-trusty-64" {

        include apt_update
        include redis
        include mongoose
        include othertools

        class { 'postgresql::globals': }
        class { 'postgresql::server':
                ip_mask_allow_all_users    => '0.0.0.0/0',
                ipv4acls                   => ['host    all     postgres        127.0.0.1/32    trust'],
                listen_addresses           => '*',
                postgres_password          => '12345',
        }
        postgresql::server::db { 'springfruit_dev':
                user     => 'chat_app',
                password => postgresql_password('chat_app', '12345')
        }

}

PS 我知道可以以 root 身份运行execfile问题是其他东西呢?

相关内容