Problem:
I got an Ansible role with the following:
- defaults/main.yml:
---
# defaults file for test
my_message: "Good morning Vietnam!"
- tasks/main.yml:
---
# tasks file for test
- name: Print message
debug:
var: my_message
I import this role in Foreman, but I don’t want to assign it to any host or host group as I don’t want it to be executed with the rest of the roles (the role above is just an example but my goal is to apply updates including monitoring downtime and server restart), so I create a job template with the following content:
---
- hosts: all
pre_tasks:
- name: Display all parameters known for the Foreman host
debug:
var: foreman
roles:
- test
I set it as an “Ansible Playbook” job category and run it on one of my hosts by scheduling a remote job. So far, it’s perfect and I got the ouput:
[...]
TASK [test : Print message] ****************************************************
ok: [client.domain.com] => {
"my_message": "Good morning Vietnam!"
}
[...]
Now, I want to change my default variable, so I import it (Configure > Variables), edit it and set the “Default Value” to “This is not a test, this is rock and roll!” and run my role again. But still got the same output:
[...]
TASK [test : Print message] ****************************************************
ok: [client.domain.com] => {
"my_message": "Good morning Vietnam!"
}
[...]
Expected outcome:
[...]
TASK [test : Print message] ****************************************************
ok: [client.domain.com] => {
"my_message": "This is not a test, this is rock and roll!"
}
[...]
Foreman and Proxy versions:
Smart Proxies 1.24.2
Foreman and Proxy plugin versions:
Foreman-tasks 0.17.5
Foreman_ansible 4.0.4
Foreman_remote_execution 2.0.8
Distribution and version:
Oracle Linux 7.7
Other relevant data: