Skip to content

Commit

Permalink
Initial working version
Browse files Browse the repository at this point in the history
  • Loading branch information
tersmitten committed Dec 5, 2016
1 parent b6a92be commit 8508609
Show file tree
Hide file tree
Showing 14 changed files with 304 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
80 changes: 80 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
---
sudo: required
dist: trusty

language: python
python: "2.7"

env:
- ANSIBLE_VERSION=latest
- ANSIBLE_VERSION=2.2.0.0
- 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
- ANSIBLE_VERSION=1.9.5
- ANSIBLE_VERSION=1.9.4
- ANSIBLE_VERSION=1.9.3
- ANSIBLE_VERSION=1.9.2
- ANSIBLE_VERSION=1.9.1
- ANSIBLE_VERSION=1.9.0.1
- ANSIBLE_VERSION=1.8.4
- ANSIBLE_VERSION=1.8.3
- ANSIBLE_VERSION=1.8.2
- ANSIBLE_VERSION=1.8.1
- ANSIBLE_VERSION=1.8
- ANSIBLE_VERSION=1.7.2
- ANSIBLE_VERSION=1.7.1
- ANSIBLE_VERSION=1.7
- ANSIBLE_VERSION=1.6.9
- ANSIBLE_VERSION=1.6.8
- ANSIBLE_VERSION=1.6.7
- ANSIBLE_VERSION=1.6.6
- ANSIBLE_VERSION=1.6.5
- ANSIBLE_VERSION=1.6.4
- ANSIBLE_VERSION=1.6.3
- ANSIBLE_VERSION=1.6.2
- ANSIBLE_VERSION=1.6.10
- ANSIBLE_VERSION=1.6.1
- ANSIBLE_VERSION=1.6

branches:
only:
- master

before_install:
- sudo apt-get update -qq

# Remove haveged
- sudo apt-get remove --purge --yes haveged

install:
# Install Ansible.
- if [ "$ANSIBLE_VERSION" = "latest" ]; then pip install --no-binary ansible ansible; else pip install --no-binary ansible ansible==$ANSIBLE_VERSION; 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)
notifications:
email: false
hipchat:
rooms:
secure: K4TxXOa2nMT9L/hozL1P+CBSqIpVsohu0LA5H1cUGGIpKs1Fp/JBfjXfaWTlVV6cXFeK1sTAfwHGEtFzb5TkVFDonx/YT4rEJk1dBqkBUwcMZ9+1Pbz5xBfYhzgrx+yDnqSSsOwzYp9XuV7oR7lpiEBSXnjXR3/hNTJRMfAWzsknF+9+mBKWxm7EEGuzdboLkF6NCQvtBZRBM03EjUW3+WtlEsDx/6o7O2uVhuoXSJCYZ4XFmRxjjzWNEvbdKdhJxLXnT9m1MQDMO39tlo5/fACbNXf9fQKt7MZBtTRegQ3Rdu0lFJPchs/iusVyJ7i9QqFTg3P4AF5vjvWTkvO4Pa2eJubktnFp1Ga1EH/9yuZXU+mHINDIIeBSgGrfy2dM+APP8NjFmF04XVlQ0iHqJ1Tbwr2Cosvy84rv151EQ1hf9paZYvgpN/B6NTWXX4q8qSYMrgt67/qaUQZnZ/iRwFd2YYnpQVqZ47rVaJmrcVSpAyb8M+uSz6k2rTxtXnU3HFfLtkbXjyGxCX418cDr97QHNQi7emsA+ySPFd2lafFRT+cSW66wiyxQGih4XidWp6VoKgjAVGDZ3tn+bOu6pb1MZIcI3GsG9Thm3BdptFpBjcye3CK4yamtaHIrQChEipGeRdZ6xHbu/jo4Me8EP1sU3+tKQwrw1sK8j3gTkHk=
webhooks: https://galaxy.ansible.com/api/v1/notifications/
40 changes: 40 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
## haveged

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

Set up [haveged](https://www.digitalocean.com/community/tutorials/how-to-setup-additional-entropy-for-cloud-servers-using-haveged) in Debian-like systems.

#### Requirements

None

#### Variables

* `haveged_install`: [default: `[]`]: Additional packages to install

* `haveged_daemon_args`: [default: `['-w 1024']`]: Options to pass to haveged

## Dependencies

None

#### Example

```yaml
---
- hosts: all
roles:
- haveged
```
#### License
MIT
#### Author Information
Mischa ter Smitten
#### Feedback, bug-reports, requests, ...
Are [welcome](https://github.com/Oefenweb/ansible-haveged/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
6 changes: 6 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# defaults file for haveged
---
haveged_install: []

haveged_daemon_args:
- '-w 1024'
Empty file added files/empty
Empty file.
6 changes: 6 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# handlers file for haveged
---
- name: restart haveged
service:
name: haveged
state: restarted
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 haveged
---
galaxy_info:
author: Mischa ter Smitten
company: Oefenweb.nl B.V.
description: Set up haveged in Debian-like systems
license: MIT
min_ansible_version: 1.6
platforms:
- name: Ubuntu
versions:
- precise
- trusty
- xenial
- name: Debian
versions:
- wheezy
- jessie
galaxy_tags:
- system
- networking
dependencies: []
35 changes: 35 additions & 0 deletions tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# tasks file for haveged
---
- 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: "{{ haveged_dependencies }}"
tags:
- configuration
- haveged
- haveged-dependencies

- name: install additional
apt:
name: "{{ item }}"
state: "{{ apt_install_state | default('latest') }}"
with_items: "{{ haveged_install }}"
tags:
- configuration
- haveged
- haveged-install

- name: update configuration file - /etc/default/haveged.conf
template:
src: etc/default/haveged.j2
dest: /etc/default/haveged
owner: root
group: root
mode: 0644
tags:
- configuration
- haveged
- haveged-configuration
3 changes: 3 additions & 0 deletions templates/etc/default/haveged.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# {{ ansible_managed }}

DAEMON_ARGS="{{ haveged_daemon_args | join(' ') }}"
1 change: 1 addition & 0 deletions tests/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
localhost
7 changes: 7 additions & 0 deletions tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# test file for haveged
---
- hosts: localhost
connection: local
sudo: true
roles:
- ../../
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 haveged
---
- hosts: all
remote_user: vagrant
sudo: true
roles:
- ../../
4 changes: 4 additions & 0 deletions vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# vars file for haveged
---
haveged_dependencies:
- haveged

0 comments on commit 8508609

Please sign in to comment.