Commit e7d6f7b5 authored by Ophélie Gagnard's avatar Ophélie Gagnard

playbook/roles/ridge: Update playbook.

Support MCA and fluent-bit plugin in separate packages.
Update command-line calls to the programs and files.
parent bb1d5398
---
dependencies:
- { role: package, package_name: fluent-bit, package_state: latest }
- { role: package, package_name: mca--static, package_state: latest }
- { role: package, package_name: fluent-bit, package_state: latest }
- { role: package, package_name: plugin-fluentbit-to-wendelin, package_state: latest }
# this are not actual dependencies, it is just an experimental list of packages to scan
- { role: package, package_name: dracut-core, package_state: latest }
......
......@@ -2,11 +2,23 @@
shell: apt -y install {{ packages_to_scan }} || true
- name: Create configuration from template
shell: "sed '{{conf_regex}}' {{mca_path}}/etc/flb.conf.in > {{mca_path}}/etc/flb.conf"
shell: "sed '{{conf_regex}}' {{conf}}.in > {{conf}}"
- name: Scan directory
shell: "{{binary}} /sbin {{flb}} {{flb_plugin}} {{flb_conf}} {{log}}"
shell: "{{binary}} /bin {{flb}} {{flb_plugin}} {{flb_conf}} {{log}}"
- name: Launch fluent-bit
shell: "{{flb}} -e {{plugin}} -c {{conf}} &"
# TODO: store fluent-bit's PID to wait for it at the end
- name: Pre-scan
shell: "sleep 1"
- name: Scan /sbin
shell: "{{mca}} /sbin {{log}}"
- name: Scan /bin
shell: "{{mca}} /bin {{log}}"
- name: Post-scan
shell: 'echo "{end_marker: \"fluentbit_end\"}" >> {{log}}'
- name: "Build successful, connect to:"
shell: "true"
## PACKAGES
mca_name: mca--static
fluentbit_name: fluent-bit
plugin_name: plugin-fluentbit-to-wendelin
mca_path: /opt/{{mca_name}}
flb_path: /opt/{{fluentbit_name}}
plugin_path: /opt/{{plugin_name}}
## WENDELIN CONFIGURATION
wendelin_url: "{{ lookup('env', 'ANSIBLE_wendelin_url') }}"
wendelin_user: "{{ lookup('env', 'ANSIBLE_wendelin_user') }}"
wendelin_pwd: "{{ lookup('env', 'ANSIBLE_wendelin_pwd') }}"
wendelin_reference: "{{ lookup('env', 'ANSIBLE_wendelin_reference') }}"
packages_to_scan: "{{ lookup('env', 'ANSIBLE_packages_to_scan') }}"
## OTHER
conf_regex: s|%WENDELIN_URL%|{{wendelin_url}}|g;s|%WENDELIN_PWD%|{{wendelin_pwd}}|g;s|%WENDELIN_REFERENCE%|{{wendelin_reference}}|g
binary: "{{mca_path}}/bin/metadata-collect-agent"
mca: "{{mca_path}}/bin/metadata-collect-agent"
flb: "{{flb_path}}/bin/fluent-bit"
flb_plugin: "{{mca_path}}/lib/libfluentbit_wendelin.so"
flb_conf: "{{mca_path}}/etc/flb.conf"
plugin: "{{plugin_path}}/lib/libfluentbit_wendelin.so"
conf: "{{plugin_path}}/etc/flb.conf"
log: /var/log/metadata_collect.log
conf_regex: s|%WENDELIN_URL%|{{wendelin_url}}|g;s|%WENDELIN_USER%|{{wendelin_user}}|g;s|%WENDELIN_PWD%|{{wendelin_pwd}}|g;s|%WENDELIN_REFERENCE%|{{wendelin_reference}}|g;s|%SCAN_FILE%|{{log}}|g
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment