Append to array

23 views
Skip to first unread message

elie merhej

unread,
Aug 19, 2016, 11:44:51 AM8/19/16
to Ansible Project
Hi guys, 

This might be a duplicate topic but I wasn't able to find the answer to my question.
if I define a variable array in a role like:

postgresql_pg_hba_default:

  - { type: local, database: all, user: all, address: '', method: md5 }

  - { type: host, database: all, user: all, address: '127.0.0.1', method: md5 }

I have a task in the role that will make sure that the items in the previous array are placed in pg_hba.conf


what I would like to achieve is appending to this array and having the same task in the role to add the extra item:

 - { type: host, database: all, user: test, address: '1.2.3.4', method: md5 }


the end result that I would like to achieve is to have all 3 items in the file without having any extra tasks to add them, this means just updating the list/array at any level (in other roles or playbooks)


Thank you,

Elie.

Reply all
Reply to author
Forward
0 new messages