0

I'm using vagrant to build a virtual environment. I have some question about provisioning with puppet. I understood that I can create modules on my own or to use existing modules (for example puppet forge ones). To use existing modules i follow this approach: In Vagrant file I install modules I need

config.vm.provision :shell do |shell|
      shell.inline = "mkdir -p /etc/puppet/modules;
                      puppet module install puppetlabs-postgresql"

and then in /puppet/manifest/site.pp

node 'db' {

class { 'postgresql::server':
   listen_addresses           => '*',
   postgres_password          => 'postgres',}

postgresql::server::db { 'music':
    user     => 'post',
    password => postgresql_password('post', 'post'),}

postgresql::server::pg_hba_rule { 'allow application network to access database':
    description =>....}}

I have many VM so I have to declare in this file the conf I need for each of them. Is this a valid way to proceed in using existing puppet modules? Or there is any kind of different pattern to follow?

TrinitasXVII
  • 61
  • 1
  • 6

1 Answers1

1

If you have different VM to setup with different configuration, you should look at hiera to extract the config into a yaml and reference each node configuration into the puppet file.

Frederic Henri
  • 51,761
  • 10
  • 113
  • 139