Ansible role that installs filebeat on Linux using the apt package elastic provides.
Also sets up the filebeat.yml from basic vars filebeat_conf
Debian based Linux, tested on Ubuntu. Recent version of Ansible. Only utilized Ansible core modules.
# List of files to read logs from:
filebeat_conf:
output.elasticsearch:
hosts: ["https://localhost:9200"]
username: "filebeat_internal"
password: "YOUR_PASSWORD"list of filebeat modules you want enable
filebeat_enable_modules:
- systemThis role has no dependencies to other roles.
Copy this role into the roles/mediapeers.filebeat dir in your Ansible project. Preferably add it as a submodule.
You can also install it with ansible-galaxy install mediapeers.filebeat.
Then use it like so:
- name: My nice play
hosts: servers
roles:
- role: ansible-filebeat
filebeat_conf:
output.elasticsearch:
hosts: ["https://localhost:9200"]
username: "filebeat_internal"
password: "YOUR_PASSWORD"
Tests are performed using Molecule.
Install Molecule or use docker-compose run --rm molecule to run a local Docker container, based on the enterclousuite/molecule project, from where you can use molecule.
- Run
molecule createto start the target Docker container on your local engine. - Use
molecule loginto log in to the running container. - Edit the role files.
- Add other required roles (external) in the molecule/default/requirements.yml file.
- Edit the molecule/default/playbook.yml.
- Define infra tests under the molecule/default/tests folder using the goos verifier.
- When ready, use
molecule convergeto run the Ansible Playbook andmolecule verifyto execute the test suite.
Note that the converge process starts performing a syntax check of the role.
Destroy the Docker container with the commandmolecule destroy.
To run all the steps with just one command, run molecule test.
In order to run the role targeting a VM, use the playbook_deploy.yml file for example with the following command: ansible-playbook ansible-cfssl/molecule/default/playbook_deploy.yml -i VM_IP_OR_FQDN, -u ubuntu --private-key private.pem.
BSD