Alex Bain
Alex Bain

Reputation: 801

Vagrant + Chef Solo not using Apache attributes

I'm trying to provision a CentOS box using Vagrant and Chef Solo. I've specified some attributes I would like the apache2 cookbook to use but it does not appear to be using them.

Here's what I've added in my Vagrantfile:

chef.json.merge!(
  'apache2' => {
    'user' => 'testuser',
    'group' => 'testgroup',
    'dir' => '/custom',
    'log_dir' => '/custom/logs/http',
    'default_site_enabled' => false
  }
)

chef.add_recipe "apache2"

Yet, after running vagrant up the apache cookbook has ignored all of the attributes I've specified. I've tried using both apache and apache2 as the key.

Am I missing something simple? Thanks!

Upvotes: 2

Views: 1758

Answers (1)

axsuul
axsuul

Reputation: 7480

This should merge the attributes into the node.

chef.json = {
  'apache2' => {
    'user' => 'testuser',
    'group' => 'testgroup',
    'dir' => '/custom',
    'log_dir' => '/custom/logs/http',
    'default_site_enabled' => false
  }
}

And this is how you would access it.

node['apache2']['user']  # => testuser

Upvotes: 3

Related Questions