Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add files via upload #1

Open
wants to merge 1 commit into
base: featured
Choose a base branch
from
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
8 changes: 8 additions & 0 deletions logstash/ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[defaults]

inventory = /home/ubuntu/logstash_folder/aws_ec2.yml
host_key_checking = False
remote_user = ubuntu
private_key_file = /home/ubuntu/key.pem
[inventory]
enable_plugins = aws_ec2
8 changes: 8 additions & 0 deletions logstash/aws_ec2.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
plugin: aws_ec2
regions:
- ap-northeast-2


filters:
tag:Name: kibana
38 changes: 38 additions & 0 deletions logstash/logsrash/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 logstash/logsrash/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
---
# defaults file for logsrash
7 changes: 7 additions & 0 deletions logstash/logsrash/handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
---
- name: Start my service
service:
name: "{{ item }}"
state: started
loop: "{{ tool }}"

34 changes: 34 additions & 0 deletions logstash/logsrash/meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)

# 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

# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)

min_ansible_version: 2.1

# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:

galaxy_tags: []
# 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.
4 changes: 4 additions & 0 deletions logstash/logsrash/tasks/configuration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
- name: jinja2 template configurationh
template:
src: logstash.j2
dest: /etc/logstash/conf.d/logstash.conf
23 changes: 23 additions & 0 deletions logstash/logsrash/tasks/dependency.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
---
- name: Update the apt package list (ubuntu)
apt:
update_cache: yes
when: ansible_os_family == 'Debian'

- name: dependencies are installing. (ubuntu)
apt:
name: "{{ dependency }}"
state: present
when: ansible_os_family == 'Debian'

- name: Update the yum cache (Red Hat)
yum:
update_cache: yes
when: ansible_os_family == 'RedHat'

- name: dependencies are installed (Red Hat)
yum:
name: "{{ dependency }}"
state: present
when: ansible_os_family == 'RedHat'

46 changes: 46 additions & 0 deletions logstash/logsrash/tasks/installing.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
- name: adding GPG key (ubuntu)
apt_key:
url: https://artifacts.elastic.co/GPG-KEY-elasticsearch
state: present
validate_certs: yes
keyring: /usr/share/keyrings/elasticsearch-keyring.gpg
when: ansible_os_family == 'Debian'

- name: adding repository (ubuntu)
apt_repository:
repo: 'deb [signed-by=/usr/share/keyrings/elasticsearch-keyring.gpg] https://artifacts.elastic.co/packages/8.x/apt stable main'
state: present
when: ansible_os_family == 'Debian'

- name: installing logstash (ubuntu)
apt:
update_cache: yes
name: "{{ tool }}"
state: present
when: ansible_os_family == 'Debian'
notify: Start my service

- name: Adding GPG key (Red Hat)
rpm_key:
state: present
key: https://artifacts.elastic.co/GPG-KEY-elasticsearch
when: ansible_os_family == 'RedHat'

- name: Adding repository (Red Hat)
yum_repository:
name: elastic-8.x
description: "Elastic repository for 8.x packages"
baseurl: https://artifacts.elastic.co/packages/8.x/yum
gpgcheck: yes
gpgkey: https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled: yes
when: ansible_os_family == 'RedHat'

- name: Installing Kibana (Red Hat)
yum:
name: "{{ tool }}"
state: present
when: ansible_os_family == 'RedHat'
notify: Start my service

10 changes: 10 additions & 0 deletions logstash/logsrash/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
---
- name: Installing dependencies
include_tasks: dependency.yml

- name: Installing logstash
include_tasks: installing.yml

- name: configuration logstash
include_tasks: configuration.yml

15 changes: 15 additions & 0 deletions logstash/logsrash/templates/logstash.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
input {
beats {
port => 5044
}
}


output {
elasticsearch {
hosts => ["https://localhost:9200"]
index => "logstash-%{+YYYY.MM.dd}"
}
stdout { codec => rubydebug }
}

2 changes: 2 additions & 0 deletions logstash/logsrash/tests/inventory
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
localhost

5 changes: 5 additions & 0 deletions logstash/logsrash/tests/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
- hosts: localhost
remote_user: root
roles:
- logsrash
8 changes: 8 additions & 0 deletions logstash/logsrash/vars/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
tool:
- logstash

dependency:
- openjdk-8-jdk
- apt-transport-https
- gpg
6 changes: 6 additions & 0 deletions logstash/logstash.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
- name: installing logstash
hosts: aws_ec2
become: yes
roles:
- logsrash