---
- name: upgrade the faucet using the node manager
  hosts: all
  tasks:
    - name: upgrade
      ansible.builtin.command:
        # The `omit` filter removes arguments without values
        argv: "{{ command_args | reject('equalto', omit) | list }}"
      vars:
        command_args:
          - safenode-manager
          - faucet
          - upgrade
          - "{{ '--force' if force_faucet is defined else omit }}"
          - "{{ ('--env=' + env_variables) if env_variables is defined else omit }}"
          - "{{ ('--version=' + faucet_version) if faucet_version is defined else omit }}"
