Skip to content

Instantly share code, notes, and snippets.

@yeroc
Created February 27, 2015 23:10
Show Gist options
  • Save yeroc/2db8dca5eb31dad7a046 to your computer and use it in GitHub Desktop.
Save yeroc/2db8dca5eb31dad7a046 to your computer and use it in GitHub Desktop.
192.168.33.10 ansible_ssh_pass=vagrant
---
# Used to reproduce https://github.com/ansible/ansible-modules-extras/issues/12
#
# $ ansible-playbook -i ansible-inventory ansible-play-alternatives-test.yml
#
- hosts: all
user: vagrant
sudo: yes
vars:
jdk_dir: /opt/bin
tasks:
- name: Create dummy directory
file: path="{{ jdk_dir }}" state=directory recurse=yes mode=0644
- name: Create dummy binary
file: path="{{ jdk_dir }}/java" state=touch mode=0755
- name: Configure Java alternative
alternatives: name={{ item.name }} link={{ item.link }} path={{ item.path }}
with_items:
- { name: java, link: /usr/bin/java, path: "{{ jdk_dir }}/java" }
# -*- mode: ruby -*-
# vi: set ft=ruby :
VAGRANTFILE_API_VERSION = "2"
Vagrant.configure(VAGRANTFILE_API_VERSION) do |config|
config.vm.box = "CentOS 6.4 x86_64"
config.vm.box_url = "https://github.com/2creatives/vagrant-centos/releases/download/v6.4.2/centos64-x86_64-20140116.box"
config.vm.network :private_network, ip: "192.168.33.10"
config.vm.provider :virtualbox do |vb|
# Don't boot with headless mode
#vb.gui = true
# Use VBoxManage to customize the VM. For example to change memory:
vb.customize ["modifyvm", :id, "--memory", "2048"]
end
config.vm.provision "ansible" do |ansible|
ansible.playbook = "ansible-play-alternatives-test.yml"
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment