- name: Install vmagent {{ victoriametrics_vmagent_version }} dnf: name: "vmagent-{{ victoriametrics_vmagent_version }}" state: present register: vmagent_setup notify: Restart vmagent - name: Template vmagent config template: src: etc/victoriametrics/vmagent/vmagent.conf.j2 dest: /etc/victoriametrics/vmagent/vmagent.conf notify: Restart vmagent - name: Merge prometheus config values set_fact: victoriametrics_vmagent_prometheus_config_combined: "{{ victoriametrics_vmagent_prometheus_config_default | combine(victoriametrics_vmagent_prometheus_config, recursive=true) | to_nice_yaml(indent=2) }}" #- name: Template vmagent prometheus config # copy: # content: "{{ victoriametrics_vmagent_prometheus_config }}" # dest: /etc/victoriametrics/vmagent/prometheus.yml # notify: Restart vmagent - name: Template vmagent prometheus config template: src: etc/victoriametrics/vmagent/prometheus.yml.j2 dest: /etc/victoriametrics/vmagent/prometheus.yml notify: Restart vmagent - name: Enable and start vmagent service systemd: name: vmagent state: started enabled: yes daemon_reload: yes