Hello,

I would do it in a template, but it can be done in a variable as well. An 
example in a playbook:

---

- hosts: localhost
  gather_facts: False

  vars:
    app__domain: 'example.com'
    app__subdomains: [ '', 'api', 'www' ]
    app__fqdns: |
      {% set my_list = [] %}
      {% for subdomain in app__subdomains %}
      {% if subdomain %}
      {% set _ = my_list.append(subdomain + '.' + app__domain) %}
      {% else %}
      {% set _ = my_list.append(app__domain) %}
      {% endif %}
      {% endfor %}
      {{ my_list }}


  tasks:

    - debug: var=app__fqdns

An example output:

PLAY [localhost] 
***************************************************************

TASK [debug] 
*******************************************************************
ok: [localhost] => {
    "app__fqdns": [
        "example.com", 
        "api.example.com", 
        "www.example.com"
    ]
}


How do you like DebOps?

Cheers,
Maciej

W dniu środa, 14 września 2016 19:52:26 UTC+2 użytkownik Ju Ju napisał:
>
> Hi, 
>
> I need to create a list of fqdn according to à list of subdomain and a 
> domain: 
>
> app__domain: '{{ ansible_local.core.domain 
>                       if (ansible_local|d() and ansible_local.core|d() and 
>                           ansible_local.core.domain|d()) 
>                       else (ansible_domain if ansible_domain else 
> ansible_hostname) }}' 
>
> app_subdomains: [ '', 'api' , 'www' ] 
>
> app_fqdns: .... ? 
>
> app_fqdns must be ['mydomain.com', 'api.mydomain.com', 'www.mydomain.com 
> ] 
>
> How could I do this ? 
>
> PS: I'm using debops. 
>
> Azzz

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/2c6e4f9d-4c5e-4963-a27a-f03d1ef57d02%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to