Thanks, this will do nicely.

On Mon, 3 Jun 2019 at 19:29, Kai Stian Olstad <
[email protected]> wrote:

> On 03.06.2019 12:40, Dick Visser wrote:
> > - name: Fetch roles
> >    hosts: all
> >    connection: local
> >    tags: always
> >    run_once: yes
> >    tasks:
> >      - Role fetch logic here...
> >
> > - name: Deploy stuff
> >    hosts: all
> >    roles:
> >      - myrole1
> >      - myrole2
> >      - myrole3
> >
> >
> >
> > This works. But when starting from scratch, i.e. when the first play
> > has never run, the directory where it will put the roles is empty.
> > This causes the playbook to fail with
> >
> > ERROR! the role 'myrole1' was not found in....
> >
> > So all plays/tasks are evaluated and it throws an error because a role
> > does not exist yet (which makes sense).
> >
> > We're already using a wrapper shell script around ansible-playbook to
> > ease deployment by feeding it things like vault ID, inventory etc, so
> > I'm tempted to just add a extra ansible-play run first that does the
> > role fetching.
> >
> > Is there a way to make this work by running ansible only once?
>
> Pretty sure it's not possible in one playbook.
> But if you split it in two playbooks you only need one ansible-playbook,
> so it sort of only once.
>
> ansible-playbook fetch.yml deploy.yml
>
>
> --
> Kai Stian Olstad
>
> --
> 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/45de3c8b-0900-1ba0-42ac-7fdde72f4f10%40olstad.com
> .
> For more options, visit https://groups.google.com/d/optout.
>
-- 
Sent from a mobile device - please excuse the brevity, spelling and
punctuation.

-- 
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/CAL8fbwMKkP_EojdjtQmd0-5ONiFEGK12kBbJYS3%3DbNPvQ8J-FQ%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to