diff --git a/tasks/download.yml b/tasks/download.yml new file mode 100644 index 0000000..4cc88e7 --- /dev/null +++ b/tasks/download.yml @@ -0,0 +1,7 @@ +--- +- name: Install windows node_exporter + chocolatey.chocolatey.win_chocolatey: + name: prometheus-windows-exporter.install + version: '{{ win_exporter__version_target }}' + source: https://community.chocolatey.org/api/v2/ + state: present diff --git a/tasks/get_exporter_version.yml b/tasks/get_exporter_version.yml index 777edfc..192805f 100644 --- a/tasks/get_exporter_version.yml +++ b/tasks/get_exporter_version.yml @@ -3,7 +3,7 @@ when: win_exporter__version == "latest" block: - name: "Get latest windows_exporter release metadata" - ansible.builtin.uri: + ansible.windows.win_uri: url: "{{ win_exporter__repo_api }}" return_content: true register: win_exporter__remote_metadata @@ -30,4 +30,5 @@ - name: "Generate windows_exporter download URL" ansible.builtin.debug: - msg: "{{ win_exporter__version_target }}" + msg: "Install Version {{ win_exporter__version_target }}" + verbosity: 1 diff --git a/tasks/main.yml b/tasks/main.yml index e73bdfa..89c560c 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,3 +1,12 @@ --- +- name: 'Install python 3.12' + chocolatey.chocolatey.win_chocolatey: + name: python + version: '3.12.0' + state: present + - name: Get latest windows_exporter version ansible.builtin.include_tasks: get_exporter_version.yml + +- name: Download windows_exporter version + ansible.builtin.include_tasks: download.yml