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

Double lines in ubuntu guest #3

Open
bbrala opened this issue Jan 2, 2017 · 0 comments
Open

Double lines in ubuntu guest #3

bbrala opened this issue Jan 2, 2017 · 0 comments

Comments

@bbrala
Copy link

bbrala commented Jan 2, 2017

Hi,

When i run provision multiple times, the hostfile seems to be populated with multiple sets of host definitions. Not sure why the filter doesn't work as intended.

if Vagrant.has_plugin?("vagrant-hosts-provisioner")
        config.vm.provision :hostsupdate, run: 'always' do |host|

            # Get list of all directories in folder above this file.
            paths = Dir.entries(projects_dir).select {|entry| File.directory? File.join(projects_dir,entry) and !(entry.start_with?(".")) }
            hosts = paths.map do |path|
                "#{path}." + config.vm.hostname
            end
            hosts.push("testing." + config.vm.hostname)

            host.hostname = config.vm.hostname
            host.manage_guest = true
            host.manage_host = true
            host.aliases = hosts
            host.files = [
                'provision/configuration/hosts.json'
            ]

        end
    end

Hostfile:

root@dev:/etc# cat hosts
127.0.0.1       dev.local       dev
127.0.0.1       localhost
127.0.1.1       wesley-laptop.Swis-leiden.local wesley-laptop
::1     localhost ip6-localhost ip6-loopback
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
172.16.0.160 hostmachine #vagrant-host-ip

## vagrant-hosts-provisioner-start
172.16.0.74     dev.local apachelog.dev.local batch-scripts.dev.local 
172.16.0.74     crontabs.dev.local deploy.dev.local devlocal.dev.local  devlocal-dev.dev.local
## vagrant-hosts-provisioner-end

## vagrant-hosts-provisioner-start
172.16.0.74     dev.local apachelog.dev.local batch-scripts.dev.local 
172.16.0.74     crontabs.dev.local deploy.dev.local devlocal.dev.local  devlocal-dev.dev.local
## vagrant-hosts-provisioner-end
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

1 participant