commit 7239a515e55703efff0d24c5f0455e8a6fbe725a Author: Jeff Geerling Date: Sat Jun 7 11:05:13 2014 -0500 Initial commit. diff --git a/.travis.yml b/.travis.yml new file mode 100644 index 0000000..5f296de --- /dev/null +++ b/.travis.yml @@ -0,0 +1,35 @@ +--- +language: python +python: "2.7" + +env: + - SITE=test.yml + +before_install: + - sudo apt-get update -qq + - sudo apt-get install -y curl + +install: + # Install Ansible. + - pip install ansible==1.5.0 + + # Add ansible.cfg to pick up roles path. + - "printf '[defaults]\nroles_path = ../' > ansible.cfg" + +script: + # Check the role/playbook's syntax. + - "ansible-playbook -i tests/inventory tests/$SITE --syntax-check" + + # Run the role/playbook with ansible-playbook. + - "ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo" + + # Run the role/playbook again, checking to make sure it's idempotent. + - > + ansible-playbook -i tests/inventory tests/$SITE --connection=local --sudo + | grep -q 'changed=0.*failed=0' + && (echo 'Idempotence test: pass' && exit 0) + || (echo 'Idempotence test: fail' && exit 1) + + # Make sure Ansible is installed (yes, this is contrived, since Ansible was + # already installed via pip earlier...). + - "which ansible" diff --git a/README.md b/README.md new file mode 100644 index 0000000..7af4721 --- /dev/null +++ b/README.md @@ -0,0 +1,33 @@ +# Ansible Role: Ansible + +[![Build Status](https://travis-ci.org/geerlingguy/ansible-role-ansible.svg?branch=master)](https://travis-ci.org/geerlingguy/ansible-role-ansible) + +An Ansible Role that installs Ansible on RHEL/CentOS and Debian/Ubuntu. + +## Requirements + +If using on a RedHat/CentOS-based host, make sure you've added the EPEL repository (it can easily be installed by including the `geerlingguy.repo-epel` role on Ansible Galaxy). + +## Role Variables + +Available variables are listed below, along with default values (see `defaults/main.yml`): + + TODO + +## Dependencies + +None. + +## Example Playbook + + - hosts: servers + roles: + - { role: geerlingguy.ansible } + +## License + +MIT / BSD + +## Author Information + +This role was created in 2014 by [Jeff Geerling](http://jeffgeerling.com/), author of [Ansible for DevOps](http://ansiblefordevops.com/). diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..530f5be --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,24 @@ +--- +dependencies: [] + +galaxy_info: + author: geerlingguy + description: Ansible for RedHat/CentOS/Debian/Ubuntu. + company: "Midwestern Mac, LLC" + license: "license (BSD, MIT)" + min_ansible_version: 1.4 + platforms: + - name: EL + versions: + - 6 + - name: Debian + versions: + - all + - name: Ubuntu + versions: + - all + categories: + - system + - packaging + - development + - cloud diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..5f0b0ce --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,18 @@ +--- +# RedHat installation. +- name: Install Ansible (RedHat). + yum: pkg=ansible state=installed enablerepo=epel + when: ansible_os_family == 'RedHat' + +# Debian installation. +- name: Add rquillo repository (Debian). + apt_repository: repo='ppa:rquillo/ansible' + when: ansible_os_family == 'Debian' + +- name: Update apt cache (Debian). + apt: update_cache=yes cache_valid_time=86400 + when: ansible_os_family == 'Debian' + +- name: Install Ansible (Debian). + apt: pkg=ansible state=installed + when: ansible_os_family == 'Debian' 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/test.yml b/tests/test.yml new file mode 100644 index 0000000..854cb52 --- /dev/null +++ b/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - ansible-role-apache