File: Vagrantfile

package info (click to toggle)
python-pyspnego 0.10.2-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,688 kB
  • sloc: python: 16,197; sh: 182; makefile: 11
file content (50 lines) | stat: -rw-r--r-- 1,494 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
# -*- mode: ruby -*-
# vi: set ft=ruby :

# Require YAML module
require 'yaml'

# Read YAML file with box details
inventory = YAML.load_file('inventory.yml')

Vagrant.configure("2") do |config|
  inventory['all']['children'].each do |group,group_details|
    config.winrm.transport = :ssl
    config.winrm.basic_auth_only = true
    config.winrm.ssl_peer_verification = false

    group_details['children'].each do |sub_group,sub_group_details|
      sub_group_details['hosts'].each do |server,details|

        config.vm.define server do |srv|
          srv.vm.box = details['vagrant_box']
          srv.vm.hostname = server
          srv.vm.network :private_network,
            :ip => details['ansible_host'],
            :libvirt__network_name => 'spnego-test',
            :libvirt__domain_name => inventory['all']['vars']['domain_name']

          srv.vm.provider :virtualbox do |v|
            v.name = File.basename(File.dirname(__FILE__)) + "_" + server + "_" + Time.now.to_i.to_s
            v.gui = false
            v.memory = 4096
            v.cpus = 2
          end

          srv.vm.provider :libvirt do |l|
            l.memory = 4096
            l.cpus = 2
          end

          if group == "linux"
            srv.vm.provision "shell", inline: <<-SHELL
              sed -i 's/PasswordAuthentication no/PasswordAuthentication yes/g' /etc/ssh/sshd_config
              systemctl restart sshd.service
            SHELL
          end
        end

      end
    end
  end
end