From eafefe88601e744a844fd44f951164f27cbfcf70 Mon Sep 17 00:00:00 2001 From: NaveenHaswani9961 <164150159+NaveenHaswani9961@users.noreply.github.com> Date: Mon, 5 Aug 2024 15:13:41 +0530 Subject: [PATCH] Add files via upload --- Kibana/ansible.cfg | 8 ++ Kibana/aws_ec2.yml | 8 ++ Kibana/kibana.yml | 6 + Kibana/kibana/README.md | 38 ++++++ Kibana/kibana/defaults/main.yml | 2 + Kibana/kibana/handlers/main.yml | 7 ++ Kibana/kibana/meta/main.yml | 52 +++++++++ Kibana/kibana/tasks/configuring.yml | 6 + Kibana/kibana/tasks/dependency.yml | 22 ++++ Kibana/kibana/tasks/installing.yml | 47 ++++++++ Kibana/kibana/tasks/main.yml | 9 ++ Kibana/kibana/templates/kibana.j2 | 174 ++++++++++++++++++++++++++++ Kibana/kibana/tests/inventory | 2 + Kibana/kibana/tests/test.yml | 5 + Kibana/kibana/vars/main.yml | 7 ++ 15 files changed, 393 insertions(+) create mode 100644 Kibana/ansible.cfg create mode 100644 Kibana/aws_ec2.yml create mode 100644 Kibana/kibana.yml create mode 100644 Kibana/kibana/README.md create mode 100644 Kibana/kibana/defaults/main.yml create mode 100644 Kibana/kibana/handlers/main.yml create mode 100644 Kibana/kibana/meta/main.yml create mode 100644 Kibana/kibana/tasks/configuring.yml create mode 100644 Kibana/kibana/tasks/dependency.yml create mode 100644 Kibana/kibana/tasks/installing.yml create mode 100644 Kibana/kibana/tasks/main.yml create mode 100644 Kibana/kibana/templates/kibana.j2 create mode 100644 Kibana/kibana/tests/inventory create mode 100644 Kibana/kibana/tests/test.yml create mode 100644 Kibana/kibana/vars/main.yml diff --git a/Kibana/ansible.cfg b/Kibana/ansible.cfg new file mode 100644 index 0000000..6bbd578 --- /dev/null +++ b/Kibana/ansible.cfg @@ -0,0 +1,8 @@ +[defaults] + +inventory = /home/ubuntu/kibana_folder/aws_ec2.yml +host_key_checking = False +remote_user = ubuntu +private_key_file = /home/ubuntu/key.pem +[inventory] +enable_plugins = aws_ec2 diff --git a/Kibana/aws_ec2.yml b/Kibana/aws_ec2.yml new file mode 100644 index 0000000..e343eb4 --- /dev/null +++ b/Kibana/aws_ec2.yml @@ -0,0 +1,8 @@ +--- +plugin: aws_ec2 +regions: + - ap-northeast-2 + + +filters: + tag:Name: kibana diff --git a/Kibana/kibana.yml b/Kibana/kibana.yml new file mode 100644 index 0000000..4f3d78a --- /dev/null +++ b/Kibana/kibana.yml @@ -0,0 +1,6 @@ +--- +- name: installing kibana + hosts: aws_ec2 + become: yes + roles: + - kibana diff --git a/Kibana/kibana/README.md b/Kibana/kibana/README.md new file mode 100644 index 0000000..225dd44 --- /dev/null +++ b/Kibana/kibana/README.md @@ -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). diff --git a/Kibana/kibana/defaults/main.yml b/Kibana/kibana/defaults/main.yml new file mode 100644 index 0000000..28d22f6 --- /dev/null +++ b/Kibana/kibana/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for kibana diff --git a/Kibana/kibana/handlers/main.yml b/Kibana/kibana/handlers/main.yml new file mode 100644 index 0000000..051fab4 --- /dev/null +++ b/Kibana/kibana/handlers/main.yml @@ -0,0 +1,7 @@ +--- +- name: Start my service + service: + name: "{{ item }}" + state: started + loop: "{{ tool }}" + diff --git a/Kibana/kibana/meta/main.yml b/Kibana/kibana/meta/main.yml new file mode 100644 index 0000000..c572acc --- /dev/null +++ b/Kibana/kibana/meta/main.yml @@ -0,0 +1,52 @@ +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: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + # platforms: + # - name: Fedora + # versions: + # - all + # - 25 + # - name: SomePlatform + # versions: + # - all + # - 1.0 + # - 7 + # - 99.99 + + 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. diff --git a/Kibana/kibana/tasks/configuring.yml b/Kibana/kibana/tasks/configuring.yml new file mode 100644 index 0000000..c67ae94 --- /dev/null +++ b/Kibana/kibana/tasks/configuring.yml @@ -0,0 +1,6 @@ +--- +- name: jinja2 template configuration + template: + src: kibana.j2 + dest: /etc/kibana/kibana.yml + mode: 0644 diff --git a/Kibana/kibana/tasks/dependency.yml b/Kibana/kibana/tasks/dependency.yml new file mode 100644 index 0000000..9bc7d3f --- /dev/null +++ b/Kibana/kibana/tasks/dependency.yml @@ -0,0 +1,22 @@ +--- +- 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' diff --git a/Kibana/kibana/tasks/installing.yml b/Kibana/kibana/tasks/installing.yml new file mode 100644 index 0000000..f0c3ba0 --- /dev/null +++ b/Kibana/kibana/tasks/installing.yml @@ -0,0 +1,47 @@ +--- +- name: adding GPG key (ubnutu) + 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 kibana (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 diff --git a/Kibana/kibana/tasks/main.yml b/Kibana/kibana/tasks/main.yml new file mode 100644 index 0000000..3bf4853 --- /dev/null +++ b/Kibana/kibana/tasks/main.yml @@ -0,0 +1,9 @@ +--- +- name: Installing dependencies + include_tasks: dependency.yml + +- name: Installing kibana + include_tasks: installing.yml + +- name: kibana configuration + include_tasks: configuring.yml diff --git a/Kibana/kibana/templates/kibana.j2 b/Kibana/kibana/templates/kibana.j2 new file mode 100644 index 0000000..9a9604f --- /dev/null +++ b/Kibana/kibana/templates/kibana.j2 @@ -0,0 +1,174 @@ +# For more configuration options see the configuration guide for Kibana in +# https://www.elastic.co/guide/index.html + +# =================== System: Kibana Server =================== +# Kibana is served by a back end server. This setting specifies the port to use. +server.port: 5601 + +# Specifies the address to which the Kibana server will bind. IP addresses and host names are both valid values. +# The default is 'localhost', which usually means remote machines will not be able to connect. +# To allow connections from remote users, set this parameter to a non-loopback address. +server.host: "0.0.0.0" + +# Enables you to specify a path to mount Kibana at if you are running behind a proxy. +# Use the `server.rewriteBasePath` setting to tell Kibana if it should remove the basePath +# from requests it receives, and to prevent a deprecation warning at startup. +# This setting cannot end in a slash. +#server.basePath: "" + +# Specifies whether Kibana should rewrite requests that are prefixed with +# `server.basePath` or require that they are rewritten by your reverse proxy. +# Defaults to `false`. +#server.rewriteBasePath: false + +# Specifies the public URL at which Kibana is available for end users. If +# `server.basePath` is configured this URL should end with the same basePath. +#server.publicBaseUrl: "" + +# The maximum payload size in bytes for incoming server requests. +#server.maxPayload: 1048576 + +# The Kibana server's name. This is used for display purposes. +#server.name: "your-hostname" + +# =================== System: Kibana Server (Optional) =================== +# Enables SSL and paths to the PEM-format SSL certificate and SSL key files, respectively. +# These settings enable SSL for outgoing requests from the Kibana server to the browser. +#server.ssl.enabled: false +#server.ssl.certificate: /path/to/your/server.crt +#server.ssl.key: /path/to/your/server.key + +# =================== System: Elasticsearch =================== +# The URLs of the Elasticsearch instances to use for all your queries. +elasticsearch.hosts: ["http://localhost:9200"] + +# If your Elasticsearch is protected with basic authentication, these settings provide +# the username and password that the Kibana server uses to perform maintenance on the Kibana +# index at startup. Your Kibana users still need to authenticate with Elasticsearch, which +# is proxied through the Kibana server. +#elasticsearch.username: "kibana_system" +#elasticsearch.password: "pass" + +# Kibana can also authenticate to Elasticsearch via "service account tokens". +# Service account tokens are Bearer style tokens that replace the traditional username/password based configuration. +# Use this token instead of a username/password. +# elasticsearch.serviceAccountToken: "my_token" + +# Time in milliseconds to wait for Elasticsearch to respond to pings. Defaults to the value of +# the elasticsearch.requestTimeout setting. +#elasticsearch.pingTimeout: 1500 + +# Time in milliseconds to wait for responses from the back end or Elasticsearch. This value +# must be a positive integer. +#elasticsearch.requestTimeout: 30000 + +# The maximum number of sockets that can be used for communications with elasticsearch. +# Defaults to `Infinity`. +#elasticsearch.maxSockets: 1024 + +# Specifies whether Kibana should use compression for communications with elasticsearch +# Defaults to `false`. +#elasticsearch.compression: false + +# List of Kibana client-side headers to send to Elasticsearch. To send *no* client-side +# headers, set this value to [] (an empty list). +#elasticsearch.requestHeadersWhitelist: [ authorization ] + +# Header names and values that are sent to Elasticsearch. Any custom headers cannot be overwritten +# by client-side headers, regardless of the elasticsearch.requestHeadersWhitelist configuration. +#elasticsearch.customHeaders: {} + +# Time in milliseconds for Elasticsearch to wait for responses from shards. Set to 0 to disable. +#elasticsearch.shardTimeout: 30000 + +# =================== System: Elasticsearch (Optional) =================== +# These files are used to verify the identity of Kibana to Elasticsearch and are required when +# xpack.security.http.ssl.client_authentication in Elasticsearch is set to required. +#elasticsearch.ssl.certificate: /path/to/your/client.crt +#elasticsearch.ssl.key: /path/to/your/client.key + +# Enables you to specify a path to the PEM file for the certificate +# authority for your Elasticsearch instance. +#elasticsearch.ssl.certificateAuthorities: [ "/path/to/your/CA.pem" ] + +# To disregard the validity of SSL certificates, change this setting's value to 'none'. +#elasticsearch.ssl.verificationMode: full + +# =================== System: Logging =================== +# Set the value of this setting to off to suppress all logging output, or to debug to log everything. Defaults to 'info' +#logging.root.level: debug + +# Enables you to specify a file where Kibana stores log output. +logging: + appenders: + file: + type: file + fileName: /var/log/kibana/kibana.log + layout: + type: json + root: + appenders: + - default + - file +# layout: +# type: json + +# Logs queries sent to Elasticsearch. +#logging.loggers: +# - name: elasticsearch.query +# level: debug + +# Logs http responses. +#logging.loggers: +# - name: http.server.response +# level: debug + +# Logs system usage information. +#logging.loggers: +# - name: metrics.ops +# level: debug + +# =================== System: Other =================== +# The path where Kibana stores persistent data not saved in Elasticsearch. Defaults to data +#path.data: data + +# Specifies the path where Kibana creates the process ID file. +pid.file: /run/kibana/kibana.pid + +# Set the interval in milliseconds to sample system and process performance +# metrics. Minimum is 100ms. Defaults to 5000ms. +#ops.interval: 5000 + +# Specifies locale to be used for all localizable strings, dates and number formats. +# Supported languages are the following: English (default) "en", Chinese "zh-CN", Japanese "ja-JP", French "fr-FR". +#i18n.locale: "en" + +# =================== Frequently used (Optional)=================== + +# =================== Saved Objects: Migrations =================== +# Saved object migrations run at startup. If you run into migration-related issues, you might need to adjust these settings. + +# The number of documents migrated at a time. +# If Kibana can't start up or upgrade due to an Elasticsearch `circuit_breaking_exception`, +# use a smaller batchSize value to reduce the memory pressure. Defaults to 1000 objects per batch. +#migrations.batchSize: 1000 + +# The maximum payload size for indexing batches of upgraded saved objects. +# To avoid migrations failing due to a 413 Request Entity Too Large response from Elasticsearch. +# This value should be lower than or equal to your Elasticsearch cluster’s `http.max_content_length` +# configuration option. Default: 100mb +#migrations.maxBatchSizeBytes: 100mb + +# The number of times to retry temporary migration failures. Increase the setting +# if migrations fail frequently with a message such as `Unable to complete the [...] step after +# 15 attempts, terminating`. Defaults to 15 +#migrations.retryAttempts: 15 + +# =================== Search Autocomplete =================== +# Time in milliseconds to wait for autocomplete suggestions from Elasticsearch. +# This value must be a whole number greater than zero. Defaults to 1000ms +#unifiedSearch.autocomplete.valueSuggestions.timeout: 1000 + +# Maximum number of documents loaded by each shard to generate autocomplete suggestions. +# This value must be a whole number greater than zero. Defaults to 100_000 +#unifiedSearch.autocomplete.valueSuggestions.terminateAfter: 100000 diff --git a/Kibana/kibana/tests/inventory b/Kibana/kibana/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/Kibana/kibana/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/Kibana/kibana/tests/test.yml b/Kibana/kibana/tests/test.yml new file mode 100644 index 0000000..5ed0a81 --- /dev/null +++ b/Kibana/kibana/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - kibana diff --git a/Kibana/kibana/vars/main.yml b/Kibana/kibana/vars/main.yml new file mode 100644 index 0000000..abb1d2b --- /dev/null +++ b/Kibana/kibana/vars/main.yml @@ -0,0 +1,7 @@ +--- +tool: + - kibana + +dependency: + - openjdk-8-jdk + - apt-transport-https