Skip to content

Commit 505242d

Browse files
committed
Initial working version
1 parent b74e457 commit 505242d

File tree

15 files changed

+305
-0
lines changed

15 files changed

+305
-0
lines changed

.gitignore

+30
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
# OS generated files #
2+
######################
3+
.DS_Store
4+
.DS_Store?
5+
._*
6+
.Spotlight-V100
7+
.Trashes
8+
Icon?
9+
ehthumbs.db
10+
Thumbs.db
11+
12+
# IDE files #
13+
#################
14+
/.settings
15+
/.buildpath
16+
/.project
17+
/nbproject
18+
*.komodoproject
19+
*.kpf
20+
/.idea
21+
22+
# Vagrant files #
23+
.virtualbox/
24+
.vagrant/
25+
vagrant_ansible_inventory_*
26+
ansible.cfg
27+
28+
# Other files #
29+
###############
30+
!empty

.travis.yml

+71
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
---
2+
language: python
3+
python: "2.7"
4+
5+
env:
6+
- ANSIBLE_VERSION=latest
7+
- ANSIBLE_VERSION=1.9.2
8+
- ANSIBLE_VERSION=1.9.1
9+
- ANSIBLE_VERSION=1.9.0.1
10+
- ANSIBLE_VERSION=1.8.4
11+
- ANSIBLE_VERSION=1.8.3
12+
- ANSIBLE_VERSION=1.8.2
13+
- ANSIBLE_VERSION=1.8.1
14+
- ANSIBLE_VERSION=1.8
15+
- ANSIBLE_VERSION=1.7.2
16+
- ANSIBLE_VERSION=1.7.1
17+
- ANSIBLE_VERSION=1.7
18+
- ANSIBLE_VERSION=1.6.9
19+
- ANSIBLE_VERSION=1.6.8
20+
- ANSIBLE_VERSION=1.6.7
21+
- ANSIBLE_VERSION=1.6.6
22+
- ANSIBLE_VERSION=1.6.5
23+
- ANSIBLE_VERSION=1.6.4
24+
- ANSIBLE_VERSION=1.6.3
25+
- ANSIBLE_VERSION=1.6.2
26+
- ANSIBLE_VERSION=1.6.10
27+
- ANSIBLE_VERSION=1.6.1
28+
- ANSIBLE_VERSION=1.6
29+
- ANSIBLE_VERSION=1.5.5
30+
- ANSIBLE_VERSION=1.5.4
31+
- ANSIBLE_VERSION=1.5.3
32+
- ANSIBLE_VERSION=1.5.2
33+
- ANSIBLE_VERSION=1.5.1
34+
- ANSIBLE_VERSION=1.5
35+
- ANSIBLE_VERSION=1.4.5
36+
- ANSIBLE_VERSION=1.4.4
37+
- ANSIBLE_VERSION=1.4.3
38+
- ANSIBLE_VERSION=1.4.2
39+
- ANSIBLE_VERSION=1.4.1
40+
- ANSIBLE_VERSION=1.4
41+
42+
branches:
43+
only:
44+
- master
45+
46+
before_install:
47+
- sudo apt-get update -qq
48+
49+
install:
50+
# Install Ansible.
51+
- if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install ansible; else pip install ansible==$ANSIBLE_VERSION; fi
52+
53+
# Add ansible.cfg to pick up roles path.
54+
- printf "[defaults]\nroles_path = ../" > ansible.cfg
55+
56+
script:
57+
# Check the role/playbook's syntax.
58+
- ansible-playbook -i tests/inventory tests/test.yml --syntax-check
59+
60+
# Run the role/playbook with ansible-playbook.
61+
- ansible-playbook -i tests/inventory tests/test.yml --connection=local --sudo -vvvv
62+
63+
# Run the role/playbook again, checking to make sure it's idempotent.
64+
- >
65+
ansible-playbook -i tests/inventory tests/test.yml --connection=local --sudo
66+
| grep -q 'changed=0.*failed=0'
67+
&& (echo 'Idempotence test: pass' && exit 0)
68+
|| (echo 'Idempotence test: fail' && exit 1)
69+
70+
notifications:
71+
email: false

README.md

+42
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
## virtualenv
2+
3+
[![Build Status](https://travis-ci.org/Oefenweb/ansible-virtualenv.svg?branch=master)](https://travis-ci.org/Oefenweb/ansible-virtualenv) [![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-virtualenv-blue.svg)](https://galaxy.ansible.com/list#/roles/4387)
4+
5+
Set up (the latest version of) virtualenv(wrapper) in Debian-like systems.
6+
7+
#### Requirements
8+
9+
* `pip` (will not installed)
10+
11+
#### Variables
12+
13+
None
14+
15+
## Dependencies
16+
17+
None
18+
19+
## Recommended
20+
21+
* `ansible-pip` ([see](https://github.com/Oefenweb/ansible-pip)
22+
23+
#### Example
24+
25+
```yaml
26+
---
27+
- hosts: all
28+
roles:
29+
- virtualenv
30+
```
31+
32+
#### License
33+
34+
MIT
35+
36+
#### Author Information
37+
38+
Mischa ter Smitten
39+
40+
#### Feedback, bug-reports, requests, ...
41+
42+
Are [welcome](https://github.com/Oefenweb/ansible-virtualenv/issues)!

Vagrantfile

+83
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
# -*- mode: ruby -*-
2+
# vi: set ft=ruby ts=2 sw=2 tw=0 et :
3+
4+
role = File.basename(File.expand_path(File.dirname(__FILE__)))
5+
6+
File.open(File.dirname(__FILE__) + '/ansible.cfg', 'w') { |f| f.write("[defaults]\nroles_path = ../") }
7+
8+
boxes = [
9+
{
10+
:name => "ubuntu-1004",
11+
:box => "opscode-ubuntu-10.04",
12+
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-10.04_chef-provisionerless.box",
13+
:ip => '10.0.0.10',
14+
:cpu => "50",
15+
:ram => "256"
16+
},
17+
{
18+
:name => "ubuntu-1204",
19+
:box => "opscode-ubuntu-12.04",
20+
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-12.04_chef-provisionerless.box",
21+
:ip => '10.0.0.11',
22+
:cpu => "50",
23+
:ram => "256"
24+
},
25+
{
26+
:name => "ubuntu-1404",
27+
:box => "opscode-ubuntu-14.04",
28+
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_ubuntu-14.04_chef-provisionerless.box",
29+
:ip => '10.0.0.12',
30+
:cpu => "50",
31+
:ram => "256"
32+
},
33+
{
34+
:name => "debian-6010",
35+
:box => "opscode-debian-6.0.10",
36+
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-6.0.10_chef-provisionerless.box",
37+
:ip => '10.0.0.13',
38+
:cpu => "50",
39+
:ram => "256"
40+
},
41+
{
42+
:name => "debian-78",
43+
:box => "opscode-debian-7.8",
44+
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-7.8_chef-provisionerless.box",
45+
:ip => '10.0.0.14',
46+
:cpu => "50",
47+
:ram => "256"
48+
},
49+
{
50+
:name => "debian-81",
51+
:box => "opscode-debian-8.1",
52+
:url => "http://opscode-vm-bento.s3.amazonaws.com/vagrant/virtualbox/opscode_debian-8.1_chef-provisionerless.box",
53+
:ip => '10.0.0.15',
54+
:cpu => "50",
55+
:ram => "256"
56+
},
57+
]
58+
59+
Vagrant.configure("2") do |config|
60+
boxes.each do |box|
61+
config.vm.define box[:name] do |vms|
62+
vms.vm.box = box[:box]
63+
vms.vm.box_url = box[:url]
64+
vms.vm.hostname = "ansible-#{role}-#{box[:name]}"
65+
66+
vms.vm.provider "virtualbox" do |v|
67+
v.customize ["modifyvm", :id, "--cpuexecutioncap", box[:cpu]]
68+
v.customize ["modifyvm", :id, "--memory", box[:ram]]
69+
end
70+
71+
vms.vm.network :private_network, ip: box[:ip]
72+
73+
vms.vm.provision :shell do |shell|
74+
shell.path = "tests/vagrant.sh"
75+
end
76+
77+
vms.vm.provision :ansible do |ansible|
78+
ansible.playbook = "tests/vagrant.yml"
79+
ansible.verbose = "vv"
80+
end
81+
end
82+
end
83+
end

defaults/main.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# defaults file for virtualenv
2+
---

files/empty

Whitespace-only changes.

handlers/main.yml

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
# handlers file for virtualenv
2+
---

meta/main.yml

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
# meta file for virtualenv
2+
---
3+
galaxy_info:
4+
author: Mischa ter Smitten
5+
company: Oefenweb.nl B.V.
6+
description: Set up (the latest version of) virtualenv(wrapper) in Debian-like systems
7+
license: MIT
8+
min_ansible_version: 1.4
9+
platforms:
10+
- name: Ubuntu
11+
versions:
12+
- lucid
13+
- precise
14+
- trusty
15+
- name: Debian
16+
versions:
17+
- squeeze
18+
- wheezy
19+
- jessie
20+
categories:
21+
- development
22+
- system
23+
- packaging
24+
dependencies: []

tasks/main.yml

+8
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
# tasks file for virtualenv
2+
---
3+
- name: install
4+
pip:
5+
name: "{{ item }}"
6+
state: latest
7+
with_items: virtualenv_dependencies
8+
tags: [configuration, virtualenv, virtualenv-install]

templates/empty

Whitespace-only changes.

tests/inventory

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
localhost

tests/test.yml

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
# test file for virtualenv
2+
---
3+
- hosts: localhost
4+
remote_user: root
5+
roles:
6+
- ansible-virtualenv

tests/vagrant.sh

+24
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/usr/bin/env bash
2+
#
3+
# set -x;
4+
set -e;
5+
set -o pipefail;
6+
#
7+
thisFile="$(readlink -f ${0})";
8+
thisFilePath="$(dirname ${thisFile})";
9+
10+
# Only provision once
11+
if [ -f /provisioned ]; then
12+
exit 0;
13+
fi
14+
15+
export DEBIAN_FRONTEND=noninteractive;
16+
17+
shopt -s expand_aliases;
18+
alias apt-update='apt-get update -qq';
19+
alias apt-install='apt-get install -q -y -o Dpkg::Options::="--force-confdef" -o Dpkg::Options::="--force-confold"';
20+
21+
apt-update;
22+
apt-install python-pip;
23+
24+
touch /provisioned;

tests/vagrant.yml

+7
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# test file for virtualenv
2+
---
3+
- hosts: all
4+
remote_user: vagrant
5+
sudo: true
6+
roles:
7+
- virtualenv

vars/main.yml

+5
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# vars file for virtualenv
2+
---
3+
virtualenv_dependencies:
4+
- virtualenv
5+
- virtualenvwrapper

0 commit comments

Comments
 (0)