set_fact shouldn't be needed for basic variable concation.  You can
actually just define a variable that references the other two variable
names and it will work

vars:
   "myos" : "{{ ansible_os_family }}-{{ other }}"

etc.

Another handy trick to include distro specific variables is:

tasks:
   - include_vars: "{{ ansible_os_family }}.yml"


On Thu, May 8, 2014 at 4:58 PM, Adam Morris <[email protected]> wrote:

>
>
> On Thursday, May 8, 2014 7:36:08 AM UTC-7, Snyder, Chris wrote:
>>
>>  Thanks for this example.  I’m still pondering over this and it’s
>> possibilities but I’m thinking that I’m probably going to have to rip out a
>> lot of the roles I’ve already defined and make them into task files called
>> from more general roles unless I do a lot of explicit ‘when’ statements for
>> calling roles in my playbooks.
>>
>>
>>
>> Or maybe not.  I’m still trying to get my head around of it.
>>
>>
>> Here's the top of my site.yml
>
> # file: site.yml
>
> # Set up groups automatically for OS
> - include: group.yml
>
> # Perform a basic server configuration
> - include: checklist.yml
>
>
> The group.yml looks like this...
> ---
> # file: group.yml
> - hosts: all
>   gather_facts: true
>   tasks:
>     - group_by: key={{ ansible_os_family }}
>     - group_by: key={{ ansible_product_name.split()[0] }}
>
> Now I can do things like have playbooks like this...
> ---
> - hosts: RedHat
>   gather_facts: false
>   roles:
>     - common
>     - redhat
>
> If you can split tasks into groups then you can work out how to split your
> servers into similar groups and you're set.
>
>
> I hope that this helps,
>    Adam
>
>
>
> --
> 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/bc82ceb3-cb26-4d11-a9e4-bc6836795639%40googlegroups.com<https://groups.google.com/d/msgid/ansible-project/bc82ceb3-cb26-4d11-a9e4-bc6836795639%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>
> For more options, visit https://groups.google.com/d/optout.
>

-- 
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/CA%2BnsWgybYUkfxy2T75mRyvTPRW8o8YiWpPzQx7xh5hUgfkucOA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to