This is my first Ansible Role, so appologies for my ignorance... I wish to start/stop/status the services on my server. I've a role for each task. In my playbook I 've a conditional check to decide which role should be invoked.
---
- name: Manage Kore Cluster
hosts: all
gather_facts: true
become: yes
become_method: sudo
become_user: root
tasks:
- name: kor_start
include_role:
name: kor_start
when: action == kor_start
- name: kor_status
include_role:
name: kor_status
when: action == kor_status
- name: kor_stop
include_role:
name: kor_stop
when: action == kor_stop
name/action names match the role names.
The conditional check 'action == kor_start' failed. The error was: error while evaluating conditional (action == kor_start): 'action' is undefined
Could you advise what do I miss? Thanks!