role dependencies question

28 views
Skip to first unread message

张斌

unread,
Jan 1, 2016, 12:49:32 PM1/1/16
to Ansible Project

 hi,

   i have role1 which depend on role2.  and i want role2 to know the path of role1 without being hardcoded, how can i achieve this?

 #role1/meta/main.yml
  dependencies:
   - { role: role2, role_dir: "{{role_path}}" }    --> it doesn't work, role_dir is always the path of role2

thanks

chris meyers

unread,
Jan 1, 2016, 1:52:55 PM1/1/16
to Ansible Project
Use the role_path variable to get most of the path. Then go back a dir and into role1.
 - { role: role2, role_dir: "{{ role_path }}/../role1" }

张斌

unread,
Jan 2, 2016, 10:22:25 AM1/2/16
to Ansible Project
 
 Thanks,  this could be a solution.
Reply all
Reply to author
Forward
0 new messages