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.76k stars 1.03k forks source link

Syntax error loading YAML #291

Closed hbbtstar closed 4 years ago

hbbtstar commented 4 years ago

hi all!

I'm trying to get this playbook up and running, but I'm getting an odd syntax error with not a lot of helpful info from ansible.

Ansible version: 2.8.1

/work/matrix-docker-ansible-deploy # cat inventory/hosts
# We explicitly ask for your server's external IP address, because the same value is used for configuring Coturn.
# If you'd rather use a local IP here, make sure to set up `matrix_coturn_turn_external_ip_address`.
#
# To connect using a non-root user (and elevate to root with sudo later),
# replace `ansible_ssh_user=root` with something like this: `ansible_ssh_user=username become=true become_user=root`
#
# For improved Ansible performance, SSH pipelining is enabled by default in `ansible.cfg`.
# If this causes SSH connection troubles, disable it by adding `ansible_ssh_pipelining=False`
# to the host line below or by adding `ansible_ssh_pipelining: False` to your variables file.
#
# If you're running this Ansible playbook on the same server as the one you're installing to,
# consider adding an additional `ansible_connection=local` argument below.

[matrix_servers]
matrix.alexanderlourenco.com ansible_host=69.164.229.221 ansible_ssh_user=root

/work/matrix-docker-ansible-deploy # cat inventory/host_vars/matrix.alexanderlourenco.com/vars.yml 
# The bare domain name which represents your Matrix identity.
# Matrix user ids for your server will be of the form (`@user:<matrix-domain>`).
#
# Note: this playbook does not touch the server referenced here.
# Installation happens on another server ("matrix.<matrix-domain>").
#
# Example value: example.com
matrix_domain: alexanderlourenco.com

# This is something which is provided to Let's Encrypt when retrieving SSL certificates for domains.
#
# In case SSL renewal fails at some point, you'll also get an email notification there.
#
# If you decide to use another method for managing SSL certifites (different than the default Let's Encrypt),
# you won't be required to define this variable (see `docs/configuring-playbook-ssl-certificates.md`).
#
# Example value: example@example.com
matrix_ssl_lets_encrypt_support_email: test@alexanderlourenco.com

# A shared secret (between Coturn and Synapse) used for authentication.
# You can put any string here, but generating a strong one is preferred (e.g. `pwgen -s 64 1`).
matrix_coturn_turn_static_auth_secret: omitted

# A secret used to protect access keys issued by the server.
# You can put any string here, but generating a strong one is preferred (e.g. `pwgen -s 64 1`).
matrix_synapse_macaroon_secret_key: omitted

/work/matrix-docker-ansible-deploy # ansible-playbook -i inventory/hosts setup.yml --tags=setup-all

PLAY [Set up a Matrix server] ***********************************************************************************************************************************************************************************************************************************************************************************************
ERROR! Syntax Error while loading YAML.

/work/matrix-docker-ansible-deploy # 

as far as I can tell, that's all valid yml, so I have no idea what I'm doing wrong here. Any insight or ways I can get more verbose logging would be greatly appreciated!

aaronraimist commented 4 years ago

Hmm yeah that does look valid. You haven't edited any other files right? git status should show nothing to commit, working tree clean

aaronraimist commented 4 years ago

Running ansible-playbook -vv -i inventory/hosts setup.yml --tags=setup-all should give you more verbose logs

hbbtstar commented 4 years ago

Thanks for the replies! The docker ansible container doesn't have git, but the directory is clean:

alourenco@alourenco-P9XXEN-EF-ED:~/matrix_playbook/matrix-docker-ansible-deploy$ git status
On branch master
Your branch is up to date with 'origin/master'.

nothing to commit, working tree clean
alourenco@alourenco-P9XXEN-EF-ED:~/matrix_playbook/matrix-docker-ansible-deploy$ 

-vv doesn't yield anything useful, unfortunately:

/work/matrix-docker-ansible-deploy # ansible-playbook -vv -i inventory/hosts setup.yml --tags=setup-all
ansible-playbook 2.8.1                                                                                      
  config file = /work/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.7/site-packages/ansible                                
  executable location = /usr/bin/ansible-playbook                                                            
  python version = 3.7.3 (default, May  3 2019, 11:24:39) [GCC 8.3.0]                                    
