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

-- 
You received this message because you are subscribed to the Google Groups 
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/1480238624.3089.4.camel%40arrakis.se.
For more options, visit https://groups.google.com/d/optout.

Reply via email to