Skip to content

Instantly share code, notes, and snippets.

@lazyfrosch
Last active February 24, 2022 08:43
Show Gist options
  • Save lazyfrosch/2d3b60bb1fa68562e8a9355846a67711 to your computer and use it in GitHub Desktop.
Save lazyfrosch/2d3b60bb1fa68562e8a9355846a67711 to your computer and use it in GitHub Desktop.
Debugging Ansible - simple test with parts from https://galaxy.ansible.com/cloudalchemy/node_exporter
- name: Manage node_exporter on servers
hosts: localhost
vars:
node_exporter_version: 1.3.1
go_arch: amd64
node_exporter_local_tmp_directory: "{{ ansible_env.HOME }}/.cache/ansible/node_exporter/{{ node_exporter_version }}"
tasks:
- name: Ensure local cache directory
file:
path: '{{ node_exporter_local_tmp_directory }}'
state: directory
delegate_to: localhost
check_mode: false
- name: Download node_exporter binary to local folder
become: false
get_url:
url: "https://github.com/prometheus/node_exporter/releases/download/v{{ node_exporter_version }}/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz"
dest: "{{ node_exporter_local_tmp_directory }}/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz"
mode: '0644'
register: _download_binary
delegate_to: localhost
check_mode: false
- name: Unpack node_exporter binary
become: false
unarchive:
src: "{{ node_exporter_local_tmp_directory }}/node_exporter-{{ node_exporter_version }}.linux-{{ go_arch }}.tar.gz"
dest: "{{ node_exporter_local_tmp_directory }}"
delegate_to: localhost
check_mode: false
ansible [core 2.12.2]
config file = /home/markus/git/lazyfrosch/ansible/site/ansible.cfg
configured module search path = ['/home/markus/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /home/markus/.virtualenvs/ansible/lib/python3.9/site-packages/ansible
ansible collection location = /home/markus/.ansible/collections:/usr/share/ansible/collections
executable location = /home/markus/.virtualenvs/ansible/bin/ansible
python version = 3.9.10 (main, Jan 16 2022, 17:12:18) [GCC 11.2.0]
jinja version = 3.0.3
libyaml = True
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment