Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 12 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[defaults]

inventory = ./inventory
remote_user = qtsbautista
deprecaion_warnings = false

[privilege_escalation]

become = true
become_user = root
become_method = sudo
become_ask_pass = false
9 changes: 9 additions & 0 deletions elastic.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
[elasticstack]

name=Elastic repository for 7.x packages
baseurl=https://artifacts.elastic.co/packages/7.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md
10 changes: 10 additions & 0 deletions grafana.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[gafana]

name=Grafana Repository
baseurl=https://packages.grafana.com/oss/rpm
repo_gpgcheck=1
enabled=1
gpgcheck=1
gpgkey=https://packages.grafana.com/gpg.key
sslverify=1
sslcacert=/etc/pki/tls/certs/ca-bundle.crt
2 changes: 2 additions & 0 deletions inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[ubuntu]
192.168.1.121
17 changes: 17 additions & 0 deletions playbook.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
---
- name: install packages ubuntu
hosts: ubuntu
roles:
- ubuntu_elastic
- ubuntu_grafana
- ubuntu_nagios
- ubuntu_prometheus

- name: install packages ubuntu
hosts: ubuntu
roles:
- ubuntu_elastic
- ubuntu_grafana
- ubuntu_nagios
- ubuntu_prometheus

10 changes: 10 additions & 0 deletions prometheus.repo
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
[prometheus]

name=Prometheus Repository
baseurl=https://packagecloud.io/prometheus-rpm/release/el/$releasever/$basearch
repo_gpgcheck=1
enabled=1
gpgkey=https://packagecloud.io/prometheus-rpm/release/gpgkey
https://raw.githubusercontent.com/lest/prometheus-rpm/master/RPM-GPG-KEY-prometheus-rpm
gpgcheck=1
metadata_expire=300
29 changes: 29 additions & 0 deletions ubuntu_elastic/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
language: python
python: "20.0.2"

# Use the new container infrastructure
sudo: false

# Install ansible
addons:
apt:
packages:
- python-pip

install:
# Install ansible
- pip install ansible

# Check ansible version
- ansible --version

# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg

script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
38 changes: 38 additions & 0 deletions ubuntu_elastic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
Role Name
=========

A brief description of the role goes here.

Requirements
------------

Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.

Role Variables
--------------

A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.

Dependencies
------------

A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles.

Example Playbook
----------------

Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too:

- hosts: servers
roles:
- { role: username.rolename, x: 42 }

License
-------

BSD

Author Information
------------------

An optional section for the role authors to include contact information, or a website (HTML is not allowed).
2 changes: 2 additions & 0 deletions ubuntu_elastic/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[ubuntu]
192.168.1.121
31 changes: 31 additions & 0 deletions ubuntu_elastic/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
---
# tasks file for roles/ubuntu_elastic
- name: add gpg key
apt_key:
url: https://artifacts.elastic.co/GPG-KEY-elasticsearch
state: present

- name: add elk repository
shell: echo "deb https://artifacts.elastic.co/packages/7.x/apt stable main" | sudo tee -a /etc/apt/sources.list.d/elastic-7.x.list

- name: update ubuntu
become: yes
apt:
upgrade: 'yes'
update_cache: yes

- name: install elasticsearch
apt:
name: elasticsearch
state: present

- name: install logstash
apt:
name: logstash
state: present

- name: install kibana
apt:
update_cache: yes
name: kibana
state: present
5 changes: 5 additions & 0 deletions ubuntu_elastic/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: ubuntu
remote_user: root
roles:
- roles/ubuntu_elastic
29 changes: 29 additions & 0 deletions ubuntu_grafana/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
language: python
python: "20.0.2"

# Use the new container infrastructure
sudo: false

# Install ansible
addons:
apt:
packages:
- python-pip

install:
# Install ansible
- pip install ansible

# Check ansible version
- ansible --version

# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg

script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
2 changes: 2 additions & 0 deletions ubuntu_grafana/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[ubuntu]
192.168.1.121
20 changes: 20 additions & 0 deletions ubuntu_grafana/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
---
# tasks file for roles/ubuntu_grafana
- name: add grafana packages
apt_key:
url: https://packages.grafana.com/gpg.key
state: present

- name: add grafana repo
shell: echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list

- name: update ubuntu
become: yes
apt:
upgrade: 'yes'
update_cache: yes

- name: install grafana in ubuntu
apt:
name: grafana
state: present
5 changes: 5 additions & 0 deletions ubuntu_grafana/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: ubuntu
remote_user: root
roles:
- roles/ubuntu_grafana
29 changes: 29 additions & 0 deletions ubuntu_nagios/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
language: python
python: "20.0.2"

# Use the new container infrastructure
sudo: false

# Install ansible
addons:
apt:
packages:
- python-pip

install:
# Install ansible
- pip install ansible

# Check ansible version
- ansible --version

# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg

script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
2 changes: 2 additions & 0 deletions ubuntu_nagios/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[ubuntu]
192.168.1.121
92 changes: 92 additions & 0 deletions ubuntu_nagios/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
---
# tasks file for roles/ubuntu_nagios
- name: install packages in ubuntu
apt:
name:
- apache2
- apache2-utils
- build-essential
- daemon
- libapache2-mod-php
- libgd-dev
- libperl-dev
- libssl-dev
- make
- openssl
- perl
- php
- php-gd
- unzip
- wget
state: latest
update_cache: yes

- name: add group nagcmd
group:
name: nagcmd
state: present

- name: add user nagios
user:
name: nagios
group: nagcmd

- name: donwload and extract nagios core
unarchive:
src: https://assets.nagios.com/downloads/nagioscore/releases/nagios-4.4.5.tar.gz
dest: /tmp
copy: no

- name: configure nagios
command: ./configure --with-nagios-group=nagcmd --with-command-group=nagcmd --with-httpd_conf=/etc/apache2/sites-enabled
args:
chdir: /tmp/nagios-4.4.5

- name: configure nagios clean
make:
target: clean
chdir: /tmp/nagios-4.4.5

- name: nagios compile
make:
target: all
chdir: /tmp/nagios-4.4.5

- name: install compilation nagios
make:
target: install
chdir: /tmp/nagios-4.4.5

- name: install init nagios
make:
target: install-init
chdir: /tmp/nagios-4.4.5

- name: install nagios config
make:
target: install-config
chdir: /tmp/nagios-4.4.5

- name: install nagios commandmode
make:
target: install-commandmode
chdir: /tmp/nagios-4.4.5

- name: install web interface
make:
target: install-webconf
chdir: /tmp/nagios-4.4.5

- name: add user account
htpasswd:
path: /usr/local/nagios/etc/htpasswd.users
name: user
password: password

- name: a2enmod cgi
command: a2enmod cgi

- name: restart apache2
service:
name: apache2
state: restarted
5 changes: 5 additions & 0 deletions ubuntu_nagios/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: ubuntu
remote_user: root
roles:
- roles/ubuntu_nagios
29 changes: 29 additions & 0 deletions ubuntu_prometheus/.travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
---
language: python
python: "20.0.2"

# Use the new container infrastructure
sudo: false

# Install ansible
addons:
apt:
packages:
- python-pip

install:
# Install ansible
- pip install ansible

# Check ansible version
- ansible --version

# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg

script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check

notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
Loading