Dear Team,
I have been trying to add conditionals for my tasks and roles.
But, the one I entered for role is getting evaluated to true always and the one on the tasks are evaluated to false.
Can you help on what needs to be changed.
Below is my playbookÂ
- hosts: sec
 roles:
 - role: service-operations
  when: (bName == 'security') or (bName == 'all')
- hosts: core
 roles:
 - role: service-operations
  when: (bName == 'core') or (bName == 'all')
- hosts: composition
 roles:
 - role: service-operations
  when: (bName == 'composition') or (bName == 'all')
The above playbook is getting executed for all hosts, even though the bName 'security'.
Below are the tasks
- name: Adding the User account to Log on as a service
 win_user_right:
  name: SeServiceLogonRight
  users:
  - '{{ srvLogOnUsr }}'
  action: add
 when: uselogonUser
- name: Start the service with logon
 win_service:
  name: "{{ service }}"
  start_mode: auto
  state: started
  username: "{{ srvLogOnUsr }}"
  password: "{{ srvLogOnPassword }}"
 when:
  - opr == "Start"
  - uselogonUser == "true"
Both these tasks are gettign skipped even though uselogonUser = true & opr = Start
Can anyone guide me on what is going wrong.
Thanks
Sanoop