FreeKB - Ansible Role Duplication (allow_duplicates)
Ansible - Role Duplication (allow_duplicates)

By default, a role will only be invoked once. In this example, even though the foo role was declared twice, the foo role will only be invoked once.

---
- hosts: all
  roles:
    - foo
    - foo

 

One option is to use allow_duplicates: true in the roles/foo/meta/main.yml file, like this.

---
allow_duplicates: true

 

The other option is to pass unique variables into the role, like this.

---
- hosts: all
  roles:
    - role: foo
      vars:
        bar: Hello

    - role: foo
      vars:
        bar: World

 



Add a Comment




We will never share your name or email with anyone. Enter your email if you would like to be notified when we respond to your comment.




Please enter 4b3d5 in the box below so that we can be sure you are a human.




Comments

Web design by yours truely - me, myself, and I   |   jeremy.canfield@freekb.net   |