Comments (8)
Testcase :
Vagrantfile
Vagrant.configure(2) do |config|
config.vm.box = "ubuntu/trusty64"
config.vm.box_check_update = false
config.vm.provision "shell", inline: <<-SHELL
export DEBIAN_FRONTEND=noninteractive
echo "+ Installing ansible"
sudo apt-get install -y software-properties-common
sudo apt-add-repository ppa:ansible/ansible
sudo apt-get update -y -q
sudo apt-get install -y ansible
sudo bash -c "echo localhost ansible_connection=local >> /etc/ansible/hosts"
echo "+ checking ansible install"
ansible --version
sudo ansible localhost -m ping
sudo bash -c "grep '/vagrant/roles' /etc/ansible/ansible.cfg || sed -i.bak -e '/#roles_path/a roles_path=/etc/ansible/roles:/vagrant/roles' /etc/ansible/ansible.cfg"
echo "+ Installing ansible galaxy requirements.yml"
if [ -f /vagrant/requirements.yml ]; then sudo ansible-galaxy install -r /vagrant/requirements.yml; fi
echo "+ Running ansible playbook(s)"
if [ -f /vagrant/playbook.yml ]; then sudo ansible-playbook --syntax-check /vagrant/playbook.yml && sudo ansible-playbook /vagrant/playbook.yml; fi
SHELL
end
requirements.yml
---
- src: PeterMosmans.virtualbox-guest
playbook.yml
- hosts: localhost
become: "yes"
become_method: "sudo"
vars:
- virtualbox_version: "5.0.22"
- virtualbox_keep: "no"
roles:
- PeterMosmans.virtualbox-guest
from ansible-role-virtualbox-guest.
Great suggestion, thanks. I'll add that to the next version
from ansible-role-virtualbox-guest.
See PR : #6
from ansible-role-virtualbox-guest.
FYI @fredleger I'm not sure if you are familiar with it, but as alternative you could also use the inline automatic Ansible provisioner for testing instead of shell script, e.g.:
Vagrant.configure("2") do |config|
config.vm.box = "debian/jessie64"
[...]
config.vm.provision "ansible_local" do |ansible|
ansible.galaxy_role_file = "requirements.yml"
ansible.inventory_path = "hosts"
ansible.install = true
ansible.install_mode = "pip"
ansible.limit = "all"
ansible.playbook = "myplaybook.yml"
end
end
See e.g. https://www.onwebsecurity.com/devops/zen-provisioning-bootstrap-the-installation-of-ansible-using-vagrant for an example.
from ansible-role-virtualbox-guest.
Absolutly. But then you relly on the version bundled with the OS wich is 1.7 i guess. Ansible is evolving too fast...
from ansible-role-virtualbox-guest.
and also you have to use an vagrant box that has ansible installed. I get too much errros doig so, so i switched to this kind of script to setup ansible
from ansible-role-virtualbox-guest.
Hi @fredleger - personally I have great experiences with the install_mode = "pip" - It installs the latest version ( > 2) automatically. Have you seen the link ? You could use it to bootstrap the installation of an Vagrant Ansible Controller - no previous Ansible version necessary. Anyways, what works best is the main issue 😉
from ansible-role-virtualbox-guest.
Seems very interisting. will give it a try
from ansible-role-virtualbox-guest.
Related Issues (12)
- Use mount module instead of mount command
- The check for the ISO in /root does not seem to work HOT 2
- Sometimes a sudo password is required, sometimes not? HOT 2
- Rewrite Ansible warning on the use of jinja2 parameters HOT 2
- Does it work for CentOS7? HOT 2
- Error: privilege output closed while waiting for password prompt HOT 3
- Resolve versioning conflicts HOT 1
- On Debian and Mint desktop it fails to work HOT 2
- Unsupported parameters HOT 3
- Make idempotent install command Ubuntu compatible HOT 6
- idea: upgrade kernel before install virtualbox additions HOT 4
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from ansible-role-virtualbox-guest.