Skip to content
This repository has been archived by the owner on Aug 18, 2023. It is now read-only.

Fix issue templating systemd unit file #41

Open
wants to merge 4 commits into
base: master
Choose a base branch
from

Conversation

ashleykleynhans
Copy link

This resolves the following error that I have experienced provisioning prometheus node exporter on Ubuntu 22.04 LTS as well as Rocky Linux 8, from a Mac OS Ansible controller host:

TASK [mesaguy.prometheus : Create systemd configuration file for node_exporter service] **************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: ): can only concatenate list (not "AnsibleUnsafeText") to list
fatal: [172.30.35.93]: FAILED! => {"changed": false, "msg": "AnsibleError: Unexpected templating type error occurred on (#\n# Do not edit manually, this file is managed using automation tools\n#\n\n[Unit]\nDescription={{ prometheus_software_description }}\nDocumentation={{ prometheus_software_documentation }}\nRequires=network.target\nAfter=network.target\n\n[Service]\nType=simple\n{% if prometheus_configure_ulimits | bool -%}\nLimitNOFILE={{ prometheus_ulimit_hard_nofile }}\n{% endif -%}\n{% if prometheus_software_systemd_options is defined and prometheus_software_systemd_options -%}\n{% for prometheus_software_systemd_option in prometheus_software_systemd_options -%}\n{{ prometheus_software_systemd_option }}\n{% endfor -%}\n{% endif -%}\n{% if prometheus_software_env_vars is defined and prometheus_software_env_vars -%}\nEnvironmentFile={{ prometheus_etc_dir }}/{{ prometheus_software_service_name }}.env\n{% endif -%}\nUser={% if prometheus_software_runas is defined and prometheus_software_runas -%}\n{{ prometheus_software_runas }}\n{% else -%}\n{{ prometheus_user }}\n{% endif -%}\nGroup={{ prometheus_group }}\n{% for c in [prometheus_software_binary] + prometheus_software_command_args %}\n{% if loop.first and loop.length == 1 %}\nExecStart={% if prometheus_software_prefix_command is defined and prometheus_software_prefix_command %}{{ prometheus_software_prefix_command | join (' ') | replace ('\"', \"'\" ) }} {% endif %}{{ c }}\n{% elif loop.first %}\nExecStart={% if prometheus_software_prefix_command is defined and prometheus_software_prefix_command %}{{ prometheus_software_prefix_command | join (' ') | replace ('\"', \"'\" ) }} {% endif %}{{ c }} \\\n{% elif loop.last %}\n    {{ c | replace ('\"', \"'\" ) }}\n{% else %}\n    {{ c | replace ('\"', \"'\" ) }} \\\n{% endif %}\n{% endfor %}\n{% if prometheus_software_validation_command is defined and prometheus_software_validation_command -%}\nExecStartPre={{ prometheus_software_validation_command }}\n{% endif -%}\n{% if prometheus_software_supports_reload is defined and prometheus_software_supports_reload -%}\nExecReload=/bin/kill -HUP $MAINPID\n{% endif -%}\n{% if prometheus_systemd_pid and installer_instance is defined and installer_instance and installer_instance.name -%}\nExecStartPost=/bin/sh -c \"echo $MAINPID > /var/run/prometheus-{{ prometheus_software_name }}__{{ installer_instance.name }}/{{ prometheus_software_name }}.pid\"\nPIDfile=/var/run/prometheus-{{ prometheus_software_name }}__{{ installer_instance.name }}/{{ prometheus_software_name }}.pid\nRuntimeDirectory=prometheus-{{ prometheus_software_name }}__{{ installer_instance.name }}\n{% elif prometheus_systemd_pid -%}\nExecStartPost=/bin/sh -c \"echo $MAINPID > /var/run/prometheus-{{ prometheus_software_name }}/{{ prometheus_software_name }}.pid\"\nPIDfile=/var/run/prometheus-{{ prometheus_software_name }}/{{ prometheus_software_name }}.pid\nRuntimeDirectory=prometheus-{{ prometheus_software_name }}\n{% endif %}\nRestart=on-failure\nRestartSec=60\n\n[Install]\nWantedBy=multi-user.target\n): can only concatenate list (not \"AnsibleUnsafeText\") to list"}
	to retry, use: --limit @/Users/ashley/.ansible-retry/install_prometheus_node_exporter.retry

@ccauet
Copy link

ccauet commented Sep 22, 2022

I observe the same error on a Ubuntu 18.04.6 LTS host from a macOS 12.4 controller host

@x4FF3
Copy link

x4FF3 commented Nov 15, 2022

hi, i got the same problem, would be great if this would be merged soon
@mesaguy

@gdevdeiv
Copy link

Hi there. I've experienced the same issue, and am currently using ashleykleynhans' repo successfully. Is there any update to this PR?

@ashleykleynhans
Copy link
Author

Maybe mesaguy died or something. His last Github contribution was in April 2021, and his mesaguy.com domain is also no longer registered.

# for free to subscribe to this conversation on GitHub. Already have an account? #.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants