Skip to content

Commit 58997de

Browse files
Update tasks to use cert_info plugin (#163)
Fixes #161. Update certificate handling tasks and docs --------- Co-authored-by: Afeef Ghannam <[email protected]> Co-authored-by: Afeef Ghannam <[email protected]>
1 parent a7bfc56 commit 58997de

File tree

16 files changed

+88
-78
lines changed

16 files changed

+88
-78
lines changed

.github/workflows/test_full_stack.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,9 +44,9 @@ jobs:
4444
max-parallel: 1
4545
matrix:
4646
distro:
47+
- rockylinux8
4748
- ubuntu2004
4849
- ubuntu2204
49-
- rockylinux8
5050
- debian10
5151
scenario:
5252
- elasticstack_default

docs/role-beats.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,9 @@ Requirements
1010

1111
You need to have the beats you want to install available in your software repositories. We provide a [role](./role-repos.md) for just that but if you have other ways of managing software, just make sure it's available. Alternatively you can install the Beats yourself.
1212

13+
* `cryptography` >= 2.5
14+
* `community.crypto` collection: ansible-galaxy collection install community.crypto
15+
1316
Role Variables
1417
--------------
1518

@@ -101,7 +104,7 @@ If you want to use this role with your own TLS certificates, use these variables
101104
* *beats_tls_key*: Path to the keyfiles (default: `{{ beats_ca_dir }}/{{ ansible_hostname }}.key`)
102105
* *beats_tls_cert*: Path to the certificate (default: `{{ beats_ca_dir }}/{{ ansible_hostname }}.crt`)
103106
* *beats_tls_key_passphrase*: Passphrase of the keyfile (default: `BeatsChangeMe`)
104-
* *beats_cert_expiration_buffer*: Ansible will renew the beats certificate if its validity is shorter than this value, which should be number of days. (default: 30)
107+
* *beats_cert_expiration_buffer*: Ansible will renew the beats certificate if its validity is shorter than this value (default: `+30d`). The valid format is `+[w | d | h | m | s]`, example `+20w5d7h`.
105108
* *beats_cert_will_expire_soon*: Set it to true to renew beats certificate (default: `false`), Or run the playbook with `--tags renew_beats_cert` to do that.
106109
* *beats_tls_cacert*: Path to the CA.crt (default: `{{ beats_ca_dir }}/ca.crt`)
107110

docs/role-elasticsearch.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,13 +9,18 @@ If you use the role to set up security you, can use its CA to create certificate
99

1010
Please note that setting `elasticsearch_bootstrap_pw` as variable will only take effect when initialising Elasticsearch. Changes after starting elasticsearch for the first time will not change the bootstrap password for the instance and will lead to breaking tests.
1111

12+
Requirements
13+
------------
14+
15+
* `cryptography` >= 2.5
16+
1217
Role Variables
1318
--------------
1419

1520
* *elasticsearch_enable*: Start and enable Elasticsearch (default: `true`)
1621
* *elasticsearch_heap*: Heapsize for Elasticsearch. (Half of free memory on host. Maximum 30GB. (default: Half of hosts memory. Min 1GB, Max 30GB)
1722
* *elasticsearch_tls_key_passphrase*: Passphrase for elasticsearch certificates (default: `PleaseChangeMeIndividually`)
18-
* *elasticsearch_cert_expiration_buffer*: Ansible will renew the elasticsearch certificate if its validity is shorter than this value, which should be number of days. (default: 30)
23+
* *elasticsearch_cert_expiration_buffer*: Ansible will renew the elasticsearch certificate if its validity is shorter than this value, which should be number of days. (default: `30`)
1924
* *elasticsearch_cert_will_expire_soon*: Set it to true to renew elasticsearch certificate (default: `false`), Or run the playbook with `--tags renew_elasticsearch_cert` to do that.
2025
* *elasticsearch_datapath*: Path where Elasticsearch will store it's data. (default: `/var/lib/elasticsearch` - the packages default)
2126
* *elasticsearch_create_datapath*: Create the path for data to store if it doesn't exist. (default: `false` - only useful if you change `elasticsearch_datapath`)

docs/role-kibana.md

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ Ansible Role: Kibana
55

66
This roles installs and configures Kibana.
77

8+
Requirements
9+
------------
10+
11+
* `cryptography` >= 2.5
812

913
Role Variables
1014
--------------
@@ -23,7 +27,7 @@ These variables are identical over all our elastic related roles, hence the diff
2327
* *elasticstack_full_stack*: Use `ansible-role-elasticsearch` as well (default: `false`)
2428
* *elasticstack_elasticsearch_http_port*: Port of Elasticsearch http (Default: `9200`)
2529
* *kibana_tls_key_passphrase*: Passphrase for kibana certificates (default: `PleaseChangeMe`)
26-
* *kibana_cert_expiration_buffer*: Ansible will renew the kibana certificate if its validity is shorter than this value, which should be number of days. (default: 30)
30+
* *kibana_cert_expiration_buffer*: Ansible will renew the kibana certificate if its validity is shorter than this value, which should be number of days. (default: `30`)
2731
* *kibana_cert_will_expire_soon*: Set it to true to renew kibana certificate (default: `false`), Or run the playbook with `--tags renew_kibana_cert` to do that.
2832
* *elasticstack_kibana_host*: Hostname users use to connect to Kibana (default: FQDN of the host the role is executed on)
2933
* *elasticstack_kibana_port*: Port Kibana webinterface is listening on (default: `5601`)

docs/role-logstash.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ Requirements
1919
------------
2020

2121
* `community.general` collection
22+
* `cryptography` >= 2.5
2223

2324
You need to have the Elastic Repos configured on your system. You can use our [role](./role-repos.md)
2425

molecule/elasticstack_default/converge.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,6 +48,6 @@
4848
service:
4949
name: rsyslog
5050
state: started
51-
- name: Include Kibana
51+
- name: Include kibana
5252
include_role:
5353
name: kibana

molecule/elasticstack_default/prepare.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,19 @@
3333
- git
3434
- openssl
3535
- unzip
36+
- systemd
37+
38+
- name: Update all installed packages RHEL
39+
yum:
40+
name: '*'
41+
state: latest
42+
update_cache: yes
43+
update_only: yes
44+
when: ansible_os_family == "RedHat"
45+
46+
- name: Update all installed packages Debian
47+
apt:
48+
name: '*'
49+
state: latest
50+
update_cache: yes
51+
when: ansible_os_family == "Debian"

molecule/elasticstack_default/requirements.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,3 +6,4 @@ roles:
66

77
collections:
88
- community.general
9+
- community.crypto

plugins/module_utils/certs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,7 @@ def extensions_info(self):
169169
# get critical value
170170
critical = to_text(extension.critical)
171171
self.result['extensions'][name]['_critical'] = to_text(critical)
172-
self.extensions_values_info(name, extension)
172+
self.extensions_values_info(name, extension)
173173
except Exception as e:
174174
# if something went wrong skip this extension and its key values and
175175
# also create a warning

roles/beats/defaults/main.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ elasticstack_ca_dir: /opt/es-ca
6868
elasticstack_ca_pass: PleaseChangeMe
6969
elasticstack_initial_passwords: /usr/share/elasticsearch/initial_passwords
7070
elasticstack_elasticsearch_http_port: 9200
71-
beats_cert_expiration_buffer: 30
71+
beats_cert_expiration_buffer: "+30d"
7272
beats_cert_will_expire_soon: false
7373

7474
# Variables for debugging and development

0 commit comments

Comments
 (0)