Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
60a2ff6
added molecule v2 tests
pablodav Jan 2, 2019
b77b770
update travis tests
pablodav Jan 2, 2019
3e9e355
Modify support for Debian Ubuntu
pablodav Jan 2, 2019
03da50b
fixes on plugins install
pablodav Jan 2, 2019
7049737
fixes on warnings and vars names
pablodav Jan 2, 2019
5e6e5a9
add test for 1804 and some fixes on tasks
pablodav Jan 2, 2019
6142d6e
add check for nagios service started
pablodav Jan 2, 2019
2f34409
fix for ubuntu 1804
pablodav Jan 2, 2019
e289917
Merge branch 'master' into support_ubuntu1604
pablodav Jan 2, 2019
26d98cb
fix travis tests
pablodav Jan 2, 2019
5bef35f
Merge pull request #1 from CoffeeITWorks/support_ubuntu1604
pablodav Jan 2, 2019
6a7ef98
fixes on lint
pablodav Jan 3, 2019
936b780
Merge pull request #2 from CoffeeITWorks/support_ubuntu1604
pablodav Jan 3, 2019
c3c19c7
fix missing mailutils deps
pablodav Jan 10, 2019
73e80ea
fixes to enable nagios site refs #4
pablodav Mar 25, 2019
1d2c301
fix loading variables
pablodav Mar 25, 2019
95fec01
more fixes for distribution and os-family vars
pablodav Mar 25, 2019
4188c10
fix on test nagios site
pablodav Mar 25, 2019
1c6b514
fixes on include-vars specific per distribution
pablodav Mar 25, 2019
d38e062
keep data confidential on log
pablodav Mar 25, 2019
a841560
Correct privacy settings under htpaswd operations
it-praktyk Jan 22, 2020
db2fe1c
Merge pull request #6 from it-praktyk/Correct_privacy_settings
pablodav Jan 25, 2020
f93d345
Add yamllint settings and adjustments
it-praktyk Feb 3, 2020
28f07ad
Merge pull request #7 from it-praktyk/yamllint
pablodav Feb 7, 2020
02c3387
1.1.5 molecule v3 tests, minor fixes on newer systems
pablodav May 11, 2020
35476cf
Merge pull request #8 from CoffeeITWorks/develop
pablodav May 11, 2020
7c0fe4f
fix molecule tests
pablodav Mar 29, 2021
d14874a
remove requirements file due to failures tests with molecule
pablodav Mar 29, 2021
737c1b8
fixes molecule, centos8 and small tweaks in names
pablodav Apr 1, 2021
ec23e01
test centos8
pablodav Apr 1, 2021
d6f27c8
support centos8 update defaults to 4.4.6
pablodav Apr 1, 2021
94164f4
fix galaxy naming
pablodav Apr 1, 2021
9301bae
fixes on dependencies
pablodav Apr 1, 2021
4656172
more fixes on dependencies
pablodav Apr 1, 2021
1832268
small fixes on variables
pablodav Apr 1, 2021
a6d5a30
yaml list fixes
pablodav Apr 1, 2021
5aa8175
Fixes missing variables RedHat
pablodav Apr 1, 2021
0940edb
fixes for debian tests
pablodav Apr 1, 2021
6e65918
fix to php-mycrypt library not available on Debian10+
pablodav Apr 2, 2021
89a486b
Merge pull request #9 from CoffeeITWorks/develop
pablodav Apr 2, 2021
8c05a9c
:bug: Adding cent 8 support and fixing include problem
Findarato May 17, 2022
d869b70
:fire: CentOS 6 is Dead
Findarato May 17, 2022
9afd90d
:art: Lots of formatting to make it look better
Findarato May 17, 2022
c0b0146
:bug: Fixed daemon not reloading
Findarato May 17, 2022
55171f4
Merge pull request #11 from Findarato/master
pablodav May 18, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
.bundle/
.vagrant/
.molecule/
72 changes: 14 additions & 58 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -1,68 +1,24 @@
---
# http://www.jeffgeerling.com/blog/testing-ansible-roles-travis-ci-github
sudo: required

