Skip to content
readme.md 6.03 KiB
Newer Older
# Ansible Centreon

Table of Contents

- [Overview](#overview)
Luiz G. Costa's avatar
Luiz G. Costa committed
  - [Ansible Playbooks](#ansible-playbooks)
  - [Roles](#roles)
- [Versions](#versions)
Luiz G. Costa's avatar
Luiz G. Costa committed
  - [18.10.0](#18.10.0)
- [Requirements](#requirements)
Luiz G. Costa's avatar
Luiz G. Costa committed
  - [Operating systems](#operating-systems)
  - [Control Machine](#control-machine)
- [Installation](#installation)
- [Role Variables](#role-variables)
Luiz G. Costa's avatar
Luiz G. Costa committed
  - [Default Values](#default-values)
- [Examples](#examples)
Luiz G. Costa's avatar
Luiz G. Costa committed
  - [Installation](#simple-installation)
  - [Using Vagrant](docs/vagrant.md)
  - [Using AWS Amazon](docs/ec2.md)
  - [Using Google Cloud](docs/google-cloud.md)
Luiz G. Costa's avatar
Luiz G. Costa committed
  - [Using Microsoft Azure](#microsoft-azure)
  - [Using Digital Ocean](#digital-ocean)
  - [Using Vultr](#vultr)
- [Screencasts](#screencasts)
- [License](LICENSE)

Luiz G. Costa's avatar
Luiz G. Costa committed
## Overview
Luiz G. Costa's avatar
Luiz G. Costa committed
This playbook is a set of scripts and code that assist in automating the installation process and initial setup of the Centreon environment. With Ansible, you have the ability to customize basic system settings and remotely deploy the entire environment.

Everything is based on a single configuration file, containing basic database access and configuration information.

It is also possible to implement and automate the installation of Plugins of the [Plugins Pack](https://documentation.centreon.com/docs/centreon/en/latest/quick_start/basic_plugins.html)

Luiz G. Costa's avatar
Luiz G. Costa committed
### Ansible Playbooks
Luiz G. Costa's avatar
Luiz G. Costa committed

Playbooks express configurations, deployment, and orchestration in Ansible. The Playbook format is YAML. Each Playbook maps a group of hosts to a set of roles. Each role is represented by calls to Ansible tasks.

Luiz G. Costa's avatar
Luiz G. Costa committed
See more information: [Playbooks](https://docs.ansible.com/ansible/latest/user_guide/playbooks.html)
Luiz G. Costa's avatar
Luiz G. Costa committed

Luiz G. Costa's avatar
Luiz G. Costa committed
### Roles
Luiz G. Costa's avatar
Luiz G. Costa committed

Centreon Web Playbook with MySQL Server

- Disable selinux
- Add Centreon Open Source repository
- Import keys from repository
- Install packages to Centreon poller
- Setup timezone to PHP
- Set custom option to Mysql in CentOS 7
- Generate SSH key (used by remote Centreon Poller)
- Start and enable services necessaries
- Setup firewall rules
Luiz G. Costa's avatar
Luiz G. Costa committed

Luiz G. Costa's avatar
Luiz G. Costa committed
Centreon Poller Playbook

- Disable selinux
- Add Centreon Open Source repository
- Import keys from repository
- Install packages to Centreon poller
- Set authorized previously created keys (copy from Centreon-Web)
- Enable and try start centengine service

Luiz G. Costa's avatar
Luiz G. Costa committed
## Versions
Luiz G. Costa's avatar
Luiz G. Costa committed
### 18.10.0

Version with synchronized functions for version 18.10.0 of the Centreon

Luiz G. Costa's avatar
Luiz G. Costa committed
## Requirements
Luiz G. Costa's avatar
Luiz G. Costa committed
### Operating systems
Luiz G. Costa's avatar
Luiz G. Costa committed

This role will work on the following operating systems:
Luiz G. Costa's avatar
Luiz G. Costa committed

Luiz G. Costa's avatar
Luiz G. Costa committed
- Red Hat / Centos
Luiz G. Costa's avatar
Luiz G. Costa committed

Control Machine:
Luiz G. Costa's avatar
Luiz G. Costa committed

- Ansible tools
- Access SSH to remote hosts

Install last version of Ansible

Luiz G. Costa's avatar
Luiz G. Costa committed
[Installation Control Machine](https://docs.ansible.com/ansible/latest/installation_guide/intro_installation.html#installing-the-control-machine)
Luiz G. Costa's avatar
Luiz G. Costa committed
## Installation
Luiz G. Costa's avatar
Luiz G. Costa committed
### Using GIT

```bash
cd ~/work-dir
git clone https://github.com/centreon/centreon-iac-ansible.git
cd centreon-iac-ansible
Luiz G. Costa's avatar
Luiz G. Costa committed
```

Luiz G. Costa's avatar
Luiz G. Costa committed
### Using Ansible Galaxy
Luiz G. Costa's avatar
Luiz G. Costa committed
## Role Variables

Task: mariadb-server

Luiz G. Costa's avatar
Luiz G. Costa committed
- `mysql_root_password`: (string) Password to use with user root
Luiz G. Costa's avatar
Luiz G. Costa committed
- `php_timezone`: (string)

Timezone to configuration of PHP
Luiz G. Costa's avatar
Luiz G. Costa committed
[PHP Timezones](http://php.net/manual/en/timezones.php)
Luiz G. Costa's avatar
Luiz G. Costa committed

- `mysql_hostname`: (string) Hostname or IP to use for connection with Mysql database
- `mysql_port`: (string) Port number to use for connection with Mysql database
- `mysql_root_password`: (string) Password used by user root (you can use variable from mariadb-server task)
- `mysql_centreon_db`: (string) Database name used by Centreon
- `mysql_centstorage_db`: (string) Database name used by Centreon Storage
- `mysql_centreon_username`: (string) Username used by Centreon
- `mysql_centreon_password`: (string) Password user used by Centreon
- `centreon_admin_password`: (string) Password used by user admin (main administrator user)
- `repository`: (string) Centreon repository RPM package URL (Default: `http://yum.centreon.com/standard/18.10/el7/stable/noarch/RPMS/centreon-release-18.10-2.el7.centos.noarch.rpm`)
Luiz G. Costa's avatar
Luiz G. Costa committed
- `plugin_pack`: (array)

A array of plugins pack to install
Valid values:
Luiz G. Costa's avatar
Luiz G. Costa committed

- base-generic
- Centreon
- Centreon DB
- Centreon Poller
- Cisco standard
- Linux SNMP
- MySQL DB
- Printer standard
- UPS Standard
- Windows SNMP
- DHCP Server
- DNS Service
- FTP Server
- HTTP Server
- LDAP Server
- 3com Network
- AIX SNMP
- AKCP Sensor
- Alcatel OXE
- Apache Server

Luiz G. Costa's avatar
Luiz G. Costa committed
### Default values

```yaml
  php_timezone: "Europe/Paris"
  mysql_centreon_hostname: "localhost"
  mysql_centstorage_hostname: "localhost"
  mysql_port: "3306"
  mysql_root_password: "p4ssw0rd"
  mysql_centreon_username: "centreon"
  mysql_centreon_password: "p4ssw0rd"
  mysql_centreon_db: "centreon"
  mysql_centstorage_db: "centreon_storage"
  centreon_admin_password: "p4ssw0rd"
```

Luiz G. Costa's avatar
Luiz G. Costa committed
## Examples
Luiz G. Costa's avatar
Luiz G. Costa committed
### Simple Installation

Simple Installation using a Centos clean install and configure a new Host with Centreon
Luiz G. Costa's avatar
Luiz G. Costa committed

You need a installation of CentOS 7 with SSH server enabled

[Using Vagrant images to prepare Centreon](docs/vagrant.md)

on the control machine, export the ssh key to new host:
Luiz G. Costa's avatar
Luiz G. Costa committed

Luiz G. Costa's avatar
Luiz G. Costa committed
```bash
ssh-copy-id root@[remote-ip-or-hostname]
Create a new file of hosts with the configuration to connect in the remote host, example:
Luiz G. Costa's avatar
Luiz G. Costa committed

Luiz G. Costa's avatar
Luiz G. Costa committed
```bash
vi hosts.deploy
[centreon-server]
centreon-web ansible_port=22 ansible_host=[remote-ip-or-hostname]
```

Create a new file with format YAML to deploy components for installation of Centreon Web

Luiz G. Costa's avatar
Luiz G. Costa committed
```bash
vi centreon-deploy.yml
---
Luiz G. Costa's avatar
Luiz G. Costa committed
- name: Centreon-Web
  hosts: centreon-server
Luiz G. Costa's avatar
Luiz G. Costa committed
  remote_user: root

  roles:
    - "roles/common"
    - role: "roles/mariadb-server"
      mysql_root_password: "p4ssw0rd"
    - role: "roles/centreon-web"
Luiz G. Costa's avatar
Luiz G. Costa committed
      php_timezone: "Europe/Paris"
      mysql_hostname: "localhost"
      mysql_port: "3306"
      mysql_root_password: "p4ssw0rd"
      mysql_centreon_db: "centreon"
      mysql_centstorage_db: "centreon_storage"
      mysql_centreon_username: "centreon"
      mysql_centreon_password: "p4ssw0rd"
      centreon_admin_password: "p4ssw0rd"
Luiz G. Costa's avatar
Luiz G. Costa committed
      plugin_pack:
        - "base-generic"
        - "Linux SNMP"
Luiz G. Costa's avatar
Luiz G. Costa committed
```

Now, you can apply the deploy in remote server, use these command:

Luiz G. Costa's avatar
Luiz G. Costa committed
```bash
ansible-playbook -i hosts.deploy centreon-deploy.yml
Luiz G. Costa's avatar
Luiz G. Costa committed
```