Indempotency goal hard to reach, can this be done with dict, lists, nested lists?

21 views
Skip to first unread message

Marko Lisica

unread,
Apr 2, 2014, 3:56:36 AM4/2/14
to ansible...@googlegroups.com
Hi I came into a problem while I was trying  to make this role work.

- name: add db
  mysql_db: name={{ item.user }} state=present
  with_items: users

- name: add user
  mysql_user: name={{ item.user }} host=localhost password={{ mysql_pass }}
      state=present priv={{ item.db }}.*:ALL
  with_items: users

How can I create variable list so I can have multiple databases for single user and setup db permissions on coresponding databases for specific user?

eg.

---
users:
  - user: user1
    db:
      - db1
      - db11
  - user: user2
    db:
      - db2
  - user: user3
    db:
      - db3
      - db33
      - db333
Reply all
Reply to author
Forward
0 new messages