Technotes

Technotes for future me

Ansible execute a role with condition

Ansible execute a role with condition

---

# execute a role with condition

- hosts: http
  user: "test"
  become: yes
  become_method: sudo
  connection: ssh
  roles:
     - { role: http, when: "ansible_distribution == 'CentOS' and ansible_distribution_major_version == '7'" }
Last updated on 31 Jan 2021
Published on 11 Dec 2019
Edit on GitHub