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: dependencies:
- { role: package, package_name: fluent-bit, package_state: latest }
- { role: package, package_name: mca--static, 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 # this are not actual dependencies, it is just an experimental list of packages to scan
- { role: package, package_name: dracut-core, package_state: latest } - { role: package, package_name: dracut-core, package_state: latest }
......
...@@ -2,11 +2,23 @@ ...@@ -2,11 +2,23 @@
shell: apt -y install {{ packages_to_scan }} || true shell: apt -y install {{ packages_to_scan }} || true
- name: Create configuration from template - 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 - name: Launch fluent-bit
shell: "{{binary}} /sbin {{flb}} {{flb_plugin}} {{flb_conf}} {{log}}" shell: "{{flb}} -e {{plugin}} -c {{conf}} &"
shell: "{{binary}} /bin {{flb}} {{flb_plugin}} {{flb_conf}} {{log}}" # 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:" - name: "Build successful, connect to:"
shell: "true" shell: "true"
## PACKAGES ## PACKAGES
mca_name: mca--static mca_name: mca--static
fluentbit_name: fluent-bit fluentbit_name: fluent-bit
plugin_name: plugin-fluentbit-to-wendelin
mca_path: /opt/{{mca_name}} mca_path: /opt/{{mca_name}}
flb_path: /opt/{{fluentbit_name}} flb_path: /opt/{{fluentbit_name}}
plugin_path: /opt/{{plugin_name}}
## WENDELIN CONFIGURATION ## WENDELIN CONFIGURATION
wendelin_url: "{{ lookup('env', 'ANSIBLE_wendelin_url') }}" wendelin_url: "{{ lookup('env', 'ANSIBLE_wendelin_url') }}"
wendelin_user: "{{ lookup('env', 'ANSIBLE_wendelin_user') }}"
wendelin_pwd: "{{ lookup('env', 'ANSIBLE_wendelin_pwd') }}" wendelin_pwd: "{{ lookup('env', 'ANSIBLE_wendelin_pwd') }}"
wendelin_reference: "{{ lookup('env', 'ANSIBLE_wendelin_reference') }}" wendelin_reference: "{{ lookup('env', 'ANSIBLE_wendelin_reference') }}"
packages_to_scan: "{{ lookup('env', 'ANSIBLE_packages_to_scan') }}" packages_to_scan: "{{ lookup('env', 'ANSIBLE_packages_to_scan') }}"
## OTHER ## OTHER
conf_regex: s|%WENDELIN_URL%|{{wendelin_url}}|g;s|%WENDELIN_PWD%|{{wendelin_pwd}}|g;s|%WENDELIN_REFERENCE%|{{wendelin_reference}}|g mca: "{{mca_path}}/bin/metadata-collect-agent"
binary: "{{mca_path}}/bin/metadata-collect-agent"
flb: "{{flb_path}}/bin/fluent-bit" flb: "{{flb_path}}/bin/fluent-bit"
flb_plugin: "{{mca_path}}/lib/libfluentbit_wendelin.so" plugin: "{{plugin_path}}/lib/libfluentbit_wendelin.so"
flb_conf: "{{mca_path}}/etc/flb.conf" conf: "{{plugin_path}}/etc/flb.conf"
log: /var/log/metadata_collect.log 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