diff --git a/.ruby-version b/.ruby-version new file mode 100644 index 0000000..5bc1cc4 --- /dev/null +++ b/.ruby-version @@ -0,0 +1 @@ +2.2.7 diff --git a/.travis.yml b/.travis.yml index 36bbf62..24922c1 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,29 +1,51 @@ --- language: python -python: "2.7" +python: "2.7_with_system_site_packages" # Use the new container infrastructure -sudo: false +sudo: required +env: + - distro: debian8 + init: /lib/systemd/systemd + run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" + - distro: ubuntu1604 + init: /lib/systemd/systemd + run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" + - distro: centos7 + init: /usr/lib/systemd/systemd + run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro" + - distro: ubuntu1404 + - distro: centos6 -# Install ansible -addons: - apt: - packages: - - python-pip +services: + - docker +before_install: + # Pull container from Docker Hub. + - 'docker pull geerlingguy/docker-${distro}-ansible:latest' -install: - # Install ansible - - pip install ansible - # Check ansible version - - ansible --version +script: + # Create a random file to store the container ID. + #- container_id=$(mktemp) - # Create ansible.cfg with correct roles_path - - printf '[defaults]\nroles_path=../' >ansible.cfg + # Run container detached, with our role mounted inside. + # - 'docker run --detach --volume="${PWD}":/etc/ansible/roles/ansible-observium-agent:ro ${run_opts} geerlingguy/docker-${distro}-ansible:latest "${init}" > "${container_id}"' -script: # Basic role syntax check - - ansible-playbook tests/test.yml -i tests/inventory --syntax-check + # - docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook tests/test.yml -i tests/inventory --syntax-check + # - docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook --connection=local --sudo -v --diff tests/test.yml + # - > + # docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook --connection=local --sudo tests/test.yml + # | grep -q 'changed=0.*failed=0' + # && (echo 'Idempotence test: pass' && exit 0) + # || (echo 'Idempotence test: fail' && exit 1) + + # Download test shim. + - wget -O ${PWD}/tests/test.sh https://gist.githubusercontent.com/teadur/35818c6a66aa7c36a1c91b40c0e2275e/raw/ + - chmod +x ${PWD}/tests/test.sh + + # Run tests. + - ${PWD}/tests/test.sh notifications: - webhooks: https://galaxy.ansible.com/api/v1/notifications/ \ No newline at end of file + webhooks: https://galaxy.ansible.com/api/v1/notifications/ diff --git a/README.md b/README.md index 63a229d..213dfe9 100644 --- a/README.md +++ b/README.md @@ -1,27 +1,32 @@ +[![Build Status](https://travis-ci.org/teadur/ansible-observium-agent.svg?branch=master)](https://travis-ci.org/teadur/ansible-observium-agent) + observium-agent ========= -This role manages observium-agent on Debian based Linux. -It configures xinetd to run obserivum-agent and deploys defined agent plugins to host. +This role manages observium-agent on Linux. +It configures install/configures xinetd to run obserivum-agent and deploys defined agent plugins to host. + Requirements ------------ Xinetd running on host ( installed by this role ) + +SNMP running on host ( only configuration is modified, one oid is added, must be installed by some other role) + Role Variables -------------- -observium_host: host running observium ( defaults to 127.0.0.1 ) +observium_host: host running observium ( defaults to 127.0.0.1 ) + obs_agent_pg_enable: boolean (default false) + obs_agent_apache_enable: boolean (default false) + obs_agent_bind_enable: boolean (default false) All variables can be found in defaults/main.yml -Dependencies ------------- - -None Example Playbook ---------------- diff --git a/meta/main.yml b/meta/main.yml index 94004e7..45d9e4f 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,6 +1,6 @@ galaxy_info: author: Georg Kahest - description: Role to manage/install Observium agent on Debian + description: Role to manage/install Observium agent and plugins on Linux company: your company (optional) license: MIT min_ansible_version: 2.2 @@ -105,8 +105,8 @@ galaxy_info: # - 9.1 # - 9.2 # - 9.3 - #- name: Ubuntu - # versions: + - name: Ubuntu + versions: # - all # - lucid # - maverick @@ -116,11 +116,11 @@ galaxy_info: # - quantal # - raring # - saucy - # - trusty + - trusty # - utopic # - vivid # - wily - # - xenial + - xenial - name: Debian versions: # - all @@ -131,12 +131,12 @@ galaxy_info: # - squeeze - stretch - wheezy - #- name: EL - # versions: + - name: EL + versions: # - all # - 5 - # - 6 - # - 7 + - 6 + - 7 #- name: Windows # versions: # - all diff --git a/tasks/main.yml b/tasks/main.yml index b8f1b16..4357cb3 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -3,7 +3,7 @@ - name: be sure xinetd is installed apt: pkg=xinetd state=installed tags: xinetd - when: ansible_distribution == "Debian" + when: ansible_distribution == "Debian" or ansible_distribution == "Ubuntu" - name: be sure xinetd is installed yum: pkg=xinetd state=installed diff --git a/tests/test.yml b/tests/test.yml index 0e83a83..4e00a13 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -2,4 +2,4 @@ - hosts: localhost remote_user: root roles: - - observium-agent \ No newline at end of file + - role_under_test