Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Defining vhosts in Hiera #566

Closed
stevelacey opened this issue Feb 8, 2015 · 4 comments
Closed

Defining vhosts in Hiera #566

stevelacey opened this issue Feb 8, 2015 · 4 comments

Comments

@stevelacey
Copy link

I am probably just doing Hiera wrong... but this does nothing for me:

hiera/common.yaml:

---
nginx::config::worker_processes: "%{::processorcount}"

nginx::nginx_vhosts:
  "%{::fqdn}":
    www_root: "/var/www/%{::fqdn}"

In my node:

include nginx
include nginx::config

I think the Hiera is at least right my worker_processes gets set, and the following is returned if I run this on the master:

hiera -c /etc/puppet/current/hiera.yaml nginx::nginx_vhosts ::fqdn=test 
=> {"test"=>{"www_root"=>"/var/www/test"}}

Do I need to define something specific to the vhost or vhosts in general in my manifest to trigger it pulling in the vhost settings? nginx::resource::vhost { $::fqdn: } moans about no params passed – i.e. it can't see the www_root.

jennifer-lawrence-shrugging-gif

@stevelacey stevelacey changed the title Hiera .. not following Defining vhosts in Hiera Feb 8, 2015
@stevelacey
Copy link
Author

So either I am missing the point, or you have to do this:

  class { "nginx":
    geo_mappings          => hiera("nginx::geo_mappings", {}),
    string_mappings       => hiera("nginx::string_mappings", {}),
    nginx_locations       => hiera("nginx::nginx_locations", {}),
    nginx_mailhosts       => hiera("nginx::nginx_mailhosts", {}),
    nginx_upstreams       => hiera("nginx::nginx_upstreams", {}),
    nginx_vhosts          => hiera("nginx::nginx_vhosts", {}),
    nginx_vhosts_defaults => hiera("nginx::nginx_vhosts_defaults", {}),
  }

  include nginx::config

Either I am doing things wrong, and if so, please correct me… or seriously, document this, in the README, or hiera doc file, in big ass letters.

I assume these aren't the defaults as it would cause hiera-less users errors?

@samchang-iit
Copy link

I seem to have had something similar, and i fixed it by changing
include nginx
to
include ::nginx

@wyardley
Copy link
Collaborator

wyardley commented Oct 8, 2016

@stevelacey: is this still a problem, or can we close this out?

@stevelacey
Copy link
Author

I don't use Puppet anymore, so it's not a problem for me at least 😉

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants