Skip to content

Commit

Permalink
Merge pull request #1 from Oefenweb/initial-working-version
Browse files Browse the repository at this point in the history
Initial working version
  • Loading branch information
tersmitten authored Feb 1, 2017
2 parents 6b64921 + 0349228 commit b1f5b3e
Show file tree
Hide file tree
Showing 15 changed files with 387 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
# OS generated files #
######################
.DS_Store
.DS_Store?
._*
.Spotlight-V100
.Trashes
Icon?
ehthumbs.db
Thumbs.db

# IDE files #
#################
/.settings
/.buildpath
/.project
/nbproject
*.komodoproject
*.kpf
/.idea

# Vagrant files #
.virtualbox/
.vagrant/
vagrant_ansible_inventory_*
ansible.cfg

# Other files #
###############
!empty
60 changes: 60 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
---
sudo: required
dist: trusty

language: python
python: "2.7"

env:
- ANSIBLE_VERSION=latest
- ANSIBLE_VERSION=2.2.1.0
- ANSIBLE_VERSION=2.2.0.0
- ANSIBLE_VERSION=2.1.4
- ANSIBLE_VERSION=2.1.3
- ANSIBLE_VERSION=2.1.2
- ANSIBLE_VERSION=2.1.1.0
- ANSIBLE_VERSION=2.1.0.0
- ANSIBLE_VERSION=2.0.2.0
- ANSIBLE_VERSION=2.0.1.0
- ANSIBLE_VERSION=2.0.0.2
- ANSIBLE_VERSION=2.0.0.1
- ANSIBLE_VERSION=2.0.0.0
- ANSIBLE_VERSION=1.9.6

branches:
only:
- master

before_install:
- sudo apt-get update -qq

# Remove parallel
- sudo apt-get remove --purge --yes parallel || true

install:
# Install Ansible.
- if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install ansible; else pip install ansible==$ANSIBLE_VERSION; fi
- if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install ansible-lint; fi

script:
# Check the role/playbook's syntax.
- ansible-playbook -i tests/inventory tests/test.yml --syntax-check

# Run the role/playbook with ansible-playbook.
- ansible-playbook -i tests/inventory tests/test.yml -vvvv

# Run the role/playbook again, checking to make sure it's idempotent.
- >
ansible-playbook -i tests/inventory tests/test.yml
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)
- if [ "$ANSIBLE_VERSION" = "latest" ]; then ansible-lint tests/test.yml || true; fi

notifications:
email: false
hipchat:
rooms:
secure: Y546OvY1VE/YgT1o+IZYSVR3gO0t1rGVtRGO9/X++xi72y4s1kINnN3v4e2gc+8BAhHsueaqH4QGIHoJeTQ8+LcK9pNBRBmuxI4qzltcCXd5EV3iVuhhynE1IzixtRxYcps7U+T/VdSj/m80ZD4YvLmcD1pVAprCSUJcX8ccJQw3HZ1RuIyO2iIRmLjU6oc6Js+rDCZqie3yVLbRmVQL9O6LI15YWIpO4UPDcXHd26ugmUQTl/BRNaE0ROxVhu2R8OCKbC6ctrv04dog1+EZA3NMEX/L4HbN/7K6JlwC/5Cl840pc6Ned2NihGCkcejpae0UYrpr+BHgDfB/MBAXwqthutyAqtQvIiOV7KIgAJ9ID4+x+4RZYZYg3q5Y2vmGyILRPhzcverZrZTHuKvNxdQMBMs7Xi1/uL3//jrBoN0yD9JhC/hme0A6neGglQTFZWyEjU0T5pIeBJ4lAuG8EKN4WjzoD5LIr03PHO+037N+YjPYsIHMJr8UwaRL8YsBPvKGLyeAwOZnFFuyfUM8W0EIlrDkNVbUx+AS69oYCpUkxpynwZk3ssNZ3CK/yS2wXIfsEPdApk8tbS8FcvLGQvy+i+F5UedEWXgcXtYKuRJ2N2DnO6Z1kFgPcJQ70dDzaSLhXWf/+IUiR0wQHEjL4EtbhGd1kBL09CxjCwffJQI=
webhooks: https://galaxy.ansible.com/api/v1/notifications/
38 changes: 38 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
## gnu-parallel

[![Build Status](https://travis-ci.org/Oefenweb/ansible-gnu-parallel.svg?branch=master)](https://travis-ci.org/Oefenweb/ansible-gnu-parallel) [![Ansible Galaxy](http://img.shields.io/badge/ansible--galaxy-gnu--parallel-blue.svg)](https://galaxy.ansible.com/Oefenweb/gnu-parallel)

Set up the latest version of [GNU Parallel](https://www.gnu.org/software/parallel/) in Debian-like systems.

#### Requirements

None

#### Variables

* `gnu_parallel_remove_distro_version`: [default: `true`]: Whether or not to remove the distribution version

## Dependencies

None

#### Example

```yaml
---
- hosts: all
roles:
- gnu-parallel
```
#### License
MIT
#### Author Information
* Mischa ter Smitten
#### Feedback, bug-reports, requests, ...
Are [welcome](https://github.com/Oefenweb/ansible-gnu-parallel/issues)!
63 changes: 63 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
# -*- mode: ruby -*-
# vi: set ft=ruby ts=2 sw=2 tw=0 et :

role = File.basename(File.expand_path(File.dirname(__FILE__)))

boxes = [
{
:name => "ubuntu-1204",
:box => "bento/ubuntu-12.04",
:ip => '10.0.0.11',
:cpu => "50",
:ram => "256"
},
{
:name => "ubuntu-1404",
:box => "bento/ubuntu-14.04",
:ip => '10.0.0.12',
:cpu => "50",
:ram => "256"
},
{
:name => "ubuntu-1604",
:box => "bento/ubuntu-16.04",
:ip => '10.0.0.13',
:cpu => "50",
:ram => "256"
},
{
:name => "debian-711",
:box => "bento/debian-7.11",
:ip => '10.0.0.14',
:cpu => "50",
:ram => "256"
},
{
:name => "debian-86",
:box => "bento/debian-8.6",
:ip => '10.0.0.15',
:cpu => "50",
:ram => "256"
},
]

Vagrant.configure("2") do |config|
boxes.each do |box|
config.vm.define box[:name] do |vms|
vms.vm.box = box[:box]
vms.vm.hostname = "ansible-#{role}-#{box[:name]}"

vms.vm.provider "virtualbox" do |v|
v.customize ["modifyvm", :id, "--cpuexecutioncap", box[:cpu]]
v.customize ["modifyvm", :id, "--memory", box[:ram]]
end

vms.vm.network :private_network, ip: box[:ip]

vms.vm.provision :ansible do |ansible|
ansible.playbook = "tests/vagrant.yml"
ansible.verbose = "vv"
end
end
end
end
3 changes: 3 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# defaults file for gnu-parallel
---
gnu_parallel_remove_distro_version: true
Empty file added files/root/.parallel/will-cite
Empty file.
2 changes: 2 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# handlers file for gnu-parallel
---
22 changes: 22 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
# meta file for gnu-parallel
---
galaxy_info:
author: Mischa ter Smitten
company: Oefenweb.nl B.V.
description: Set up the latest version of GNU Parallel in Debian-like systems
license: MIT
min_ansible_version: 1.9.6
platforms:
- name: Ubuntu
versions:
- precise
- trusty
- xenial
- name: Debian
versions:
- wheezy
- jessie
galaxy_tags:
- shell
- system
dependencies: []
136 changes: 136 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
# tasks file for gnu-parallel
---
- name: install dependencies
apt:
name: "{{ item }}"
state: "{{ apt_install_state | default('latest') }}"
update_cache: true
cache_valid_time: "{{ apt_update_cache_valid_time | default(3600) }}"
with_items: "{{ gnu_parallel_dependencies }}"
tags:
- configuration
- gnu-parallel
- gnu-parallel-install
- gnu-parallel-install-dependencies

- name: remove (distro version)
apt:
name: parallel
state: absent
purge: true
when: gnu_parallel_remove_distro_version
tags:
- configuration
- gnu-parallel
- gnu-parallel-remove
- gnu-parallel-remove-distro

- name: create (download) directory
file:
path: "{{ gnu_parallel_download_path }}"
state: directory
owner: root
group: root
mode: 0755
tags:
- configuration
- gnu-parallel
- gnu-parallel-install
- gnu-parallel-install-download

- name: download (latest)
get_url:
url: "{{ gnu_parallel_download_url }}"
dest: "{{ gnu_parallel_download_path }}/{{ gnu_parallel_download_url | basename }}"
owner: root
group: root
mode: 0644
force: true
tags:
- configuration
- gnu-parallel
- gnu-parallel-install
- gnu-parallel-install-download

- name: create (build) directory
file:
path: "{{ gnu_parallel_build_path }}"
state: directory
owner: root
group: root
mode: 0755
tags:
- configuration
- gnu-parallel
- gnu-parallel-install
- gnu-parallel-install-build

- name: version check
shell: tar -jtf {{ gnu_parallel_download_path }}/{{ gnu_parallel_download_url | basename }} | head -n 1
changed_when: false
register: _version_check
tags:
- configuration
- gnu-parallel
- gnu-parallel-install
- gnu-parallel-install-build

- name: extract
unarchive:
src: "{{ gnu_parallel_download_path }}/{{ gnu_parallel_download_url | basename }}"
dest: "{{ gnu_parallel_build_path }}"
creates: "{{ gnu_parallel_build_path }}/{{ _version_check.stdout }}"
copy: false
register: _unarchive
tags:
- configuration
- gnu-parallel
- gnu-parallel-install
- gnu-parallel-install-build

- name: configure
command: ./configure
args:
chdir: "{{ gnu_parallel_build_path }}/{{ _version_check.stdout }}"
when: _unarchive | changed
tags:
- configuration
- gnu-parallel
- gnu-parallel-install
- gnu-parallel-install-build
- gnu-parallel-install-build-configure

- name: make
command: make -j{{ ansible_processor_cores + 1 }}
args:
chdir: "{{ gnu_parallel_build_path }}/{{ _version_check.stdout }}"
when: _unarchive | changed
tags:
- configuration
- gnu-parallel
- gnu-parallel-install
- gnu-parallel-install-build
- gnu-parallel-install-build-make

- name: make install
command: make install
args:
chdir: "{{ gnu_parallel_build_path }}/{{ _version_check.stdout }}"
when: _unarchive | changed
tags:
- configuration
- gnu-parallel
- gnu-parallel-install
- gnu-parallel-install-build
- gnu-parallel-install-build-make-install

- name: silence citation notice
copy:
src: root/.parallel
dest: "{{ ansible_env.HOME }}/"
owner: "{{ ansible_env.USER }}"
group: "{{ ansible_env.USER }}"
tags:
- configuration
- gnu-parallel
- gnu-parallel-silence-citation-notice
Empty file added templates/empty
Empty file.
1 change: 1 addition & 0 deletions tests/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
localhost
5 changes: 5 additions & 0 deletions tests/post.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# post test file for gnu-parallel
---
- name: post | test installation
command: parallel --version
changed_when: false
9 changes: 9 additions & 0 deletions tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# test file for gnu-parallel
---
- hosts: localhost
connection: local
become: true
roles:
- ../../
post_tasks:
- include: post.yml
9 changes: 9 additions & 0 deletions tests/vagrant.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# test file for gnu-parallel
---
- hosts: all
remote_user: vagrant
become: true
roles:
- ../../
post_tasks:
- include: post.yml
9 changes: 9 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
# vars file for gnu-parallel
---
gnu_parallel_dependencies:
- build-essential

gnu_parallel_build_path: /var/lib/ansible/gnu-parallel/build

gnu_parallel_download_path: /var/lib/ansible/gnu-parallel/downloads
gnu_parallel_download_url: http://ftpmirror.gnu.org/parallel/parallel-latest.tar.bz2

0 comments on commit b1f5b3e

Please sign in to comment.