DEV Community

Roy
Roy

Posted on

using python method in ansible Jinja2 context

frpc_install: "{{ role_name.endswith('frpc') }}"

frpc_install is a bool, so you can use it in a when conditional statement like this

- name: Output frpc version
  debug:
    msg: '{{ frpc.stdout|trim if frpc.stdout is defined else "Not Installed" }}'
  when:
  - frpc_install

Top comments (0)