Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support config dir #22

Open
davidlukac opened this issue Sep 22, 2022 · 2 comments
Open

Support config dir #22

davidlukac opened this issue Sep 22, 2022 · 2 comments

Comments

@davidlukac
Copy link

davidlukac commented Sep 22, 2022

vector can be run with --config-dir option, which is suitable for more complex configurations. I'm atm doing

    - import_role:
        name: vector
      become: yes

    - name: "Make vector to load whole config folder"
      community.general.ini_file:
        path: "{{ vector_systemd_file }}"
        section: Service
        option: ExecStart
        value: "/usr/bin/vector --config-dif {{ vector_root }}"
        no_extra_spaces: yes
        mode: '0664'
        backup: true
      become: yes
      notify: restart vector

but it would be great to support this directly in the role.

Also I believe the role run might fail, if complex config references inputs from other files. Only the main config file loading will fail, before change to systemd file is applied, because the role attempts to start the vector even though there are further changes (and notify: restart vector) down the line.

@davidlukac
Copy link
Author

davidlukac commented Sep 22, 2022

ok, so this ^ didn't work as expected. I found this issue addressing it vectordotdev/vector#7256 (released here https://vector.dev/releases/0.15.2/), not well documented though. I guess the solution then would be something like

- name: Set vector configs path
  ansible.builtin.lineinfile:
    path: /etc/default/vector
    line: VECTOR_CONFIG_TOML=/etc/vector/*.toml

before importing the vector role, to avoid starting vector with incomplete configuration.

@davidlukac
Copy link
Author

... and this actually conflicts with

- name: Use the right config_file
  lineinfile:
    path: /etc/default/vector
    line: "VECTOR_CONFIG={{ vector_config_file }}"
    state: present

from the role :-/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant