Problem:
I will reach the goal that foreman/puppet deploy a docker container on every Node in a class. I use docker puppet module for that. I declare the docker containers over the docker::run_instance method of type hash. My problem is now, that i have to set an individual part of the docker instantiation. Example of my smart class parameter:
mysqld_exporter:
image: mysqld-exporter:latest
env:
i have seen the topic: Use facts in smart variables
but this wont go because of error message: “no implicit conversion of String into Hash”
I’m not good in foreman puppet and so on, but i think it is a problem that the erb output is a string and the smart class parameter should be a hash.
Expected outcome:
I hope that it is possible to use a fact variable in the smart class parameter to reach my goal. example:
mysqld_exporter:
image: mysqld-exporter:latest
env:
If I understand your problem correctly, you just need to format the data you want in the parameter into a hash.
The text you enter as a value should look something like this (replace with the keys and values you actually need:
Hi areyus,
thanks for your answer and the explanation. I have now tested a little bit and have now a result why there are the problems. Also i have now rebuild my ruleset for all my Host Groups and by doing that, i have found the problem.
First i have inserted the following parameter (Smart Class Parameter Type is hash):
This is in hiera notation.
With these input values, on the managed node all is fine and running.
Problem Description
After that, i have reconfigured my ruleset for different host groups in foreman. Some in the JSON notation, some in the hiera notation. This is also running if the ‘Merge Overrides’ functionality isn’t activated.
Have today updated the foreman katello to Version 3.5 & 4.7.
Now the problem seems to be solved. Have backported my hiera hash definitions to rules on different hierarchy levels.
Check with /etc/puppetlabs/puppet/node.rb [hostname] on different hosts now runs as expected.