papanito / ansible-role-cloudflared

This ansible role does download and install cloudflared on the host and optionally installs the argo-tunnel as a service.
Apache License 2.0
51 stars 13 forks source link

cf_ssh_client_config_group does not seem to be respected #65

Closed timatlee closed 1 year ago

timatlee commented 1 year ago

When following https://github.com/papanito/ansible-role-cloudflared#ssh-client-config, it says to define cf_ssh_client_config_group to be the group that your servers are in. This doesn't seem to work - the playbook seems to statically reference the servers group.

Error I'm getting:

TASK [papanito.cloudflared : Add ssh proxy for all servers in the ssh client config] ***************************************************************************************
fatal: [cftunnel]: FAILED! => {"msg": "'dict object' has no attribute 'servers'. 'dict object' has no attribute 'servers'"}

If I name my group the expected servers, the playbook executes.

In `main.yml', around line 101, I see:

- name: Add ssh proxy for all servers in the ssh client config
  include_tasks:
    file: ssh_client_config.yml
    apply:
      tags: cf_client_config
  loop: "{{ groups['servers'] }}"
  when: cf_ssh_client_config
  tags:
  - cf_client_config

By changing loop: "{{ groups['servers'] }}" to loop: "{{ groups[cf_ssh_client_config_group] }}", the playbook works as expected - but I'm not sure what knockoff issues that may have.

papanito commented 1 year ago

I think the suggested change is fine, the variable should be only used there.