env:
- distribution: centos
version: 6
init: /sbin/init
run_opts: ""
playbook: test.yml
- distribution: centos
version: 7
init: /usr/lib/systemd/systemd
run_opts: "--privileged --volume=/sys/fs/cgroup:/sys/fs/cgroup:ro"
playbook: test.yml
- distribution: ubuntu
version: 14.04
init: /sbin/init
run_opts: ""
playbook: test.yml

language: python
services:
- docker

before_install:
# Pull container
- 'sudo docker pull ${distribution}:${version}'
# Customize container
- 'sudo docker build --rm=true --file=tests/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests'

script:
- container_id=$(mktemp)

# Run container in detached state
- 'sudo docker run --detach --volume="${PWD}":/etc/ansible/roles/ansible-role-nagios:ro ${run_opts} ${distribution}-${version}:ansible "${init}" > "${container_id}"'
- sudo apt-get -qq update
# - docker build --tag molecule_local/fedora-rawhide2:latest -f molecule/default/fedorar/Dockerfile molecule/default/fedorar

# Ansible syntax check.
- 'sudo docker exec --tty "$(cat ${container_id})" env TERM=xterm ansible-playbook /etc/ansible/roles/ansible-role-nagios/tests/${playbook} --syntax-check'
install:
- sudo apt-get install -y python-pip libssl-dev libffi-dev
- pip install ansible
- pip install "molecule[docker]"
# - ansible-galaxy install -r requirements.yml

# Ansible role check.
- 'sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/ansible-role-nagios/tests/${playbook}'

# Test role idempotence.
- >
sudo docker exec "$(cat ${container_id})" ansible-playbook /etc/ansible/roles/ansible-role-nagios/tests/${playbook}
| grep -q 'changed=0.*failed=0'
&& (echo 'Idempotence test: pass' && exit 0)
|| (echo 'Idempotence test: fail' && exit 1)

# Test Nagios server use running.
- >
sudo docker exec "$(cat ${container_id})" service nagios status
| grep -q 'nagios.*running'
&& (echo 'Service nagios test: pass' && exit 0)
|| (echo 'Service nagios test: fail' && exit 1)


# Verify that we can see the web frontend
- >
sudo docker exec "$(cat ${container_id})" curl -s http://nagiosadmin:Password1change@127.0.0.1/nagios/cgi-bin/statusjson.cgi?query=programstatus 2>/dev/null
| grep -q '"version": "4.3.2"'
&& (echo 'Web frontend nagios test: pass' && exit 0)
|| (echo 'Web frontend nagios test: fail' && exit 1)

# Clean up
- sudo docker stop "$(cat ${container_id})"
script:
- molecule --debug create
- molecule converge
- molecule syntax
# - molecule idempotence

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
12 changes: 12 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
extends: default

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
line-length: disable
truthy: disable
9 changes: 9 additions & 0 deletions CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
### 1.2.0
* Support centos8, removing support centos7
* Update defaults to 4.4.6

### 1.1.5

* update molecule v3 tests
* fixes on Ubuntu 18.04 and other minor fixes

### 1.0.2

* Fixed EPEL issue under CentOS 7.0
Expand Down
18 changes: 18 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
# config file for ansible -- http://ansible.com/
# ==============================================

# nearly all parameters can be overridden in ansible-playbook
# or with command line flags. ansible will read ANSIBLE_CONFIG,
# ansible.cfg in the current working directory, .ansible.cfg in
# the home directory or /etc/ansible/ansible.cfg, whichever it
# finds first

[defaults]
roles_path = ../:/etc/ansible/roles:~/.ansible/roles
host_key_checking = False

retry_files_enabled = False
callback_whitelist = profile_tasks

[ssh_connection]
pipelining = False
4 changes: 3 additions & 1 deletion defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# Directory that will be used as the location for the downloads§
download_dir: "{{ ansible_env.HOME }}/nagios"

