Skip to content

Commit 353f825

Browse files
committed
minor: add ubuntu 22 molecule test + fix lint
1 parent 8f6c0e3 commit 353f825

File tree

10 files changed

+42
-38
lines changed

10 files changed

+42
-38
lines changed

.ansible-lint

+1
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@
22
skip_list:
33
- '106'
44
- '401'
5+
- 'schema'

README.md

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,9 +4,9 @@
44

55
[![Galaxy Role](https://img.shields.io/badge/galaxy-apps_wazuh_agent-purple?style=flat)](https://galaxy.ansible.com/lotusnoir/apps_wazuh_agent)
66
[![Version](https://img.shields.io/github/release/lotusnoir/ansible-apps_wazuh_agent.svg)](https://github.com/lotusnoir/ansible-apps_wazuh_agent/releases/latest)
7-
![GitHub repo size](https://img.shields.io/github/repo-size/lotusnoir/ansible-apps_wazuh_agent?color=orange&style=flat)
7+
[![GitHub repo size](https://img.shields.io/github/repo-size/lotusnoir/ansible-apps_wazuh_agent?color=orange&style=flat)](https://galaxy.ansible.com/lotusnoir/apps_wazuh_agent)
88
[![downloads](https://img.shields.io/ansible/role/d/56847)](https://galaxy.ansible.com/lotusnoir/apps_wazuh_agent)
9-
![Ansible Quality Score](https://img.shields.io/ansible/quality/56847)
9+
[![Ansible Quality Score](https://img.shields.io/ansible/quality/56847)](https://galaxy.ansible.com/lotusnoir/apps_wazuh_agent)
1010
[![License](https://img.shields.io/badge/license-Apache--2.0-brightgreen?style=flat)](https://opensource.org/licenses/Apache-2.0)
1111

1212
Install and configure wazuh_agent

handlers/main.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
---
22
- name: restart wazuh-agent
3-
service: name=wazuh-agent state=restarted
3+
ansible.builtin.service: name=wazuh-agent state=restarted

meta/main.yml

+1
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ galaxy_info:
1111
versions:
1212
- "focal"
1313
- "bionic"
14+
- "jammy"
1415
- name: "Debian"
1516
versions:
1617
- "bullseye"

molecule/default/molecule.yml

+9-9
Original file line numberDiff line numberDiff line change
@@ -20,6 +20,15 @@ platforms:
2020
- /sys/fs/cgroup:/sys/fs/cgroup:ro
2121
groups:
2222
- python3
23+
- name: ubuntu22-apps-wazuh-agent
24+
pre_build_image: true
25+
image: lotusnoir/ansible_molecule_test_images:ubuntu22
26+
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
27+
privileged: true
28+
volumes:
29+
- /sys/fs/cgroup:/sys/fs/cgroup:ro
30+
groups:
31+
- python3
2332
- name: debian10-apps-wazuh-agent
2433
pre_build_image: true
2534
image: lotusnoir/ansible_molecule_test_images:debian10
@@ -41,15 +50,6 @@ platforms:
4150
privileged: true
4251
volumes:
4352
- /sys/fs/cgroup:/sys/fs/cgroup:ro
44-
- name: centos8-apps-wazuh-agent
45-
pre_build_image: true
46-
image: lotusnoir/ansible_molecule_test_images:centos8
47-
docker_host: "${DOCKER_HOST:-unix://var/run/docker.sock}"
48-
privileged: true
49-
volumes:
50-
- /sys/fs/cgroup:/sys/fs/cgroup:ro
51-
groups:
52-
- python3
5353
- name: rocky8-apps-wazuh-agent
5454
pre_build_image: true
5555
image: lotusnoir/ansible_molecule_test_images:rocky8

tasks/check.yml

+12-10
Original file line numberDiff line numberDiff line change
@@ -1,33 +1,35 @@
11
---
22
### INCLUDE META
33
- name: Include roles' meta data
4-
include_vars:
4+
ansible.builtin.include_vars:
55
file: "{{ role_path }}/meta/main.yml"
66

77
### TEST DISTRIB
88
- name: Test the distribution is supported. End the host if not.
9-
set_fact:
9+
ansible.builtin.set_fact:
1010
supported_distributions: "{{ galaxy_info.platforms|json_query('[].name') }}"
11-
- block:
11+
- name: Exit conditions
12+
block:
1213
- name: Ending play...
13-
debug:
14+
ansible.builtin.debug:
1415
msg: "{{ ansible_distribution }} not supported. End of host."
1516
- name: Ending play...
16-
meta: end_host
17+
ansible.builtin.meta: end_host
1718
when: ansible_distribution not in supported_distributions
1819

1920
### TEST RELEASE
2021
- name: Test the release is supported. End the host if not.
21-
set_fact:
22+
ansible.builtin.set_fact:
2223
supported_releases: "{{ (galaxy_info.platforms| selectattr('name', 'match', ansible_distribution)| list|first).versions }}"
23-
- block:
24+
- name: Exit conditions
25+
block:
2426
- name: Ending play...
25-
debug:
27+
ansible.builtin.debug:
2628
msg: "{{ ansible_distribution_release }} not supported. End of host."
2729
- name: Ending play...
28-
meta: end_host
30+
ansible.builtin.meta: end_host
2931
when: ansible_distribution_release not in supported_releases and ansible_distribution_major_version not in supported_releases
3032

3133
- name: The distribution and release is supported. Continue play.
32-
debug:
34+
ansible.builtin.debug:
3335
msg: "{{ ansible_distribution }} {{ ansible_distribution_release }} is supported. Continue play."

tasks/install.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,14 @@
11
---
22
- name: "RedHat | Install wazuh-agent"
3-
include_tasks: setup-RedHat.yml
3+
ansible.builtin.include_tasks: setup-RedHat.yml
44
when: ansible_os_family == "RedHat" or ansible_os_family == "Rocky"
55

66
- name: "Debian | Install wazuh-agent"
7-
include_tasks: setup-Debian.yml
7+
ansible.builtin.include_tasks: setup-Debian.yml
88
when: ansible_os_family == "Debian"
99

1010
- name: "Start wazuh-agent"
11-
service:
11+
ansible.builtin.service:
1212
name: wazuh-agent
1313
state: started
1414
enabled: true

tasks/main.yml

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
22
### Checks
33
- name: Import check tasks
4-
import_tasks: check.yml
4+
ansible.builtin.import_tasks: check.yml
55

66
### Import vars
77
- name: add OS specific variables
8-
include_vars: '{{ vars_file }}'
8+
ansible.builtin.include_vars: '{{ vars_file }}'
99
with_first_found:
1010
- files:
1111
- '{{ ansible_distribution }}-{{ ansible_distribution_major_version }}.yml'
@@ -19,4 +19,4 @@
1919

2020
### Install
2121
- name: Import install tasks
22-
import_tasks: install.yml
22+
ansible.builtin.import_tasks: install.yml

tasks/setup-Debian.yml

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,22 @@
11
---
22
- name: "Debian | Install gnupg"
3-
package:
3+
ansible.builtin.package:
44
name: "gnupg"
55
state: present
66

77
- name: "Debian | Add wazuh apt signing key"
8-
apt_key:
8+
ansible.builtin.apt_key:
99
url: https://packages.wazuh.com/key/GPG-KEY-WAZUH
1010
state: present
1111

1212
- name: "Debian | Add wazuh repo to apt list"
13-
apt_repository:
13+
ansible.builtin.apt_repository:
1414
repo: deb https://packages.wazuh.com/4.x/apt/ stable main
1515
state: present
1616
filename: wazuh
1717

1818
- name: "Debian | Install wazuh-agent package"
19-
package:
19+
ansible.builtin.package:
2020
name: "wazuh-agent"
2121
state: present
2222
update_cache: 'yes'

tasks/setup-RedHat.yml

+6-6
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
---
2-
- name: Redhat | Import a key from a url
3-
rpm_key:
2+
- name: "Redhat | Import a key from a url"
3+
ansible.builtin.rpm_key:
44
state: present
55
key: https://packages.wazuh.com/key/GPG-KEY-WAZUH
66

7-
- name: Redhat | Copy repo informations
8-
copy:
7+
- name: "Redhat | Copy repo informations"
8+
ansible.builtin.copy:
99
dest: /etc/yum.repos.d/wazuh.repo
1010
content: |
1111
[wazuh_repo]
@@ -17,8 +17,8 @@
1717
protect=1
1818
mode: '0644'
1919

20-
- name: Redhat | Install wazuh-agent package
21-
dnf:
20+
- name: "Redhat | Install wazuh-agent package"
21+
ansible.builtin.dnf:
2222
name: wazuh-agent
2323
state: present
2424
environment:

0 commit comments

Comments
 (0)