This repository has been archived by the owner on Dec 16, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Configure user, group and mode for config files (#2)
* Add configs user,group and mode * review fixes
- Loading branch information
Showing
16 changed files
with
350 additions
and
31 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
/tests/*.retry |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
language: generic | ||
|
||
sudo: required | ||
|
||
services: | ||
- docker | ||
|
||
before_install: | ||
- docker pull manala/ansible-debian:wheezy | ||
- docker pull manala/ansible-debian:jessie | ||
|
||
script: | ||
- make lint@wheezy | ||
- make test@wheezy | ||
- make lint@jessie | ||
- make test@jessie | ||
|
||
notifications: | ||
webhooks: | ||
urls: | ||
- https://galaxy.ansible.com/api/v1/notifications/ | ||
- https://webhooks.gitter.im/e/430e0a92ad6370b7b805 | ||
on_success: change | ||
on_failure: always | ||
on_start: never |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
# Change Log | ||
All notable changes to this project will be documented in this file. | ||
|
||
The format is based on [Keep a Changelog](http://keepachangelog.com/) | ||
and this project adheres to [Semantic Versioning](http://semver.org/). | ||
|
||
## [Unreleased] | ||
|
||
## [1.0.0] - 2016-01-24 | ||
|
||
### Added | ||
- Install and configure sensu-server, sensu-client and sensu-api | ||
- Install ruby gems | ||
- Configure sensu checks |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,108 @@ | ||
.SILENT: | ||
.PHONY: help | ||
|
||
## Colors | ||
COLOR_RESET = \033[0m | ||
COLOR_INFO = \033[32m | ||
COLOR_COMMENT = \033[33m | ||
|
||
## Role | ||
ROLE_NAME = manala.sensu | ||
|
||
## Macros | ||
DOCKER = docker run \ | ||
--rm \ | ||
--volume `pwd`:/etc/ansible/roles/${ROLE_NAME} \ | ||
--volume `pwd`:/srv \ | ||
--workdir /srv \ | ||
--tty \ | ||
--cap-add SYS_PTRACE \ | ||
${DOCKER_OPTIONS} \ | ||
manala/ansible-debian:${DEBIAN_DISTRIBUTION} \ | ||
${DOCKER_COMMAND} | ||
|
||
## Help | ||
help: | ||
printf "${COLOR_COMMENT}Usage:${COLOR_RESET}\n" | ||
printf " make [target]\n\n" | ||
printf "${COLOR_COMMENT}Available targets:${COLOR_RESET}\n" | ||
awk '/^[a-zA-Z\-\_0-9\.@]+:/ { \ | ||
helpMessage = match(lastLine, /^## (.*)/); \ | ||
if (helpMessage) { \ | ||
helpCommand = substr($$1, 0, index($$1, ":")); \ | ||
helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ | ||
printf " ${COLOR_INFO}%-16s${COLOR_RESET} %s\n", helpCommand, helpMessage; \ | ||
} \ | ||
} \ | ||
{ lastLine = $$0 }' $(MAKEFILE_LIST) | ||
|
||
####### | ||
# Dev # | ||
####### | ||
|
||
dev@wheezy: DEBIAN_DISTRIBUTION = wheezy | ||
dev@wheezy: DOCKER_OPTIONS = --interactive | ||
dev@wheezy: DOCKER_COMMAND = /bin/bash | ||
dev@wheezy: | ||
printf "${COLOR_INFO}Run docker...${COLOR_RESET}\n" | ||
$(DOCKER) | ||
|
||
dev@jessie: DEBIAN_DISTRIBUTION = jessie | ||
dev@jessie: DOCKER_OPTIONS = --interactive | ||
dev@jessie: DOCKER_COMMAND = /bin/bash | ||
dev@jessie: | ||
printf "${COLOR_INFO}Run docker...${COLOR_RESET}\n" | ||
$(DOCKER) | ||
|
||
######## | ||
# Lint # | ||
######## | ||
|
||
lint@wheezy: DEBIAN_DISTRIBUTION = wheezy | ||
lint@wheezy: DOCKER_COMMAND = make lint | ||
lint@wheezy: | ||
printf "${COLOR_INFO}Run docker...${COLOR_RESET}\n" | ||
$(DOCKER) | ||
|
||
lint@jessie: DEBIAN_DISTRIBUTION = jessie | ||
lint@jessie: DOCKER_COMMAND = make lint | ||
lint@jessie: | ||
printf "${COLOR_INFO}Run docker...${COLOR_RESET}\n" | ||
$(DOCKER) | ||
|
||
lint: | ||
ansible-lint -v . | ||
|
||
######## | ||
# Test # | ||
######## | ||
|
||
test@wheezy: DEBIAN_DISTRIBUTION = wheezy | ||
test@wheezy: DOCKER_COMMAND = sh -c 'make test' | ||
test@wheezy: | ||
printf "${COLOR_INFO}Run docker...${COLOR_RESET}\n" | ||
$(DOCKER) | ||
|
||
test@jessie: DEBIAN_DISTRIBUTION = jessie | ||
test@jessie: DOCKER_COMMAND = sh -c 'make test' | ||
test@jessie: | ||
printf "${COLOR_INFO}Run docker...${COLOR_RESET}\n" | ||
$(DOCKER) | ||
|
||
test: test-install test-config test-configs test-gems | ||
|
||
test-install: | ||
ansible-playbook tests/install.yml --syntax-check | ||
ansible-playbook tests/install.yml | ||
|
||
test-config: | ||
ansible-playbook tests/config.yml --syntax-check | ||
ansible-playbook tests/config.yml | ||
|
||
test-configs: | ||
ansible-playbook tests/configs.yml --syntax-check | ||
ansible-playbook tests/configs.yml | ||
|
||
test-gems: | ||
ansible-playbook tests/gems.yml --syntax-check | ||
ansible-playbook tests/gems.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,22 @@ | ||
--- | ||
|
||
manala_sensu_services: [] | ||
|
||
manala_sensu_gems: [] | ||
|
||
# Config | ||
manala_sensu_config_template: ~ | ||
manala_sensu_config: [] | ||
|
||
# Gems | ||
manala_sensu_gems: [] | ||
|
||
# Configs | ||
manala_sensu_configs_template: ~ | ||
manala_sensu_configs: [] | ||
manala_sensu_configs_exclusive: false | ||
manala_sensu_configs_user: ~ | ||
manala_sensu_configs_group: ~ | ||
manala_sensu_configs_mode: ~ | ||
|
||
# Checks | ||
manala_sensu_checks: [] | ||
|
||
# Services | ||
manala_sensu_services: [] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,4 +15,7 @@ galaxy_info: | |
- wheezy | ||
- jessie | ||
galaxy_tags: | ||
- alerting | ||
- monitoring | ||
- system | ||
- sensu |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,17 +1,14 @@ | ||
--- | ||
|
||
- set_fact: | ||
_manala_sensu_embedded_ruby: "{{ manala_sensu_config.EMBEDDED_RUBY|default(false) }}" | ||
|
||
- name: packages > Setup gem packages | ||
gem: | ||
name: "{{ item.name }}" | ||
executable: "{{ item.executable|default('/opt/sensu/embedded/bin/gem' if _manala_sensu_embedded_ruby else omit) }}" | ||
gem_source: "{{ item.gem_source|default(omit) }}" | ||
include_dependencies: "{{ item.include_dependencies|default(omit) }}" | ||
pre_release: "{{ item.pre_release|default(omit) }}" | ||
repository: "{{ item.repository|default(omit) }}" | ||
state: "{{ item.state|default(omit) }}" | ||
user_install: "{{ item.user_install|default(false) }}" | ||
version: "{{ item.version|default(omit) }}" | ||
name: "{{ item.name }}" | ||
executable: "{{ item.executable|default((manala_sensu_config.EMBEDDED_RUBY|default(false))|ternary('/opt/sensu/embedded/bin/gem', omit)) }}" | ||
gem_source: "{{ item.gem_source|default(omit) }}" | ||
include_dependencies: "{{ item.include_dependencies|default(omit) }}" | ||
pre_release: "{{ item.pre_release|default(omit) }}" | ||
repository: "{{ item.repository|default(omit) }}" | ||
state: "{{ item.state|default(omit) }}" | ||
user_install: "{{ item.user_install|default(false) }}" | ||
version: "{{ item.version|default(omit) }}" | ||
with_items: "{{ manala_sensu_gems }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
--- | ||
|
||
- hosts: all | ||
|
||
vars: | ||
manala_sensu_config: | ||
EMBEDDED_RUBY: true | ||
LOG_LEVEL: warn | ||
|
||
pre_tasks: | ||
- include: pre_tasks/apt.yml | ||
|
||
roles: | ||
- manala.sensu | ||
|
||
post_tasks: | ||
|
||
- name: Goss | ||
raw: "{{ 'echo \"' ~ item|to_yaml ~ '\"|goss -g - validate' }}" | ||
with_items: | ||
- file: | ||
/etc/default/sensu: | ||
exists: true | ||
owner: root | ||
group: root | ||
contains: | ||
- EMBEDDED_RUBY=true | ||
- LOG_LEVEL=warn |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
--- | ||
|
||
- hosts: all | ||
|
||
vars: | ||
manala_sensu_configs_user: root | ||
manala_sensu_configs_group: sensu | ||
manala_sensu_configs_mode: '0640' | ||
|
||
manala_sensu_configs: | ||
- file: transport.json | ||
config: | ||
transport: | ||
name: redis | ||
- file: redis.json | ||
user: sensu | ||
group: sensu | ||
mode: '0600' | ||
config: | ||
redis: | ||
host: localhost | ||
|
||
pre_tasks: | ||
- include: pre_tasks/apt.yml | ||
|
||
roles: | ||
- manala.sensu | ||
|
||
post_tasks: | ||
|
||
- name: Goss | ||
raw: "{{ 'echo \"' ~ item|to_yaml ~ '\"|goss -g - validate' }}" | ||
with_items: | ||
- file: | ||
/etc/sensu/conf.d/transport.json: | ||
exists: true | ||
owner: root | ||
group: sensu | ||
mode: '0640' | ||
contains: | ||
- redis | ||
/etc/sensu/conf.d/redis.json: | ||
exists: true | ||
owner: sensu | ||
group: sensu | ||
mode: '0600' | ||
contains: | ||
- localhost |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
--- | ||
|
||
- hosts: all | ||
|
||
vars: | ||
manala_sensu_config: | ||
EMBEDDED_RUBY: true | ||
manala_sensu_gems: | ||
- name: sensu-plugins-slack | ||
version: 1.0.0 | ||
|
||
pre_tasks: | ||
- include: pre_tasks/apt.yml | ||
|
||
roles: | ||
- manala.sensu | ||
|
||
post_tasks: | ||
|
||
- name: Goss | ||
raw: "{{ 'echo \"' ~ item|to_yaml ~ '\"|goss -g - validate' }}" | ||
with_items: | ||
- command: | ||
/opt/sensu/embedded/bin/gem list|grep sensu-plugins-slack: | ||
exit-status: 0 |
Oops, something went wrong.