Skip to content
This repository has been archived by the owner on Apr 12, 2022. It is now read-only.

Commit

Permalink
Fix yamllint
Browse files Browse the repository at this point in the history
Signed-off-by: Timur Gadiev <Timur_Gadiev@epam.com>
  • Loading branch information
tgadiev committed Nov 16, 2019
1 parent 22a5738 commit f3bdd67
Show file tree
Hide file tree
Showing 11 changed files with 112 additions and 58 deletions.
2 changes: 1 addition & 1 deletion .kitchen.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,4 +99,4 @@ suites:
additional_copy_path:
- "."
run_list:
attributes:
attributes:
16 changes: 12 additions & 4 deletions tasks/beats-debian.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,25 +30,33 @@

- name: Debian - unhold {{beat}} version for install
command: apt-mark unhold {{beat}}
changed_when: False
changed_when: false

- name: Debian - Ensure {{beat}} is installed
apt: name={{beat}}{% if beats_version is defined and beats_version != "" %}={{ beats_version }}{% endif %} state=present cache_valid_time=86400
apt:
name: >-
{{beat}}{% if beats_version is defined and beats_version != "" %}={{ beats_version }}{% endif %}
state: present
cache_valid_time: 86400
when: use_repository
notify: restart {{beat}}

- name: Debian - hold {{beat}} version
command: apt-mark hold {{beat}}
when: version_lock
changed_when: False
changed_when: false

- set_fact: os_arch="i386"

- set_fact: os_arch="amd64"
when: ansible_architecture == "x86_64"

- name: Debian - Download {{beat}} from url
get_url: url={% if custom_package_url is defined %}{{ custom_package_url }}{% else %}{{ beats_package_url }}/{{beat}}/{{beat}}_{{ beats_version }}_{{os_arch}}.deb{% endif %} dest=/tmp/{{beat}}_{{ beats_version }}_{{os_arch}}.deb validate_certs=no
get_url:
url: >-
{% if custom_package_url is defined %}{{ custom_package_url }}{% else %}{{ beats_package_url }}/{{beat}}/{{beat}}_{{ beats_version }}_{{os_arch}}.deb{% endif %}
dest: /tmp/{{beat}}_{{ beats_version }}_{{os_arch}}.deb
validate_certs: false
when: not use_repository

- name: Debian - Ensure {{beat}} is installed from downloaded package
Expand Down
3 changes: 1 addition & 2 deletions tasks/beats-param-check.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,8 @@
---

- fail: msg="beat must be specified and cannot be blank e.g. filebeat"
when: beat is not defined or beat == ''

- fail: msg="beat_conf must be specified"
when: beat_conf is not defined

- set_fact: "beats_major_version={{ beats_version[0] }}.x"
- set_fact: "beats_major_version={{ beats_version[0] }}.x"
16 changes: 13 additions & 3 deletions tasks/beats-redhat.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,26 @@
changed_when: False

- name: RedHat - Ensure {{beat}} is installed
yum: name={{beat}}{% if beats_version is defined and beats_version != "" %}-{{ beats_version }}{% endif %} state=present update_cache=yes
yum:
name: >-
{{beat}}{% if beats_version is defined and beats_version != "" %}-{{ beats_version }}{% endif %}
state: present
update_cache: true
when: use_repository
notify: restart {{beat}}

- name: RedHat - lock {{beat}} version
shell: yum versionlock add {{beat}}{% if beats_version is defined and beats_version != "" %}-{{ beats_version }}{% endif %}
shell: >-
yum versionlock add
{{beat}}{% if beats_version is defined and beats_version != "" %}-{{ beats_version }}{% endif %}
when: version_lock
changed_when: False

- name: RedHat - Install {{beat}} from url
yum: name={% if custom_package_url is defined %}{{ custom_package_url }}{% else %}{{ beats_package_url }}/{{beat}}-{{ beats_version }}-{{ansible_architecture}}.rpm{% endif %} state=present
yum:
name: >-
{% if custom_package_url is defined %}{{ custom_package_url }}{%
else %}{{ beats_package_url }}/{{beat}}-{{ beats_version }}-{{ansible_architecture}}.rpm{% endif %}
state: present
when: not use_repository
notify: restart {{beat}}
80 changes: 41 additions & 39 deletions test/integration/config.yml
Original file line number Diff line number Diff line change
@@ -1,44 +1,46 @@
---
#Install specific version here
- name: wrapper playbook for kitchen testing "beats"
- name: wrapper playbook for kitchen testing beats
hosts: localhost
roles:
- { role: "ansible-beats", beat: "packetbeat", version_lock: true,
beat_conf: {
"interfaces": {"device":"any"},
"protocols": {
"dns": {
"ports": [53],
"include_authorities":true
},
"http": {
"ports": [80, 8080, 8000, 5000, 8002]
},
"memcache": {
"ports": [11211]
},
"mysql": {
"ports": [3306]
},
"pgsql": {
"ports": [5432]
},
"redis": {
"ports": [6379]
},
"thrift": {
"ports": [9090]
},
"mongodb": {
"ports": [27017]
}
}
},
output_conf : {
"elasticsearch": {
"hosts": ["localhost:9200"]
}
}
}
- role: ansible-beats
beat: packetbeat
version_lock: true
beat_conf:
interfaces:
device: any
protocols:
dns:
ports:
- 53
include_authorities: true
http:
ports:
- 80
- 8080
- 8000
- 5000
- 8002
memcache:
ports:
- 11211
mysql:
ports:
- 3306
pgsql:
ports:
- 5432
redis:
ports:
- 6379
thrift:
ports:
- 9090
mongodb:
ports:
- 27017
output_conf:
elasticsearch:
hosts: ["localhost:9200"]
vars:
use_repository: "true"
use_repository: true
27 changes: 24 additions & 3 deletions test/integration/multi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,28 @@
- name: wrapper playbook for kitchen testing "beats"
hosts: localhost
roles:
- { role: "ansible-beats", beat: "filebeat", beat_conf: {"filebeat": {"inputs":[{"paths":["/var/log/*.log"],"type":"log"}]} } }
- { role: "ansible-beats", beat: "metricbeat", beat_conf: { "metricbeat.modules": [{"module": "system", "metricsets": ["cpu", "filesystem", "network", "process"], "enabled": true, "period": "10s", "processes":[".*"], "cpu_ticks": false } ] } }
- role: ansible-beats
beat: filebeat
beat_conf:
filebeat:
inputs:
- paths:
- /var/log/*.log
type: log
- role: ansible-beats
beat: metricbeat
beat_conf:
metricbeat:
modules:
- module: "system"
metricsets:
- cpu
- filesystem
- network
- process
enabled: true
period: 10s
processes: [".*"]
cpu_ticks: false
vars:
use_repository: "true"
use_repository: true
10 changes: 9 additions & 1 deletion test/integration/standard-6x.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,15 @@
- name: wrapper playbook for kitchen testing "beats"
hosts: localhost
roles:
- { role: "ansible-beats", beat: "filebeat", beat_conf: {"filebeat": {"prospectors":[{"paths":["/var/log/*.log"],"input_type":"log"}], "registry_file": "/var/lib/filebeat/registry"} } }
- role: ansible-beats
beat: filebeat
beat_conf:
filebeat:
prospectors:
- paths:
- /var/log/*.log
input_type: log
registry_file: /var/lib/filebeat/registry
vars:
beats_version: 6.8.4
use_repository: "true"
11 changes: 9 additions & 2 deletions test/integration/standard.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,13 @@
- name: wrapper playbook for kitchen testing "beats"
hosts: localhost
roles:
- { role: "ansible-beats", beat: "filebeat", beat_conf: {"filebeat": {"inputs":[{"paths":["/var/log/*.log"],"type":"log"}]} } }
- role: ansible-beats
beat: filebeat
beat_conf:
filebeat:
inputs:
- paths:
- /var/log/*.log
type: log
vars:
use_repository: "true"
use_repository: true
1 change: 1 addition & 0 deletions test/matrix.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
OS:
- ubuntu-1404
- ubuntu-1604
Expand Down
1 change: 0 additions & 1 deletion vars/Debian.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

default_file: "/etc/default"
init_script: "/etc/init.d"
repo_url: "https://artifacts.elastic.co/packages/{{ beats_major_version }}/apt"
3 changes: 1 addition & 2 deletions vars/RedHat.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
---

default_file: "/etc/sysconfig"
init_script: "/etc/init.d"
repo_url: "https://artifacts.elastic.co/packages/{{ beats_major_version }}/yum"
repo_url: "https://artifacts.elastic.co/packages/{{ beats_major_version }}/yum"

0 comments on commit f3bdd67

Please sign in to comment.