Hey Adrian -- thanks for your response! I did about an hour of reading and playing around with dependencies and I figured it out:
I needed to add allow_duplicates: yes to the role I was depending on, not my role. So I forked the redis-server role, added the statement, and it works! Thanks for helping to point me in the right direction. Matthew On Wed, Jul 26, 2017 at 4:20 PM, Adrian Likins <[email protected]> wrote: > http://docs.ansible.com/ansible/latest/playbooks_ > roles.html#role-dependencies > > "Roles dependencies are always executed before the role that includes > them, and are recursive. By default, roles can also only be added as a > dependency once - if another role also lists it as a dependency it will not > be run again. This behavior can be overridden by adding allow_duplicates: > yes to the meta/main.yml file. For example, a role named ‘car’ could add > a role named ‘wheel’ to its dependencies as follows:" > > Does 'allow_duplictes: yes' work?" > > On Wed, Jul 26, 2017 at 4:47 PM, Matthew Rathbone <[email protected]> wrote: > >> Hey guys, >> >> So I have a project setup in the following way: >> >> - requiring an external redis-server role >> - my own role called redis-cluster-shard that uses redis-server as a >> dependency >> - a playbook that applies this role twice to the same node. Like this: >> >> >> - role: "rds-cache-shard" >> rds_port: 7000 >> - role: "rds-cache-shard" >> rds_port: 7001 >> >> >> >> The way a redis install is created is through the dependency in >> meta/main.ytml, which looks like this: >> >> >> dependencies: >> - role: redis-server >> redis_service_name: "rds_shard_{{rds_port}}" >> redis_logfile: "/var/log/rds_shard_{{rds_port}}.log" >> redis_clustermode_enabled: "yes" >> redis_port: "{{rds_port|int}}" >> redis_save: >> - 3600 1 >> >> >> >> >> The problem I'm having is that only one redis shard is created. IE the >> dependency only runs once, on the first rds-cache-shard include. >> >> Am I doing something wrong? I'd expect the dependency tasks to run each >> and every time a role is included, especially as I'm scoping it with >> variables (rds_port). >> >> >> -- >> 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 post to this group, send email to [email protected]. >> To view this discussion on the web visit https://groups.google.com/d/ms >> gid/ansible-project/91d394a4-8a40-413e-802e-978117a30929% >> 40googlegroups.com >> <https://groups.google.com/d/msgid/ansible-project/91d394a4-8a40-413e-802e-978117a30929%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to a topic in the > Google Groups "Ansible Project" group. > To unsubscribe from this topic, visit https://groups.google.com/d/ > topic/ansible-project/W2WNjA0altE/unsubscribe. > To unsubscribe from this group and all its topics, send an email to > [email protected]. > To post to this group, send email to [email protected]. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/ansible-project/CAOJNLf8GzeOniCL_P%2Bbir3xeruKj_FYuPYs% > 2BVK56xMaOjUWg9A%40mail.gmail.com > <https://groups.google.com/d/msgid/ansible-project/CAOJNLf8GzeOniCL_P%2Bbir3xeruKj_FYuPYs%2BVK56xMaOjUWg9A%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- *Matthew Rathbone* VP of Engineering <http://kickbox.io> <+(214)+308-2245>(214) 308-2245 2556 Elm St, Dallas, TX 75226 kickbox.io <https://www.facebook.com/kickboxio> <https://twitter.com/kickboxio> <https://www.linkedin.com/company/kickbox-io> <[email protected]> -- 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 post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAGWkgWEV1PkOWYtjwroYSM0jgekMP6peR2QUcEnsmDA_SG2XLg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
