Commit 716b7749 authored by Xiaowu Zhang's avatar Xiaowu Zhang

playbook/ridge: fix waitfor fluentbit and display more infos to log

parent 02c4eb6b
Pipeline #25486 failed with stage
in 0 seconds
...@@ -11,12 +11,20 @@ ...@@ -11,12 +11,20 @@
- name: Create configuration from template - name: Create configuration from template
shell: "sed '{{conf_regex}}' {{conf}}.in > {{conf}}" shell: "sed '{{conf_regex}}' {{conf}}.in > {{conf}}"
- name: save fluentbit conf
shell: cat {{conf}}
register: fluentbit_conf_content
- name: print fluentbit conf to a console
debug:
msg: "{{ fluentbit_conf_content.stdout }}"
- name: Launch fluent-bit - name: Launch fluent-bit
shell: "{{flb}} -e {{plugin}} -c {{conf}} &" shell: "{{flb}} -e {{plugin}} -c {{conf}} 2>fluentbit.log&"
# TODO: store fluent-bit's PID to wait for it at the end
- name: Pre-scan - name: Pre-scan
shell: 'sleep 1; echo "{\"beginning_date\": \"{{ ansible_date_time.iso8601 }}\"}" >> {{log}}' shell: 'sleep 60; echo "{\"beginning_date\": \"{{ ansible_date_time.iso8601 }}\"}" >> {{log}}'
- name: Scan /sbin - name: Scan /sbin
shell: "{{mca}} /sbin {{log}}" shell: "{{mca}} /sbin {{log}}"
...@@ -27,9 +35,30 @@ ...@@ -27,9 +35,30 @@
- name: Post-scan - name: Post-scan
shell: 'echo "{\"end_date\": \"{{ ansible_date_time.iso8601 }}\", \"end_marker\": \"fluentbit_end\"}" >> {{log}}' shell: 'echo "{\"end_date\": \"{{ ansible_date_time.iso8601 }}\", \"end_marker\": \"fluentbit_end\"}" >> {{log}}'
- name: display fluentbit log
shell: cat fluentbit.log
register: fluentbit_log_content
- name: Print the fluentbit log content to a console
debug:
msg: "{{ fluentbit_log_content.stdout }}"
- name: get fluent-bit pid
shell: 'pidof fluent-bit'
register: fluentbit_pid
- name: Print the fluentbit log content to a console
debug:
msg: "{{ fluentbit_pid.stdout }}"
- name: Wait fluent-bit - name: Wait fluent-bit
shell: 'waitpid $(pidof fluent-bit) || true' ansible.builtin.wait_for:
# pid not found: fluent-bit ended correctly before "pidof" is run timeout: 600
path: /proc/{{fluentbit_pid.stdout}}/status
state: absent
when: fluentbit_pid != ""
- name: "Build successful, connect to:" - name: "Build successful, connect to:"
shell: "true" shell: "true"
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