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 Nov 22, 2018
2 parents 96b1f7d + 6e4aac8 commit 1df26a6
Show file tree
Hide file tree
Showing 17 changed files with 328 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
68 changes: 68 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
---
sudo: required
dist: trusty

language: python
python: "2.7"

env:
- ANSIBLE_VERSION=latest
- ANSIBLE_VERSION=2.7.2
- ANSIBLE_VERSION=2.7.1
- ANSIBLE_VERSION=2.7.0
- ANSIBLE_VERSION=2.6.8
- ANSIBLE_VERSION=2.6.7
- ANSIBLE_VERSION=2.6.6
- ANSIBLE_VERSION=2.6.5
- ANSIBLE_VERSION=2.6.4
- ANSIBLE_VERSION=2.6.3
- ANSIBLE_VERSION=2.6.2
- ANSIBLE_VERSION=2.6.1
- ANSIBLE_VERSION=2.6.0
- ANSIBLE_VERSION=2.5.11
- ANSIBLE_VERSION=2.5.10
- ANSIBLE_VERSION=2.5.9
- ANSIBLE_VERSION=2.5.8
- ANSIBLE_VERSION=2.5.7
- ANSIBLE_VERSION=2.5.6
- ANSIBLE_VERSION=2.5.5
- ANSIBLE_VERSION=2.5.4
- ANSIBLE_VERSION=2.5.3
- ANSIBLE_VERSION=2.5.2
- ANSIBLE_VERSION=2.5.1
- ANSIBLE_VERSION=2.5.0

branches:
only:
- master

before_install:
- sudo apt-get update -qq

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; fi

notifications:
email: false
hipchat:
rooms:
secure: S0viDElsGPmLLPVY0TIsnBAfhF0otsSSZ84RbLjjLszFbLp11NfTfFxr1iH+jq7aghfix5WXcrlR4/+ZI4tY5pD2V61+Y7wKiea5xeH6sZDqqKOtYByUsVyr1Rt433V1VJRFjAPt8BW+i77Opui/IBSvDMD361sNbqabkMfQzbCeDuNUOYuQFxWXh9V+j6p5wtdOV+fjpBP1zJr00hNKWwmlG6Vg0h5VYUikHWBazGr2vunE+KNbz96sRKN4DIfNFkT2Lue3QCx0w6aiX9H1Zx09ZguWeYLz4Ut+kcZ9voxAHf5xm5vLbFVmNxU4sLrO/TvBXtMyHxctP8RFQ183el4lFraLMUOCG9CFKQu83Y9HPvBuVSr0c2KBp+6ZtFHWKPPOwyWOc+zipW/6WGldYjNgyllDE7NWuiAoC/NYvZ/YdsDZYAcDI1luVdzl4TAjEb63PS4zvw3X9j08c5bfZA6hIlOOwbGH2jbDl+4Ul5661m4evn6XPob+9tGZ2lrCmWJbRr++ZtlpLCUq6xwcC5z/7KvevKrW9zn2PBOh47AWlGaTWEVWcr1o7jX9BmMxKbkUs/mEq3BQs6IOYtrSPe9HWVzax6OMDE3KWbc4//TNr7s9dTF0/xVYDHY9f1/3TKwgTIddIjZzLTCPtODqNhL1BAzkpFZ9O1fUtjppb2s=
webhooks: https://galaxy.ansible.com/api/v1/notifications/
20 changes: 20 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
FROM ubuntu:16.04
MAINTAINER Mischa ter Smitten <[email protected]>

# python
RUN apt-get update && \
DEBIAN_FRONTEND=noninteractive apt-get install -y python-minimal python-dev curl && \
apt-get clean
RUN curl -sL https://bootstrap.pypa.io/get-pip.py | python -
RUN rm -rf $HOME/.cache

# ansible
RUN DEBIAN_FRONTEND=noninteractive apt-get install -y gcc libffi-dev libssl-dev && \
apt-get clean
RUN pip install ansible==2.3.2.0
RUN rm -rf $HOME/.cache

# provision
COPY . /etc/ansible/roles/ansible-role
WORKDIR /etc/ansible/roles/ansible-role
RUN ansible-playbook -i tests/inventory tests/test.yml --connection=local
File renamed without changes.
39 changes: 39 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
## ant

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

Set up [Apache Ant](https://ant.apache.org/).

#### Requirements

None

#### Variables

* `ant_version` [default: `1.10.5`]: Version to install
* `ant_install_prefix` [default: `/opt`]: Install prefix

## Dependencies

None

#### Example

```yaml
---
- hosts: all
roles:
- ant
```
#### License
MIT
#### Author Information
Mischa ter Smitten
#### Feedback, bug-reports, requests, ...
Are [welcome](https://github.com/Oefenweb/ansible-ant/issues)!
78 changes: 78 additions & 0 deletions Vagrantfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
# -*- 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 => "ubuntu-1804",
:box => "bento/ubuntu-18.04",
:ip => '10.0.0.14',
:cpu => "50",
:ram => "256"
},
{
:name => "debian-7",
:box => "bento/debian-7",
:ip => '10.0.0.15',
:cpu => "50",
:ram => "256"
},
{
:name => "debian-8",
:box => "bento/debian-8",
:ip => '10.0.0.16',
:cpu => "50",
:ram => "256"
},
{
:name => "debian-9",
:box => "bento/debian-9",
:ip => '10.0.0.17',
: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
4 changes: 4 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# defaults file for ant
---
ant_version: 1.10.5
ant_install_prefix: /opt
Empty file added files/empty
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 ant
---
24 changes: 24 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# meta file for ant
---
galaxy_info:
author: Mischa ter Smitten
company: Oefenweb.nl B.V.
description: Set up Apache Ant
license: MIT
min_ansible_version: 2.5.0.0
platforms:
- name: Ubuntu
versions:
- precise
- trusty
- xenial
- bionic
- name: Debian
versions:
- wheezy
- jessie
- stretch
galaxy_tags:
- development
- system
dependencies: []
36 changes: 36 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# tasks file for ant
---
- name: create (download) directory
file:
path: "{{ ant_downloads_path }}"
state: directory
owner: root
group: root
mode: 0755
tags:
- configuration
- ant
- ant-download

- name: download
get_url:
url: "http://apache.cs.uu.nl/ant/binaries/apache-ant-{{ ant_version }}-bin.tar.gz"
dest: "{{ ant_downloads_path }}/apache-ant-{{ ant_version }}-bin.tar.gz"
owner: root
group: root
mode: 0644
tags:
- configuration
- ant
- ant-downloads

- name: install
unarchive:
src: "{{ ant_downloads_path }}/apache-ant-{{ ant_version }}-bin.tar.gz"
dest: "{{ ant_install_prefix }}"
creates: "{{ ant_install_prefix }}/apache-ant-{{ ant_version }}"
copy: false
tags:
- configuration
- ant
- ant-install
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
6 changes: 6 additions & 0 deletions tests/post.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# post test file for ant
---
- name: run tests
command: >
{{ ant_install_prefix }}/apache-ant-{{ ant_version }}/bin/ant -version
changed_when: false
10 changes: 10 additions & 0 deletions tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# test file for ant
---
- hosts: localhost
connection: local
become: true
roles:
- ../../

post_tasks:
- include: post.yml
7 changes: 7 additions & 0 deletions tests/vagrant.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# test file for ant
---
- hosts: all
remote_user: vagrant
become: true
roles:
- ../../
3 changes: 3 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# vars file for ant
---
ant_downloads_path: /var/lib/ansible/ant/downloads

0 comments on commit 1df26a6

Please sign in to comment.