yes exactly i want the ip addresses either in this form:

 ipadd1,ipadd2,ipadd3,ipadd4,ipadd5,ipadd6,ipadd7,ipadd8

or

ipadd1,
ipadd2,
ipadd3,
ipadd4,
ipadd5,
ipadd6,
ipadd7
ipadd8

but currently i am getting output in below form in inventory-ccp.ini :

[ccpclusternodes]
  ["ipadd1", "ipadd2", "ipadd3", "ipadd4" ]
['ipadd5', 'ipadd6', 'ipadd7', 'ipadd8']

in main.yaml:
name: create ccp inventory
  vars:
    ccp_nodes: "{{ lookup('file', '../ip_address.txt'  , wantlist=True ) }}"
  template:
    src: inventory-ccp.ini.j2
    dest: inventory-ccp.ini

ip_address.txt:

 ["ipadd1", "ipadd2", "ipadd3", "ipadd4" ]
['ipadd5', 'ipadd6', 'ipadd7', 'ipadd8']


The motive is, these ip are getting fetched  dynamically from a url and
need to deploy certificates in all the ip addresses using ansible.


On Mon, Mar 1, 2021 at 10:29 AM Vladimir Botka <[email protected]> wrote:

> On Mon, 1 Mar 2021 10:03:02 +0100
> Sakshi Rathore <[email protected]> wrote:
>
> > instead of specific ip when i want all ip addresses without bracket
>
> It's not clear what type you're looking for. Should it be a list?
>
>     - debug:
>         var: ip_list|flatten
>
> gives
>
>   ip_list|flatten:
>   - ipadd1
>   - ipadd2
>   - ipadd3
>   - ipadd4
>   - ipadd5
>   - ipadd6
>   - ipadd7
>   - ipadd8
>
> Or, should it be a string perhaps?
>
>     - debug:
>         var: ip_list|flatten|join(',')
>
> gives
>
>   ip_list|flatten|join(','):
>   ipadd1,ipadd2,ipadd3,ipadd4,ipadd5,ipadd6,ipadd7,ipadd8
>
> Post expected result if this not what you want.
>
> --
> Vladimir Botka
>

-- 
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/CAJeB3MPtVYJY-rxUMJykUP0H2aSimepzVVDBT_Xat4Lw4GXVXQ%40mail.gmail.com.

Reply via email to