I use a loop with_items, but I want to put the variable into a body of a 
json and it doesn´t works.


- name: Associate subscriptions ak-{{tenant}}-RHEL_7 
    uri:
       url: 
"https://xxxxxxxx/katello/api/activation_keys/{{ak_id[0]}}/add_subscriptions";
       user: "{{user}}"
       password: "{{password}}"
       method: PUT
       return_content: yes
       force_basic_auth: yes
       validate_certs: no
       body_format: json
       body: '{"subscription_id":  "{{item}}" }'
       with_items:
               - 340
               - 343
       status_code: [200,201,202,204,301,401]


What is it wrong? -->        body: '{"subscription_id":  "{{item}}" }'

The task includes an option with an undefined variable. The error was: 
'item' is undefined

The error appears to have been in 
'/awx/scripts/scm/ca/satellite/ak/ca_sat_ak_put_subscriptions.yml': line 
48, column 5, but may
be elsewhere in the file depending on the exact syntax problem.

The offending line appears to be:


  - name: Associate subscriptions ak-{{tenant}}-RHEL_7-{{tecnologia}}_LB
    ^ here
We could be wrong, but this one looks like it might be an issue with
missing quotes.  Always quote template expression brackets when they
start a value. For instance:

    with_items:
      - {{ foo }}

Should be written as:

    with_items:
      - "{{ foo }}"

-- 
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/885f310d-f1ac-486b-935c-25d9636a04a1%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to