---
  - name: Create exemONE Agent Directory
    ansible.builtin.file:
      path: "{{ EXEM_HOME }}"
      state: directory
      mode: '0755'

  - name: Copy exemONE host-agent File
    ansible.builtin.copy:
      src: "{{ role_path }}/files/host"
      dest: "{{ EXEM_HOME }}"
      mode: '0755'

  - name: Create Agent Config File
    ansible.builtin.template:
      src: "{{ item }}.j2"
      dest: "{{ EXEM_HOME }}/host/{{ item }}"
      mode: '0755'
    with_items: 
      - host_config

  - name: Install Start exemONE Host-Agent
    ansible.builtin.shell: |
      {{ EXEM_HOME }}/host/setup_exem-host-agent_{{ host_agent_version }}.bin ./host_config
    args:
      chdir: "{{ EXEM_HOME }}/host"

  - name: exem-host-agent start and enable
    ansible.builtin.shell: |
      {{ EXEM_HOME }}/host/exem/host/start.sh
