So I'm still having trouble with this.  Here's my task:

  - name: Promote new RHEL7 version to Lifecycle Environments
   uri:
     url: "https://satellite/katello/api/v2/content_view_versions/{{ 
(content_views7.json.results[0].id | int) }}/promote"
     method: POST
     body:
       description: "Promoted by Tower"
       environment_id: "{{ item }}"
       organization_id: 3
       force: true
     user: "{{ satellite_user }}"
     password: "{{ satellite_pass }}"
     force_basic_auth: yes
     validate_certs: no
     body_format: json
     status_code: 202
   register: promote_rhel7
   loop:
     - 3
     - 4
     - 5
     - 6
     - 7
     - 8
   until: promote_rhel7.json.result == 'success'
   retries: 10
   delay: 20


I tried this but it error'd out with:

fatal: [localhost]: FAILED! => {"msg": "The conditional check 
'promote_rhel7.json.result == 'success'' failed. The error was: error while 
evaluating conditional (promote_rhel7.json.result == 'success'): 'dict 
object' has no attribute 'result'"}


Which I kind of expected because it doesn't seem like it's returning 
anything.  I'm trying to loop through all the lifecycle environments in one 
task, but I also need to check the tasks from satellite to ensure the 
promotion is done before it attempts to promote to the next lifecycle 
environment, or it'll throw a lock error.  I know I could ditch the loop 
and create a task for each lifecycle environment, and check satellite tasks 
prior to each promotion, but I was hoping there was a sleeker way to do it.

I've used loop_control and pause previously, but I'd like to know for 
certain a promote is complete before attempting the next one.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/6251fc3b-aac7-4e63-8e5a-a6a840da0ecc%40googlegroups.com.

Reply via email to