spantaleev / matrix-docker-ansible-deploy

🐳 Matrix (An open network for secure, decentralized communication) server setup using Ansible and Docker
GNU Affero General Public License v3.0
4.93k stars 1.05k forks source link

Enabling traefik dashboard leads to ansible error #2781

Open thomsbe opened 1 year ago

thomsbe commented 1 year ago

Describe the bug I try to enable the traefik dashboard. After inserting the vars and running ansible, it leads to a ansible error:

TASK [galaxy/com.devture.ansible.role.traefik : Ensure provider.yml installed] ***********************
fatal: [matrix.tbaer.de]: FAILED! => 
  msg: |-
    An unhandled exception occurred while templating '{{ devture_traefik_provider_configuration_yaml | from_yaml | combine(devture_traefik_provider_configuration_extension, recursive=True) }}'. Error was a <class 'yaml.scanner.ScannerError'>, original message: while scanning for the next token
    found character '\t' that cannot start any token
      in "<unicode string>", line 14, column 1:
                    tls: false
        ^

PLAY RECAP **********************************
matrix.tbaer.de            : ok=19   changed=3    unreachable=0    failed=1    skipped=16   rescued=0    ignored=0   

error: Recipe `run` failed on line 38 with exit code 2
error: Recipe `install-service` failed on line 31 with exit code 2

Without the dashboard config it runs fine.

To Reproduce My vars.yml file looks like this:

devture_traefik_config_entrypoint_web_secure_enabled: false
devture_traefik_container_web_host_bind_port: '127.0.0.1:18080'

devture_traefik_additional_entrypoints_auto:
  - name: matrix-federation
    port: 18448
    host_bind_port: "127.0.0.1:18448"
    config: {}

devture_traefik_dashboard_enabled: true
devture_traefik_dashboard_hostname: "{{ matrix_server_fqn_matrix }}"
devture_traefik_dashboard_basicauth_enabled: true
devture_traefik_dashboard_basicauth_user: username
devture_traefik_dashboard_basicauth_password: 'somepassword'

Expected behavior Dashboards are enabled. At least, ansible runs without this error.

Matrix Server:

Ansible: Ansible runs on the host.

ansible 2.10.8
  config file = /opt/matrix-docker-ansible-deploy/ansible.cfg
  configured module search path = ['/root/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python3/dist-packages/ansible
  executable location = /usr/bin/ansible

Additional context I'm running with traefik, fronted by Caddy2, because I have other services on the host, but I'm trying to migrate all those services to the traefik running in the playbook. On My way, I try to enable the dashboards to see what's going on.

jasonlaguidice commented 1 year ago

Adding to this as I'm having the same problem. I've narrowed it down to one line in the configs:

devture_traefik_config_entrypoint_web_secure_enabled causes an error when running the ansible playbook.

Edit: Adding some additional information. The playbook errors in galaxy/com.devture.ansible.role.traefik : Ensure provider.yml installed with the following error:

  msg: |-
    An unhandled exception occurred while templating '{{ devture_traefik_provider_configuration_yaml | from_yaml | combine(devture_traefik_provider_configuration_extension, recursive=True) }}'. Error was a <class 'yaml.scanner.ScannerError'>, original message: while scanning for the next token
    found character that cannot start any token
      in "<unicode string>", line 14, column 1

Turns out there is an error in devture.ansible.role.traefik which is addressed by this pull request:

https://github.com/devture/com.devture.ansible.role.traefik/pull/9