Andreas Olsson
unread,Nov 27, 2016, 4:23:58 AM11/27/16Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Sign in to report message
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to Ansible Project
Greetings
Since moving from Ansible 2.1.3 to Ansible 2.2.0 I have run into an
issue with register, and when it's variable name is built up using a
variable. I have no idea if this is due to a regression in Ansible 2.2,
or if I have been doing something wrong/unsupported which I finally got
bitten by.
Anyway, this being what breaks between 2.1.3 and 2.2.0. Context wise
it's part of a parameterize role.
- name: Add {{ repo_name }} sources
template:
src={{ repo_name }}.list.j2
dest=/etc/apt/sources.list.d/{{ repo_name }}.list
owner=root
group=root
mode=0444
register: reg_{{ repo_name }}_sources
- name: debug reg_{{ repo_name }}_sources
debug: var=reg_{{ repo_name }}_sources
Running Ansible 2.1.3 I get the following expected output.
TASK [repo : Add gitppa sources] ***********************************************
ok: [vagmast]
TASK [repo : debug reg_gitppa_sources] *****************************************
ok: [vagmast] => {
"reg_gitppa_sources": {
"changed": false,
"diff": {
"after": {
"path": "/etc/apt/sources.list.d/gitppa.list"
},
"before": {
"path": "/etc/apt/sources.list.d/gitppa.list"
}
},
"gid": 0,
"group": "root",
"mode": "0444",
"owner": "root",
"path": "/etc/apt/sources.list.d/gitppa.list",
"size": 61,
"state": "file",
"uid": 0
}
}
While with Ansible 2.2 that register never appear to happen.
TASK [repo : Add gitppa sources] ***********************************************
ok: [vagmast]
TASK [repo : debug reg_gitppa_sources] *****************************************
ok: [vagmast] => {
"reg_gitppa_sources": "VARIABLE IS NOT DEFINED!"
}
Any idea what I'm doing wrong, or what I should try?
// Andreas