Skip to content

Instantly share code, notes, and snippets.

@progre
Created February 2, 2014 14:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save progre/8769424 to your computer and use it in GitHub Desktop.
Save progre/8769424 to your computer and use it in GitHub Desktop.
AnsibleをゲストOSに押し込んでVagrant環境構築する ref: http://qiita.com/progre/items/ccc2d8c2ec7ae8a4ed61
ansible/
hosts
playbook.yml
provision.sh
Vagrantfile
PS E:\Developments\vagrant\rubyist> vagrant provision
[default] Running provisioner: shell...
DL is deprecated, please use Fiddle
[default] Running: C:/Users/progre/AppData/Local/Temp/vagrant-shell20140202-12404-w7zith
stdin: is not a tty
PLAY [127.0.0.1] **************************************************************
GATHERING FACTS ***************************************************************
ok: [127.0.0.1]
TASK: [install ruby] **********************************************************
ok: [127.0.0.1]
TASK: [install rubygems] ******************************************************
ok: [127.0.0.1]
TASK: [install bundler] *******************************************************
changed: [127.0.0.1]
PLAY RECAP ********************************************************************
127.0.0.1 : ok=4 changed=1 unreachable=0 failed=0
PS E:\Developments\vagrant\rubyist>
127.0.0.1 ansible_connection=local
---
- hosts: 127.0.0.1
connection: local
sudo: yes
tasks:
- name: install ruby
apt: pkg=ruby update_cache=yes
- name: install rubygems
apt: pkg=rubygems update_cache=yes
- name: install bundler
command: gem install bundler
#!/usr/bin/env bash
if ! [ `which ansible` ]; then
apt-get update -y
apt-get install -y ansible
fi
ansible-playbook -i /vagrant/ansible/hosts /vagrant/ansible/playbook.yml
Vagrant.configure("2") do |config|
config.vm.box = "precise64"
config.vm.box_url = "http://files.vagrantup.com/precise64.box"
config.vm.synced_folder ".", "/vagrant", :mount_options => ['dmode=775', 'fmode=664']
config.vm.provision "shell", :path => "provision.sh"
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment