How to get current role name in an ansible task

前端 未结 4 1441
刺人心
刺人心 2021-02-01 16:05

How can I get the current role name in an ansible task yaml file?

I would like to do something like this

---
# role/some-role-name/tasks/main.yml

- name         


        
4条回答
  •  南笙
    南笙 (楼主)
    2021-02-01 17:05

    As of Ansible 2.8 there is ansible_play_name which contains the name of the currently executed play.

    • https://github.com/ansible/ansible/pull/48562
    • https://docs.ansible.com/ansible/latest/reference_appendices/special_variables.html

提交回复
热议问题