--- - set_fact: "node_exporter_extract_dir=node_exporter-{{node_exporter_version}}.{{node_exporter_os}}-{{node_exporter_architecture}}" - name: Create configuration directory file: state: directory dest: "{{node_exporter_home_dir}}/conf" mode: '0700' - name: Download Node Exporter get_url: url: "{{node_exporter_url}}" dest: "{{node_exporter_home_dir}}/node_exporter-{{node_exporter_version}}.tgz" mode: '0600' checksum: 'sha256:{{node_exporter_checksum}}' # There's a bug in become_user that doesn't set permissions on the temp directory # which is asinine when my user has sudo persmissions. - name: Extract Node exporter shell: | #!/bin/sh set -e if ! [ -e "{{node_exporter_home_dir}}/{{node_exporter_extract_dir}}" ] ; then cd "{{node_exporter_home_dir}}" tar xzf node_exporter-{{node_exporter_version}}.tgz exit 50 fi register: res changed_when: res is defined and res.rc == 50 ignore_errors: true notify: Restart node_exporter - name: Link node_exporter directory file: state: link src: '{{node_exporter_extract_dir}}' dest: '{{node_exporter_home_dir}}/node_exporter' force: yes - name: Link configuration files file: state: link src: '../conf/{{item}}' dest: '{{node_exporter_home_dir}}/node_exporter/{{item}}' force: yes loop: - web_config.yml notify: Restart node_exporter - name: Include tls tasks include_tasks: tls.yml when: node_exporter_tls - name: Write node_exporter configuration file copy: content: '{{node_exporter_web_config | to_nice_yaml}}' dest: '{{node_exporter_home_dir}}/conf/web_config.yml' mode: '0600' notify: Restart node_exporter tags: - configuration when: node_exporter_web_config is defined - name: Include Runit tasks include_tasks: runit.yml