This repository was archived by the owner on Jul 26, 2023. It is now read-only.
File tree 10 files changed +164
-2
lines changed
10 files changed +164
-2
lines changed Original file line number Diff line number Diff line change @@ -13,10 +13,10 @@ jobs:
13
13
runs-on : ubuntu-latest
14
14
15
15
strategy :
16
- # max-parallel: 4
16
+ max-parallel : 4
17
17
matrix :
18
18
distro : [centos7, debian10, rockylinux8]
19
- scenario : [default]
19
+ scenario : [default, agent ]
20
20
# disabling full stack until Elasticsearch issues are fixed
21
21
# scenario: [default, full_stack]
22
22
Original file line number Diff line number Diff line change @@ -15,6 +15,10 @@ You need to have Filebeat available in your software repositories. We provide a
15
15
Role Variables
16
16
--------------
17
17
18
+ * * beats_agent* : Use Elastic Agent (Default: ` false ` )
19
+ * * beats_fleet_token* : If you're not using ` elastic_stack_full_stack ` you have to set this to your Fleet server token when using ` beats_agent `
20
+ * * beats_fleet_server* : The inventory hostname (and DNS resolvable name) of the fleet server for this host
21
+
18
22
* * filebeat_enable* : Automatically start Filebeat (Default: ` true ` )
19
23
* * filebeat_output* : Set to ` logstash ` or ` elasticsearch ` . (default: ` logstash ` )
20
24
* * filebeat_syslog_udp* : Use UDP Syslog input (Default: ` false ` )
Original file line number Diff line number Diff line change 1
1
---
2
2
# defaults file for beats
3
+ beats_agent : false
3
4
beats_filebeat : true
4
5
filebeat_output : logstash
5
6
beats_target_hosts :
@@ -37,6 +38,8 @@ filebeat_enable: true
37
38
# filebeat_modules:
38
39
# - system
39
40
41
+ beats_fleet_token_name : fleettoken
42
+
40
43
elastic_stack_full_stack : false
41
44
elasticsearch_http_security : false
42
45
Original file line number Diff line number Diff line change
1
+ *******
2
+ Docker driver installation guide
3
+ *******
4
+
5
+ Requirements
6
+ ============
7
+
8
+ * Docker Engine
9
+
10
+ Install
11
+ =======
12
+
13
+ Please refer to the `Virtual environment `_ documentation for installation best
14
+ practices. If not using a virtual environment, please consider passing the
15
+ widely recommended `'--user' flag `_ when invoking ``pip ``.
16
+
17
+ .. _Virtual environment : https://virtualenv.pypa.io/en/latest/
18
+ .. _'--user' flag : https://packaging.python.org/tutorials/installing-packages/#installing-to-the-user-site
19
+
20
+ .. code-block :: bash
21
+
22
+ $ pip install ' molecule[docker]'
Original file line number Diff line number Diff line change
1
+ ---
2
+ # The workaround for arbitrarily named role directory is important because the
3
+ # git repo has one name and the role within it another
4
+ # Found at:
5
+ # https://github.com/ansible-community/molecule/issues/1567#issuecomment-436876722
6
+ - name : Converge
7
+ hosts : all
8
+ vars :
9
+ elastic_stack_full_stack : true
10
+ elasticsearch_http_security : true
11
+ beats_filebeat : false
12
+ beats_metricbeat : false
13
+ beats_agent : true
14
+ beats_fleet_server : beats-agent
15
+ tasks :
16
+ - name : " Include Elastics repos role"
17
+ include_role :
18
+ name : elastic-repos
19
+ - name : " Include Elasticsearch role"
20
+ include_role :
21
+ name : elasticsearch
22
+ - name : " Include Beats"
23
+ include_role :
24
+ name : " {{ lookup('env', 'MOLECULE_PROJECT_DIRECTORY') | basename }}"
Original file line number Diff line number Diff line change
1
+ ---
2
+ dependency :
3
+ name : galaxy
4
+ driver :
5
+ name : docker
6
+ platforms :
7
+ - name : beats-agent
8
+ groups :
9
+ - elasticsearch
10
+ - logstash
11
+ - filebeat
12
+ image : " geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"
13
+ command : ${MOLECULE_DOCKER_COMMAND:-""}
14
+ volumes :
15
+ - /sys/fs/cgroup:/sys/fs/cgroup:ro
16
+ privileged : true
17
+ pre_build_image : true
18
+ provisioner :
19
+ name : ansible
20
+ verifier :
21
+ name : ansible
Original file line number Diff line number Diff line change
1
+ ---
2
+ - name : Prepare
3
+ hosts : all
4
+ tasks :
5
+ - name : Install git
6
+ package :
7
+ name : git
8
+ when : ansible_os_family != "Debian"
9
+ - name : Install packages for Debian
10
+ apt :
11
+ name :
12
+ - git
13
+ - gpg
14
+ - procps
15
+ - curl
16
+ update_cache : yes
17
+ when : ansible_os_family == "Debian"
Original file line number Diff line number Diff line change
1
+ ---
2
+ - name : elastic-repos
3
+ src : https://github.com/netways/ansible-role-elastic-repos
4
+ scm : git
5
+ - name : elasticsearch
6
+ src : https://github.com/widhalmt/ansible-role-elasticsearch.git
7
+ scm : git
Original file line number Diff line number Diff line change
1
+ ---
2
+
3
+ - name : Check for requirements
4
+ fail :
5
+ msg : " Needs Token or full stack roles"
6
+ when :
7
+ - not elastic_stack_full_stack | bool
8
+ - beats_fleet_token is undefined
9
+
10
+ - name : Install Elastic Agent
11
+ package :
12
+ name : elastic-agent
13
+
14
+ - name : Generate Fleet Token
15
+ block :
16
+
17
+ - name : Generate Token
18
+ shell : >
19
+ /usr/share/elasticsearch/bin/elasticsearch-service-tokens
20
+ create
21
+ elastic/fleet-server
22
+ {{ beats_fleet_token_name }} >
23
+ /usr/share/elasticsearch/token-{{ beats_fleet_token_name }}
24
+ args :
25
+ creates : " /usr/share/elasticsearch/token-{{ beats_fleet_token_name }}"
26
+
27
+ - name : Secure access to token
28
+ file :
29
+ path : /usr/share/elasticsearch/token-{{ beats_fleet_token_name }}
30
+ owner : root
31
+ group : root
32
+ mode : 0600
33
+
34
+ - name : Read token
35
+ shell : >
36
+ grep ^SERVICE_TOKEN
37
+ /usr/share/elasticsearch/token-{{ beats_fleet_token_name }} |
38
+ cut -d= -f2
39
+ changed_when : false
40
+ register : read_token
41
+
42
+ - name : Use token as fact
43
+ set_fact :
44
+ beats_fleet_token : " {{ read_token.stdout }}"
45
+
46
+ when : elastic_stack_full_stack | bool
47
+ delegate_to : " {{ elasticsearch_ca }}"
48
+
49
+ - name : Setup fleet server
50
+ block :
51
+
52
+ - name : Run fleet server setup
53
+ command : >
54
+ elastic-agent
55
+ enroll
56
+ --insecure
57
+ "--fleet-server-service-token={{ beats_fleet_token }}"
58
+ --fleet-server-es-ca=/etc/beats/certs/ca.crt
59
+ -f --fleet-server-es=https://{{ elasticsearch_ca }}:9200
60
+
61
+ when : ansible_hostname == beats_fleet_server
Original file line number Diff line number Diff line change 18
18
- import_tasks : beats-security.yml
19
19
when : elasticsearch_http_security | bool
20
20
21
+ - import_tasks : beats-agent.yml
22
+ when : beats_agent | bool
23
+
21
24
- import_tasks : filebeat.yml
22
25
when : beats_filebeat | bool
You can’t perform that action at this time.
0 commit comments