I created a playbook to connect to Satellite via API, publish new content 
views, and promote the various lifecycle environments to these new Content 
View versions, looping through a list of Lifecycle Environments.  The issue 
I'm having is I can't figure out a way for my task to wait until the 
promotion of one Lifecycle Environment is completed before attempting to 
promote the next.  If it tries to promote while a promotion is already in 
progress, the task fails.  I've added a delay to the task to try to wait it 
out but that doesn't always work and was hoping for a more clever 
solution.  Here's my task:

  - name: Promote new RHEL7 version to Lifecycle Environments
    uri:
      url: "https://satelliteserver/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
    loop:
      - 3
      - 4
      - 5
      - 6
      - 7
      - 8
    loop_control:
      pause: 180

Any input on a way to wait for the promotion to finish, or a cleaner way of 
doing the same thing?

-- 
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/60b7d8f5-fad5-47c6-bb22-91c47ae0da1c%40googlegroups.com.

Reply via email to