All Downloads are FREE. Search and download functionalities are using the official Maven repository.

archetype-resources.vagrant.Vagrantfile Maven / Gradle / Ivy

Go to download

Maven Archetype for creating infrastructure deployment and configuration management projects for AEM.

There is a newer version: 1.3.0
Show newest version
# -*- mode: ruby -*-
# vi: set ft=ruby :

VAGRANTFILE_API_VERSION = "2"

# define performance parameters
CPUS = 4
MEMORY = 8192
CPUEXECUTIONCAP = 80

RSYNC_EXCLUDES = [".git/",".idea/","target/"]

HOSTNAME = "${configurationManagementName.replace('.','-')}-controlhost"

# ssh port
SSH_PORT = 22022

Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|

  config.vm.box = "geerlingguy/centos7"
  config.vm.hostname = HOSTNAME

  # forward your agent to machine
  config.ssh.forward_agent = true

  # define sync folders
  config.vm.synced_folder "../", "/home/vagrant/projects/${configurationManagementName}", create: false, type: "rsync", rsync__exclude: RSYNC_EXCLUDES, rsync__auto: true, rsync__args: ["--verbose", "--archive", "-z", "--copy-links"]

  # forwarded ports
  config.vm.network :forwarded_port, guest: 22, host: SSH_PORT, id: 'ssh'
  config.vm.network :forwarded_port, guest: 8443, host: 8443, id: 'https'
  config.vm.network :forwarded_port, guest: 8080, host: 8080, id: 'http'
  config.vm.network :forwarded_port, guest: 4502, host: 4502, id: 'aem-author'
  config.vm.network :forwarded_port, guest: 4503, host: 4503, id: 'aem-publish'

  # force auto update of VirtualBox guest additions
  config.vbguest.auto_update = true

  config.vm.provider "virtualbox" do |vb|
    # set cpu exectuion gab
    vb.customize ["modifyvm", :id, "--cpuexecutioncap", "#{CPUEXECUTIONCAP}"]

    # set cpu and memory
    vb.cpus = CPUS
    vb.memory = MEMORY

    # set vm name
    vb.name = HOSTNAME
  end

  # provision base (credendials and basic os packages)
  config.vm.provision "shell", path: "provision-base.sh", privileged: false

  # provision controlhost
  config.vm.provision "ansible_local" do |ansible|
    ansible.provisioning_path = "/home/vagrant/projects/${configurationManagementName}/ansible"
    ansible.install_mode = "pip"
    ansible.version = "2.4.6.0"
    ansible.compatibility_mode = "2.0"
    # galaxy settings
    ansible.galaxy_role_file = "requirements.yml"
    ansible.galaxy_roles_path = "/home/vagrant/.ansible/roles"
    ansible.galaxy_command = "ansible-galaxy install --role-file=%{role_file} --roles-path=%{roles_path}"
    # playbook settings
    ansible.inventory_path = "inventory/local"
    ansible.playbook = "playbook-setup-controlhost.yml"
    ansible.limit = "all"
  end

end




© 2015 - 2025 Weber Informatics LLC | Privacy Policy