nagios_version: 4.3.2
nagios_version: 4.4.6
# Define the download url for the Nagios Core source files and the version you want to use.
nagiosurl: "https://assets.nagios.com/downloads/nagioscore/releases/nagios-{{ nagios_version }}.tar.gz"

Expand All @@ -31,3 +31,5 @@ nagios_users:

# This option will be used if you want to uninstall debian packages for nagios and check-mk-livestatus
ansible_role_nagios_remove_packages: false

nagios_service: nagios
9 changes: 7 additions & 2 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,12 @@
---
# handlers file for nagios
- name: restart apache
service: name={{ apache_service }} state=restarted
ansible.builtin.systemd:
name: "{{ apache_service }}"
state: restarted

- name: restart nagios
service: name=nagios state=restarted
ansible.builtin.systemd:
name: nagios
state: restarted
daemon_reload: yes
178 changes: 19 additions & 159 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,172 +1,32 @@
---
galaxy_info:
author: Patrick Ogenstad
author: Networklore
description: Install Nagios 4.x on Ubuntu or CentOS
company: Networklore

# 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: BSD

min_ansible_version: 1.9

# Optionally specify the branch Galaxy will use when accessing the GitHub
# repo for this role. During role install, if no tags are available,
# Galaxy will use this branch. During import Galaxy will access files on
# this branch. If travis integration is cofigured, only notification for this
# branch will be accepted. Otherwise, in all cases, the repo's default branch
# (usually master) will be used.
#github_branch:
min_ansible_version: "1.9"

#
# 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: Solaris
# versions:
# - all
# - 10
# - 11.0
# - 11.1
# - 11.2
# - 11.3
#- name: Fedora
# versions:
# - all
# - 16
# - 17
# - 18
# - 19
# - 20
# - 21
# - 22
# - 23
#- name: opensuse
# versions:
# - all
# - 12.1
# - 12.2
# - 12.3
# - 13.1
# - 13.2
#- name: IOS
# versions:
# - all
# - any
#- name: SmartOS
# versions:
# - all
# - any
#- name: eos
# versions:
# - all
# - Any
#- name: Windows
# versions:
# - all
# - 2012R2
#- name: Amazon
# versions:
# - all
# - 2013.03
# - 2013.09
#- name: GenericBSD
# versions:
# - all
# - any
#- name: Junos
# versions:
# - all
# - any
#- name: FreeBSD
# versions:
# - all
# - 10.0
# - 10.1
# - 10.2
# - 8.0
# - 8.1
# - 8.2
# - 8.3
# - 8.4
# - 9.0
# - 9.1
# - 9.1
# - 9.2
# - 9.3
- name: Ubuntu
versions:
# - all
# - lucid
# - maverick
# - natty
# - oneiric
# - precise
# - quantal
# - raring
# - saucy
- trusty
# - utopic
# - vivid
# - wily
# - xenial
#- name: SLES
# versions:
# - all
# - 10SP3
# - 10SP4
# - 11
# - 11SP1
# - 11SP2
# - 11SP3
#- name: GenericLinux
# versions:
# - all
# - any
#- name: NXOS
# versions:
# - all
# - any
#- name: Debian
# versions:
# - all
# - etch
# - jessie
# - lenny
# - squeeze
# - wheezy
- name: EL
versions:
- "7"
- "8"

- name: Ubuntu
versions:
- trusty
- xenial
- bionic

- name: Debian
versions:
- jessie
- wheezy
- stretch

galaxy_tags:
- monitoring
# List tags for your role here, one per line. A tag is
# a keyword that describes and categorizes the role.
# Users find roles by searching for tags. Be sure to
# remove the '[]' above if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of
# alphanumeric characters. Maximum 20 tags per role.

dependencies: []
# List your role dependencies here, one per line.
# Be sure to remove the '[]' above if you add dependencies
# to this list.
Loading