Ask Your Question
0

How do I add a new virtual host via hiera?

asked 2013-10-12 16:00:52 -0500

phirschybar gravatar image

updated 2013-10-12 16:03:07 -0500

Hello, I have the following hiera config file which was generated from https://puphpet.com/ for a vagrant installation. I am confused about how to add a new virtual host and then also how to apply the changes to the server so apache is aware of the new vhost. Here is my config:


    vagrantfile-local:
        vm:
            box: wheezy64
            box_url: 'http://puppet-vagrant-boxes.puppetlabs.com/debian-70rc1-x64-vbox4210.box'
            hostname: null
            network:
                private_network: 192.168.56.101
                forwarded_port:
                    vAUUYsqDOPih:
                        host: ''
                        guest: ''
            provider:
                virtualbox:
                    modifyvm:
                        name: canary-mine-shaft
                        natdnshostresolver1: on
                        memory: '512'
                    setextradata:
                        VBoxInternal2/SharedFoldersEnableSymlinksCreate/v-root: 1
            provision:
                'shell, :path': shell/librarian-puppet-vagrant.sh
                'shell, :inline': 'if [[ ! -f ...
(more)
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2013-10-15 14:15:02 -0500

GregLarkin gravatar image

updated 2013-10-17 13:16:13 -0500

You can add more vhosts to the common.yaml by duplicating the vhost section like so (new vhost here is "next1.dev"):

vhosts:
    iiJyIDUHYIB8:
        servername: awesome.dev
        serveraliases:
            - www.awesome.dev
        docroot: /var/www/awesome
        directories:
            path1:
              path: /var/www/awesome
              allow_override: all
        port: '80'
        setenv:
            - 'APP_ENV dev'
    9M7chQ0DcUuQ:
        servername: next1.dev
        serveraliases:
            - next1.dev
        docroot: /var/www/next1
        directories:
            path1:
              path: /var/www/next1
              allow_override: all
        port: '80'
        setenv:
            - 'APP_ENV dev'

Assuming Puppet reads this Hiera data file at each run, I would expect it to configure Apache correctly and restart it so it picks up the new vhost ... (more)

edit flag offensive delete link more

Comments

Follow up Question - How do I add Allow_Override all in this configuration.

faffyman gravatar imagefaffyman ( 2013-10-17 06:50:52 -0500 )edit

If I had to guess, it would be done like I've shown in the updated answer above. Note that I have not tested that YAML data, but I hope ...(more)

GregLarkin gravatar imageGregLarkin ( 2013-10-17 13:17:08 -0500 )edit

For anyone looking for an example of adding a Directory block via Hiera, it should actually look like this: http://pastebin.com/xsCDc20V (Adding a line here so the url ...(more)

Doug Fitzmaurice gravatar imageDoug Fitzmaurice ( 2013-11-26 04:39:14 -0500 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

2 followers

Stats

Asked: 2013-10-12 16:00:52 -0500

Seen: 2,184 times

Last updated: Oct 17 '13