Open tpraxl opened 1 year ago
However, if it would have been created, the loginpassword would not have been stored in credentials/uberspace/argh/loginpassword, thus effectively orphaning the new account, leaving the creator with no option to delete and recreate or to retry the setup.
Hmmm, actually I had tried to cater for that case, I hope and thought it works?
When the uberspace_newloginpassword
is accessed for the first time in https://github.com/friesenkiwi/ansible-collection-uberspace/blob/master/roles/uberspace_account/tasks/register.yml#L24, it should generate, and write to the file, so if the request or playbook run fails for whatever reason, the user can find the password to login into the account in that file.
Did that not work?
No. I actually succeeded only once in creating the account (and that was a misconfiguration on my side that accidently worked). I'm running into timeouts while waiting for the creation to complete again and again, and the loginpassword is never stored.
Huh, OK, that's weird and definitely not how it should be: We agree, files should be created and populated as much as possible and such important information like the registration password never lost so an account can't get orphaned. Sorry it didn't work in your tests. :-( Let's try to find the reason and fix it. I'm on Ansible 2.9.6, which version are you using? Maybe that's the reason?
Sorry it didn't work in your tests. :-(
No problem.
Maybe the folders need to be there. The readme was misleading at first (see #2), so maybe that was the reason. I definitely need to test this again with the correct folder hierarchy. Anyways, the folders should be created as well.
I'm on Ansible 2.9.6, which version are you using?
Also 2.9.6.
$ ansible --version
ansible 2.9.6
config file = /etc/ansible/ansible.cfg
configured module search path = ['/home/thomas/.ansible/plugins/modules', '/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python3/dist-packages/ansible
executable location = /usr/bin/ansible
python version = 3.8.10 (default, Nov 14 2022, 12:59:47) [GCC 9.4.0]
OK, so no I tested it again myself multiple times also using https://github.com/tpraxl/friesenkiwi-test-playbook and it generally worked. The folder/file structure was automatically created. I added some minor improvements which should make it a bit more stable and transparent. Can you check again on your side?
I plan to look into it this weekend.
Just tested it again with https://github.com/tpraxl/friesenkiwi-test-playbook :
ansible-galaxy collection install -f -r requirements.yml
ansible-playbook -i account-inventory hello-world-goodbye.yml
Still running into the retry / timeout issue:
ansible-playbook -i account-inventory hello-world-goodbye.yml ✔ 10068 17:30:23
PLAY [Setup, query and delete again an Uberspace] ************************************************************************************************************************************
TASK [uberspace_account : Check loginname availability] ******************************************************************************************************************************
ok: [argh.uber.space -> localhost]
TASK [uberspace_account : Do registration] *******************************************************************************************************************************************
included: /home/thomas/.ansible/collections/ansible_collections/friesenkiwi/uberspace/roles/uberspace_account/tasks/register.yml for argh.uber.space
TASK [uberspace_account : Get register form for CSRF token] **************************************************************************************************************************
ok: [argh.uber.space -> localhost]
TASK [uberspace_account : Store session as cookie] ***********************************************************************************************************************************
ok: [argh.uber.space]
TASK [uberspace_account : Register] **************************************************************************************************************************************************
ok: [argh.uber.space -> localhost]
TASK [uberspace_account : Output registerresult] *************************************************************************************************************************************
ok: [argh.uber.space] => {
"msg": {
"changed": false,
"connection": "close",
"content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n <html xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <title>Moved</title>\n </head>\n <body>\n <p>This item has moved <a href=\"../register\">here</a>.</p>\n</body>\n</html>\n",
"content_length": "295",
"content_security_policy": "default-src 'self' 'unsafe-inline' https://analytics.uberspace.de; frame-ancestors 'none'",
"content_type": "text/html; charset=utf-8",
"date": "Fri, 24 Mar 2023 16:30:43 GMT",
"elapsed": 0,
"failed": false,
"location": "https://dashboard.uberspace.de/register/../register",
"msg": "HTTP Error 302: Found",
"redirected": false,
"referrer_policy": "same-origin",
"server": "nginx/1.20.1",
"set_cookie": "uberspace_session=3af90f0d98af929ff4934ff7d8e97902b2974d94; path=/; expires=Fri, 24-Mar-2023 17:30:43 GMT; secure; HttpOnly",
"status": 302,
"strict_transport_security": "max-age=31536000",
"url": "https://dashboard.uberspace.de/register/create",
"x_content_type_options": "nosniff",
"x_frame_options": "DENY",
"x_xss_protection": "1; mode=block"
}
}
TASK [uberspace_account : Store session cookie as fact] ******************************************************************************************************************************
ok: [argh.uber.space]
TASK [uberspace_account : Output session cookie] *************************************************************************************************************************************
ok: [argh.uber.space] => {
"msg": "uberspace_session=3af90f0d98af929ff4934ff7d8e97902b2974d94"
}
TASK [uberspace_account : Store session to a local file] *****************************************************************************************************************************
changed: [argh.uber.space -> localhost]
TASK [uberspace_account : Wait for space creation to finish] *************************************************************************************************************************
FAILED - RETRYING: Wait for space creation to finish (60 retries left).
FAILED - RETRYING: Wait for space creation to finish (59 retries left).
FAILED - RETRYING: Wait for space creation to finish (58 retries left).
FAILED - RETRYING: Wait for space creation to finish (57 retries left).
FAILED - RETRYING: Wait for space creation to finish (56 retries left).
FAILED - RETRYING: Wait for space creation to finish (55 retries left).
FAILED - RETRYING: Wait for space creation to finish (54 retries left).
FAILED - RETRYING: Wait for space creation to finish (53 retries left).
FAILED - RETRYING: Wait for space creation to finish (52 retries left).
FAILED - RETRYING: Wait for space creation to finish (51 retries left).
FAILED - RETRYING: Wait for space creation to finish (50 retries left).
FAILED - RETRYING: Wait for space creation to finish (49 retries left).
FAILED - RETRYING: Wait for space creation to finish (48 retries left).
FAILED - RETRYING: Wait for space creation to finish (47 retries left).
FAILED - RETRYING: Wait for space creation to finish (46 retries left).
FAILED - RETRYING: Wait for space creation to finish (45 retries left).
FAILED - RETRYING: Wait for space creation to finish (44 retries left).
FAILED - RETRYING: Wait for space creation to finish (43 retries left).
FAILED - RETRYING: Wait for space creation to finish (42 retries left).
FAILED - RETRYING: Wait for space creation to finish (41 retries left).
FAILED - RETRYING: Wait for space creation to finish (40 retries left).
FAILED - RETRYING: Wait for space creation to finish (39 retries left).
FAILED - RETRYING: Wait for space creation to finish (38 retries left).
FAILED - RETRYING: Wait for space creation to finish (37 retries left).
FAILED - RETRYING: Wait for space creation to finish (36 retries left).
FAILED - RETRYING: Wait for space creation to finish (35 retries left).
FAILED - RETRYING: Wait for space creation to finish (34 retries left).
FAILED - RETRYING: Wait for space creation to finish (33 retries left).
FAILED - RETRYING: Wait for space creation to finish (32 retries left).
FAILED - RETRYING: Wait for space creation to finish (31 retries left).
FAILED - RETRYING: Wait for space creation to finish (30 retries left).
FAILED - RETRYING: Wait for space creation to finish (29 retries left).
FAILED - RETRYING: Wait for space creation to finish (28 retries left).
FAILED - RETRYING: Wait for space creation to finish (27 retries left).
FAILED - RETRYING: Wait for space creation to finish (26 retries left).
FAILED - RETRYING: Wait for space creation to finish (25 retries left).
FAILED - RETRYING: Wait for space creation to finish (24 retries left).
FAILED - RETRYING: Wait for space creation to finish (23 retries left).
FAILED - RETRYING: Wait for space creation to finish (22 retries left).
FAILED - RETRYING: Wait for space creation to finish (21 retries left).
FAILED - RETRYING: Wait for space creation to finish (20 retries left).
FAILED - RETRYING: Wait for space creation to finish (19 retries left).
FAILED - RETRYING: Wait for space creation to finish (18 retries left).
FAILED - RETRYING: Wait for space creation to finish (17 retries left).
FAILED - RETRYING: Wait for space creation to finish (16 retries left).
FAILED - RETRYING: Wait for space creation to finish (15 retries left).
FAILED - RETRYING: Wait for space creation to finish (14 retries left).
FAILED - RETRYING: Wait for space creation to finish (13 retries left).
FAILED - RETRYING: Wait for space creation to finish (12 retries left).
FAILED - RETRYING: Wait for space creation to finish (11 retries left).
FAILED - RETRYING: Wait for space creation to finish (10 retries left).
FAILED - RETRYING: Wait for space creation to finish (9 retries left).
FAILED - RETRYING: Wait for space creation to finish (8 retries left).
FAILED - RETRYING: Wait for space creation to finish (7 retries left).
FAILED - RETRYING: Wait for space creation to finish (6 retries left).
FAILED - RETRYING: Wait for space creation to finish (5 retries left).
FAILED - RETRYING: Wait for space creation to finish (4 retries left).
FAILED - RETRYING: Wait for space creation to finish (3 retries left).
FAILED - RETRYING: Wait for space creation to finish (2 retries left).
FAILED - RETRYING: Wait for space creation to finish (1 retries left).
fatal: [argh.uber.space -> localhost]: FAILED! => {"attempts": 60, "changed": false, "connection": "close", "content": "<!DOCTYPE html PUBLIC \"-//W3C//DTD XHTML 1.0 Strict//EN\" \"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd\">\n <html xmlns=\"http://www.w3.org/1999/xhtml\">\n <head>\n <title>Moved</title>\n </head>\n <body>\n <p>This item has moved <a href=\"../login\">here</a>.</p>\n</body>\n</html>\n", "content_length": "292", "content_type": "text/html; charset=utf-8", "date": "Fri, 24 Mar 2023 16:36:03 GMT", "elapsed": 0, "location": "https://dashboard.uberspace.de/dashboard/../login", "msg": "Status code was 302 and not [200]: HTTP Error 302: Found", "redirected": false, "server": "nginx/1.20.1", "set_cookie": "uberspace_session=3af90f0d98af929ff4934ff7d8e97902b2974d94; path=/; expires=Fri, 24-Mar-2023 17:36:03 GMT; secure; HttpOnly", "status": 302, "url": "https://dashboard.uberspace.de/dashboard/ajax_state?AjaxRequestUniqueId=167967544414148"}
PLAY RECAP ***************************************************************************************************************************************************************************
argh.uber.space : ok=9 changed=1 unreachable=0 failed=1 skipped=0 rescued=0 ignored=0
I had various successful creation attempts afterwards. Exceeding the retry count seems to happen sporadically.
However, "successful" attempts do fail later with this tail:
TASK [uberspace_account : Get authentication page for CSRF token] ********************************************************************************************************************
ok: [argh.uber.space -> localhost]
TASK [uberspace_account : Generate key if necessary] *********************************************************************************************************************************
skipping: [argh.uber.space]
TASK [uberspace_account : Deploy key] ************************************************************************************************************************************************
ok: [argh.uber.space -> localhost]
TASK [uberspace_account : Get datasheet page] ****************************************************************************************************************************************
ok: [argh.uber.space -> localhost]
TASK [uberspace_account : Set uberspace facts from dashboard] ************************************************************************************************************************
ok: [argh.uber.space]
TASK [uberspace_account : Show uberspace_hostname] ***********************************************************************************************************************************
ok: [argh.uber.space] => {
"msg": "Your uberspace name is: acamar.uberspace.de."
}
TASK [uberspace_account : Get accounting page] ***************************************************************************************************************************************
ok: [argh.uber.space -> localhost]
TASK [uberspace_account : Set uberspace facts from accounting] ***********************************************************************************************************************
ok: [argh.uber.space]
TASK [uberspace_account : Put host keys into local known_hosts] **********************************************************************************************************************
skipping: [argh.uber.space] => (item=ed25519)
skipping: [argh.uber.space] => (item=rsa)
TASK [uberspace_account : Gather facts] **********************************************************************************************************************************************
fatal: [argh.uber.space]: UNREACHABLE! => {"changed": false, "msg": "Failed to connect to the host via ssh: argh@argh.uber.space: Permission denied (publickey,password,keyboard-interactive).", "unreachable": true}
PLAY RECAP ***************************************************************************************************************************************************************************
argh.uber.space : ok=23 changed=1 unreachable=1 failed=0 skipped=3 rescued=0 ignored=0
I set up an example playbook using your collection.
https://github.com/tpraxl/friesenkiwi-test-playbook
I intentionally included otherwise sensitive files in the VCS, in order to simplify reproducing issues.
Running this example was not successful:
At first, I thought, this must be a timeout issue. Creation might just have taken longer than we waited.
Actually, https://argh.uber.space seems not to have been created.
However, if it would have been created, the
loginpassword
would not have been stored incredentials/uberspace/argh/loginpassword
, thus effectively orphaning the new account, leaving the creator with no option to delete and recreate or to retry the setup.I would suggest to look into that matter together if you like.