Hi all,
I’m writing a action-chain, one step is running a playbook
some part of code is like this:
- name: 'run_playbook' ref: ansible.playbook parameters: playbook: ./os_user/main.yaml cwd: /opt/stackstorm/packs/ansible/actions/playbooks inventory_file: "../unstable/{{ inventory_name }}" extra_vars: - os_user: "{{ os_user }}" - os_passwd: "{{ os_passwd }}" - operation: "{{ operation }}" - user_sudo: "{{ user_sudo }}" - user_groups: "{{ user_groups }}" - user_uid: "{{ user_uid }}" on-success: 'delete_inventory' on-failure: 'delete_inventory'
ansible always handle vars as a string, for example {{user_groups}}, it is should be a array in
stackstorm action metadata yaml. {{user_sudo}} should be a boolean. It will be annoying when do a
conditional judgments.
For example, I have to write my playbook like this:
- role: groups when: operation == "present" and user_groups != "['EmptyGroup']" - role: sudo when: user_sudo != "False" and operation == "present"
What should I do?