Initial commit

Signed-off-by: Paul Belanger <pabelanger@redhat.com>
This commit is contained in:
Paul Belanger 2015-08-27 21:15:48 -04:00
commit 16fffcdcbc
15 changed files with 283 additions and 0 deletions

31
.travis.yml Normal file
View File

@ -0,0 +1,31 @@
---
language: python
python: "2.7"
env:
global:
- ANSIBLE_CONFIG=tests/ansible.cfg
matrix:
- SITE=test001.yaml
- SITE=test002.yaml
before_install:
- sudo apt-get update -qq
install:
# Install Ansible.
- pip install ansible
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)

20
README.rst Normal file
View File

@ -0,0 +1,20 @@
nodepool
========
Requirements
------------
Role Variables
--------------
Dependencies
------------
Example Playbook
----------------
License
-------
Author Information
------------------

9
defaults/main.yaml Normal file
View File

@ -0,0 +1,9 @@
---
# tasks/install.yaml
nodepool_git_dest: /opt/git/openstack-infra/nodepool
nodepool_git_uri: https://git.openstack.org/openstack-infra/nodepool
nodepool_git_version: master
nodepool_install_method: git
nodepool_pip_version:

2
handlers/main.yaml Normal file
View File

@ -0,0 +1,2 @@
---
# handlers file for nodepool

139
meta/main.yaml Normal file
View File

@ -0,0 +1,139 @@
---
galaxy_info:
author: your name
description:
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Some suggested licenses:
# - BSD (default)
# - MIT
# - GPLv2
# - GPLv3
# - Apache
# - CC-BY
license: license (GPLv2, CC-BY, etc)
min_ansible_version: 1.2
#
# Below are all platforms currently available. Just uncomment
# the ones that apply to your role. If you don't see your
# platform on this list, let us know and we'll get it added!
#
#platforms:
#- name: EL
# versions:
# - all
# - 5
# - 6
# - 7
#- name: GenericUNIX
# versions:
# - all
# - any
#- name: Fedora
# versions:
# - all
# - 16
# - 17
# - 18
# - 19
# - 20
# - 21
# - 22
#- name: Windows
# versions:
# - all
# - 2012R2
#- name: SmartOS
# versions:
# - all
# - any
#- name: opensuse
# versions:
# - all
# - 12.1
# - 12.2
# - 12.3
# - 13.1
# - 13.2
#- name: Amazon
# versions:
# - all
# - 2013.03
# - 2013.09
#- name: GenericBSD
# versions:
# - all
# - any
#- name: FreeBSD
# versions:
# - all
# - 8.0
# - 8.1
# - 8.2
# - 8.3
# - 8.4
# - 9.0
# - 9.1
# - 9.1
# - 9.2
#- name: Ubuntu
# versions:
# - all
# - lucid
# - maverick
# - natty
# - oneiric
# - precise
# - quantal
# - raring
# - saucy
# - trusty
# - utopic
# - vivid
#- name: SLES
# versions:
# - all
# - 10SP3
# - 10SP4
# - 11
# - 11SP1
# - 11SP2
# - 11SP3
#- name: GenericLinux
# versions:
# - all
# - any
#- name: Debian
# versions:
# - all
# - etch
# - jessie
# - lenny
# - squeeze
# - wheezy
#
# Below are all categories currently available. Just as with
# the platforms above, uncomment those that apply to your role.
#
#categories:
#- cloud
#- cloud:ec2
#- cloud:gce
#- cloud:rax
#- clustering
#- database
#- database:nosql
#- database:sql
#- development
#- monitoring
#- networking
#- packaging
#- system
#- web
dependencies: []
# List your role dependencies here, one per line.
# Be sure to remove the '[]' above if you add dependencies
# to this list.

1
tasks/config.yaml Normal file
View File

@ -0,0 +1 @@
---

41
tasks/install.yaml Normal file
View File

@ -0,0 +1,41 @@
---
- name: Define nodepool_build_depends.
set_fact:
nodepool_build_depends: "{{ __nodepool_build_depends | list }}"
when: nodepool_build_depends is not defined
- name: Define nodepool_depends.
set_fact:
nodepool_depends: "{{ __nodepool_depends | list }}"
when: nodepool_depends is not defined
- include: install/debian.yaml
when: ansible_os_family == 'Debian'
- name: Download nodepool using git.
git:
dest: "{{ nodepool_git_dest }}"
repo: "{{ nodepool_git_uri }}"
version: "{{ nodepool_git_version }}"
when: nodepool_install_method == 'git'
- name: Install nodepool using pip.
pip:
name: "file://{{ nodepool_git_dest }}"
when: nodepool_install_method == 'git'
- name: Install nodepool using pip.
pip:
name: nodepool
when: nodepool_install_method == 'pip'
- name: Install nodepool using pip.
pip:
name: nodepool
when: nodepool_install_method == 'pip' and nodepool_pip_version is none
- name: Install nodepool using pip.
pip:
name: nodepool
version: "{{ nodepool_pip_version }}"
when: nodepool_install_method == 'pip' and nodepool_pip_version is not none

View File

@ -0,0 +1,9 @@
---
- name: Ensure build dependencies are installed.
apt: "pkg={{ item }} state=installed"
with_items: nodepool_build_depends
when: nodepool_install_method == 'git' or nodepool_install_method == 'pip'
- name: Ensure dependencies are installed.
apt: "pkg={{ item }} state=installed"
with_items: nodepool_depends

9
tasks/main.yaml Normal file
View File

@ -0,0 +1,9 @@
---
- name: Include OS-specific variables.
include_vars: "{{ ansible_os_family }}.yaml"
- include: install.yaml
- include: config.yaml
- include: service.yaml

1
tasks/service.yaml Normal file
View File

@ -0,0 +1 @@
---

2
tests/ansible.cfg Normal file
View File

@ -0,0 +1,2 @@
[defaults]
roles_path = ..

1
tests/inventory Normal file
View File

@ -0,0 +1 @@
localhost

4
tests/test001.yaml Normal file
View File

@ -0,0 +1,4 @@
---
- hosts: localhost
roles:
- ansible-role-nodepool

4
tests/test002.yaml Normal file
View File

@ -0,0 +1,4 @@
---
- hosts: localhost
roles:
- { role: ansible-role-nodepool, nodepool_install_method: 'pip' }

10
vars/Debian.yaml Normal file
View File

@ -0,0 +1,10 @@
---
__nodepool_build_depends:
- libxml2-dev
- libxslt1-dev
- python-dev
- zlib1g-dev
__nodepool_depends:
- debootstrap
- qemu-utils