Using /work/matrix-docker-ansible-deploy/ansible.cfg as config file                                 
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-base/tasks/sanity_check.yml            
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-base/tasks/clean_up_old_files.yml          
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-base/tasks/setup_server_base.yml      
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-base/tasks/setup_matrix_base.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-base/tasks/setup_well_known.yml   
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-base/tasks/self_check_dns.yml    
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-mailer/tasks/init.yml                 
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-mailer/tasks/setup_mailer.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-postgres/tasks/init.yml        
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-postgres/tasks/validate_config.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-postgres/tasks/setup_postgres.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-postgres/tasks/import_postgres.yml 
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-postgres/tasks/import_sqlite_db.yml   
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-postgres/tasks/upgrade_postgres.yml      
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-postgres/tasks/setup_postgres.yml    
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-postgres/tasks/migrate_postgres_data_directory.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-postgres/tasks/run_synapse_janitor.yml         
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-postgres/tasks/run_vacuum.yml          
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-postgres/tasks/util/detect_existing_postgres_version.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-corporal/tasks/init.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-corporal/tasks/validate_config.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-corporal/tasks/setup_corporal.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-corporal/tasks/self_check_corporal.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-appservice-discord/tasks/init.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-appservice-discord/tasks/validate_config.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-appservice-discord/tasks/setup_install.yml                                                                                                                                                                                                       
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-appservice-discord/tasks/setup_uninstall.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-appservice-slack/tasks/init.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-appservice-slack/tasks/validate_config.yml                                                                                                                                                                                                       
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-appservice-slack/tasks/setup_install.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-appservice-slack/tasks/setup_uninstall.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-mautrix-facebook/tasks/init.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-mautrix-facebook/tasks/validate_config.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-mautrix-facebook/tasks/setup_install.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-mautrix-facebook/tasks/setup_uninstall.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-mautrix-hangouts/tasks/init.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-mautrix-hangouts/tasks/validate_config.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-mautrix-hangouts/tasks/setup_install.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-mautrix-hangouts/tasks/setup_uninstall.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-mautrix-telegram/tasks/init.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-mautrix-telegram/tasks/validate_config.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-mautrix-telegram/tasks/setup_install.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-mautrix-telegram/tasks/setup_uninstall.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-mautrix-whatsapp/tasks/init.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-mautrix-whatsapp/tasks/validate_config.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_install.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-bridge-mautrix-whatsapp/tasks/setup_uninstall.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/init.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/validate_config.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/setup_synapse.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/ext/setup.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/ext/rest-auth/setup.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/ext/rest-auth/setup_install.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/ext/rest-auth/setup_uninstall.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/ext/shared-secret-auth/setup.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/ext/shared-secret-auth/setup_install.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/ext/shared-secret-auth/setup_uninstall.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/ext/ldap-auth/setup.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/ext/synapse-simple-antispam/setup.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/ext/synapse-simple-antispam/setup_install.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/ext/synapse-simple-antispam/setup_uninstall.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/synapse/setup.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/synapse/setup_install.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/synapse/setup_uninstall.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/goofys/setup.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/goofys/setup_install.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/goofys/setup_uninstall.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/import_media_store.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/register_user.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/self_check_client_api.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/self_check_federation_api.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-synapse/tasks/update_user_password.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-riot-web/tasks/init.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-riot-web/tasks/validate_config.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-riot-web/tasks/setup_riot_web.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-riot-web/tasks/self_check_riot_web.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-mxisd/tasks/init.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-mxisd/tasks/validate_config.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-mxisd/tasks/setup_mxisd.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-mxisd/tasks/self_check_mxisd.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-dimension/tasks/init.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-dimension/tasks/validate_config.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-dimension/tasks/setup_dimension.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-email2matrix/tasks/init.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-email2matrix/tasks/validate_config.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-email2matrix/tasks/setup_email2matrix.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-nginx-proxy/tasks/init.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-nginx-proxy/tasks/validate_config.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-nginx-proxy/tasks/ssl/main.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_lets_encrypt.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_self_signed.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-nginx-proxy/tasks/ssl/setup_ssl_manually_managed.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-nginx-proxy/tasks/setup_nginx_proxy.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-nginx-proxy/tasks/self_check_well_known.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-coturn/tasks/init.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-coturn/tasks/validate_config.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-coturn/tasks/setup_coturn.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-common-after/tasks/start.yml
statically imported: /work/matrix-docker-ansible-deploy/roles/matrix-common-after/tasks/stop.yml

PLAYBOOK: setup.yml *********************************************************************************************************************************************************************************************************************************************************************************************************
1 plays in setup.yml

PLAY [Set up a Matrix server] ***********************************************************************************************************************************************************************************************************************************************************************************************
ERROR! Syntax Error while loading YAML.

/work/matrix-docker-ansible-deploy #
aaronraimist commented 4 years ago

Wait hang on, why is one command being run from ~/matrix_playbook/matrix-docker-ansible-deploy and one from /work/matrix-docker-ansible-deploy? There should only be one copy of the playbook.

hbbtstar commented 4 years ago

there is, /work is the root inside the docker container but the container doesn't have git installed: to do the git status I had to do it from outside the container. /work maps onto ~/matrix_playbook/matrix-docker-ansible-deploy.

aaronraimist commented 4 years ago

Why is there a Docker container there? You don't need to be doing anything with Docker on the local machine where the playbook is.

hbbtstar commented 4 years ago

I didn't have ansible installed locally, so I was using the instructions provided here:

https://github.com/spantaleev/matrix-docker-ansible-deploy/blob/master/docs/ansible.md#using-ansible-via-docker

I may have misunderstood, I thought if you didn't already had ansible installed locally that was the preferred thing to do. I can give it a go with a locally installed Ansible instead and see how I fare!

aaronraimist commented 4 years ago

Oh. Presumably that works but I don’t know anything about it. It looks more complicated than a local install of Ansible.

hbbtstar commented 4 years ago

so I finally figured this out (or not, but this is the only diff so far): none of the above worked, but I deleted the directory, copied the example file over again, and this time it worked.

The diff appears to be that matrix_coturn_turn_static_auth_secret and matrix_synapse_macaroon_secret_key need quotes but matrix_domain and matrix_ssl_lets_encrypt_support_email can't have them: I'm not sure why this would matter, but this is the only config that I got to run successfully.

anyway, I'm closing this one out since we got it and it's running swimmingly now: thanks for being patient with me and helping me out here!

spantaleev commented 4 years ago

Quotes may be necessary depending on the actual value.. If your matrix_coturn_turn_static_auth_secret and matrix_synapse_macaroon_secret_key values contain some special characters, you may need to use quotes.

Glad you figure it out and got it all working smoothly now!