Hello Colin,

The most simple way I guess is just to split your playbook with pre_tasks, 
roles and tasks sections. Something similar to:

---
- hosts: all
  vars: []
  pre_tasks:
  - name: create group titled deploy
    group: name=deploy state=present
  - name: update apt-cache
    sudo: yes
    apt: update_cache=yes
  - name: create deploy user
    user: name=deploy group=deploy groups=sudo comment="Deployment User" 
home="/home/deploy" shell="/bin/bash" 
  roles:
    - external-rbenv-role
  tasks:
  - name: Install the kitchen sink
    action: apt name={{item}} state=present update_cache=true
    sudo: yes
    with_items:
     - libqtwebkit-dev
     - node
  -  lots of other tasks 
  post_tasks: []

Regards,
Borys

вторник, 29 декабря 2015 г., 2:08:37 UTC+2 пользователь Colin Byrne написал:
>
> So I used to have one fairly long main.yml playbook that was used to 
> perform a number of similar-tasks, one of which was to install rbenv, the 
> ruby management tool.
>
> ---
>
>   - name: create group titled deploy
>
>     group: name=deploy state=present
>
>   - name: update apt-cache
>
>     sudo: yes
>
>     apt: update_cache=yes
>
>   - name: create deploy user
>
>     user: name=deploy group=deploy groups=sudo comment="Deployment User" 
> home="/home/deploy" shell="/bin/bash" 
>
>   - name: download rbenv
>
>   ...  
>
>   - name: install rbenv
>
>   ... 
>
>   - name: configure rbenv
>
>   ...  
>
>   - name: Install the kitchen sink
>
>     action: apt name={{item}} state=present update_cache=true
>
>     sudo: yes
>
>     with_items:
>
>       - libqtwebkit-dev
>
>       - node
>   -  lots of other tasks 
>   ...
>
> I found a nice galaxy role that better suits my needs for installing 
> rbenv, and I now want to include it to run in the same order as previously, 
> but I am confused as to how the documentation recommends to do this and the 
> syntax (seemingly with dependencies or includes?). It is hard to decipher 
> wether I will have to split it into three roles (the pre-rbenv, rbenv, 
> post-rbenv) which would really seem inconvenient as the three would always 
> be used together. I suspect this is a pretty common dilemma...
>
> Thank you all for the help so far, this forum has really made is a 
> pleasure learning ansible. 
>

-- 
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/e59cb922-3f2f-410e-8d48-3bb7b59ee811%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to