Cade, Check out https://docs.ansible.com/ansible/latest/user_guide/playbooks_loops.html There's delays, retries etc. You can use any of this to accomplish what you want.
On Tue, Aug 20, 2019 at 1:29 PM Cade Lambert <[email protected]> wrote: > 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 > <https://groups.google.com/d/msgid/ansible-project/60b7d8f5-fad5-47c6-bb22-91c47ae0da1c%40googlegroups.com?utm_medium=email&utm_source=footer> > . > -- Jonathan Cha'gara Lozada De La Matta He / Him / His Red Hat <https://www.redhat.com> Senior Automation Practice Consultant & Automation CoP Manager Join the Automation CoP! https://red.ht/autocop @redhatjobs <https://twitter.com/redhatjobs> redhatjobs <https://www.facebook.com/redhatjobs> @redhatjobs <https://instagram.com/redhatjobs> <https://www.redhat.com> -- 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/CAFYJA%2BLcJ--_481%3DbLW4krdNob8h2-bpTLio%3D%3DGsJzh7jaq_FQ%40mail.gmail.com.
