Hammer host create --parameters not passed to the User Data Template

Foreman 2.1.2

I’m using the command “hammer host create --parameters …” to pass parameters to the create process. During the create process the user data template is called. The template does not see the parameters. The parameters are set later in the process. Can the parameters be set before the template is run so the template sees the parameters? Thanks.


Hey @keith28

Can you give an example of the command that you used, please?


In the snippet below the “test” host parameter is passed to the create VM using the hammer --parameters option. When the user_data template is run by Foreman there is no value set for “test”. If “test” is set as a global parameter in the UI then the value of the “test” global parameter is set in the user_data template.


Template snippet:
kind: user_data
- [ sh, -xc, 'echo <%= host_param('test') %>/var/tmp/output']

Create the VM using hammer:
hammer host create --parameters "test=1" ...