diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..f74c83a --- /dev/null +++ b/.gitignore @@ -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 diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..c8c7651 --- /dev/null +++ b/.travis.yml @@ -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/ diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 0000000..d9adf96 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,20 @@ +FROM ubuntu:16.04 +MAINTAINER Mischa ter Smitten + +# 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 diff --git a/LICENSE.txt/LICENSE.txt b/LICENSE.txt similarity index 100% rename from LICENSE.txt/LICENSE.txt rename to LICENSE.txt diff --git a/README.md b/README.md new file mode 100644 index 0000000..af5a91c --- /dev/null +++ b/README.md @@ -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)! diff --git a/Vagrantfile b/Vagrantfile new file mode 100644 index 0000000..64d2358 --- /dev/null +++ b/Vagrantfile @@ -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 diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..449f5b8 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,4 @@ +# defaults file for ant +--- +ant_version: 1.10.5 +ant_install_prefix: /opt diff --git a/files/empty b/files/empty new file mode 100644 index 0000000..e69de29 diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..ce91b70 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,2 @@ +# handlers file for ant +--- diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..08e20d3 --- /dev/null +++ b/meta/main.yml @@ -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: [] diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..c6e0a95 --- /dev/null +++ b/tasks/main.yml @@ -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 diff --git a/templates/empty b/templates/empty new file mode 100644 index 0000000..e69de29 diff --git a/tests/inventory b/tests/inventory new file mode 100644 index 0000000..2fbb50c --- /dev/null +++ b/tests/inventory @@ -0,0 +1 @@ +localhost diff --git a/tests/post.yml b/tests/post.yml new file mode 100644 index 0000000..25f80c4 --- /dev/null +++ b/tests/post.yml @@ -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 diff --git a/tests/test.yml b/tests/test.yml new file mode 100644 index 0000000..b29e3ff --- /dev/null +++ b/tests/test.yml @@ -0,0 +1,10 @@ +# test file for ant +--- +- hosts: localhost + connection: local + become: true + roles: + - ../../ + + post_tasks: + - include: post.yml diff --git a/tests/vagrant.yml b/tests/vagrant.yml new file mode 100644 index 0000000..a7f825c --- /dev/null +++ b/tests/vagrant.yml @@ -0,0 +1,7 @@ +# test file for ant +--- +- hosts: all + remote_user: vagrant + become: true + roles: + - ../../ diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..773ea9d --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,3 @@ +# vars file for ant +--- +ant_downloads_path: /var/lib/ansible/ant/downloads