scicore-unibas-ch / ansible-modules-guacamole

Ansible modules to interact with the apache guacamole API
20 stars 23 forks source link

Param rdp_drive_enable not working #29

Closed shilky69 closed 2 years ago

shilky69 commented 2 years ago

Hello,

I have a problem with the rdp_drive_enable parameter which is not taken into account by passing it to true

Thanks for your feedback,

Cordially,

pescobar commented 2 years ago

I haven't used this option before so I cannot give much feedback but I guess using only the option rdp_drive_enable would not work and you would also need to define correct values for rdp_drive_name and rdp_drive_path

Can you share your complete playbook with all the arguments you pass to the module? Have you double checked that the rdp_drive_path is correct and accessible?

shilky69 commented 2 years ago

Thank you for the quick return!

I have configured the other variables: RDP_DRIVE_NAME and RDP_DRIVE_PATH which work well but since the other parameter is not activated it is not possible to use this functionality.

I tried the following values: True, True, "True" ... Yet the Boolean works well with the parameter: Rdp_ignore_Server_certs

Here is my playbook:

shilky69 commented 2 years ago

For information in my example the RDP_Drive_Enable is in lower case rdp_drive_enable

pescobar commented 2 years ago

have you double checked if the same arguments work if you apply them using the webui?

I mean these three:

rdp_drive_enable: True
rdp_drive_name: "TMPDATAS"
rdp_drive_path: "/tmp/test"
shilky69 commented 2 years ago

By manually checking the boxes?

Yes it works by doing it from WEBUI manually

shilky69 commented 2 years ago

Do you think it can be related to the version of Guacamole or the role? did you reproduce the same error?

pescobar commented 2 years ago

I couldn't find time to try to reproduce the problem, I am overloaded with work.

I will try to look at it in coming days, but I cannot promise when.

shilky69 commented 2 years ago

Ok thank you I found the origin of the problem but not the resolution, indeed in the mysql database the parameter is written this way: drive-enable true whereas after reading the rest api documentation the value of the param should be enable-drive true. I tested with a base update and it works. But after having in the role: ansible-modules-guacamole/plugins/modules/guacamole_connection.py I can't figure out how you make the connection between rdp_drive_enable and drive-enable which is added in the mysql database. Could you just enlighten me please?

pescobar commented 2 years ago

thanks for debugging the problem and pointing to the root problem.

I have create a new PR which hopefully should fix it but I cannot test it.

This is the PR https://github.com/scicore-unibas-ch/ansible-modules-guacamole/pull/30

And this is the commit that I think should fix it https://github.com/scicore-unibas-ch/ansible-modules-guacamole/pull/30/commits/b1ab84cd6358e85a246310642610d50bb824d172

Can you test it?

shilky69 commented 2 years ago

Thanks a lot!

Yes no problem to test, can you just tell me what command I have to execute to install this version of the role? Usually I use this command: ansible-galaxy collection install scicore.guacamole

Thanks in advance

pescobar commented 2 years ago

the easiest would be that you manually edit file ansible_collections/scicore/guacamole/plugins/modules/guacamole_connection.py in your ansible control host and apply the changes in https://github.com/scicore-unibas-ch/ansible-modules-guacamole/commit/b1ab84cd6358e85a246310642610d50bb824d172

Basically you have to replace rdp_drive_enable with rdp_enable_drive in lines 117 and 504

you also have to update your playbook to rename the argument rdp_drive_enable to rdp_enable_drive

shilky69 commented 2 years ago

I'm sorry but I had already tried to manually modify the file but I have the impression that the changes are not taken into Ansible, do you know why?

pescobar commented 2 years ago

have you renamed rdp_drive_enable to rdp_enable_drive in your main playbook? I should be like this:

- name: CREATE A NEW RDP Connection
  Scicore.Guacamole.Guacamole_Connection:
      Base_url: https: // /Guacamole
      Auth_username: Guacadmin
      Auth_Password: ""
      Connection_name: "{{item.server}}"
      Rdp_ignore_Server_certs: True
      Protocol: RDP
      Hostname: "{{item.server}}"
      Port: 3389
      Username: Administrator
      Password: "*****"
      Group_name: "Windows"
      rdp_enable_drive: True
      Rdp_drive_name: "TMPDATAS"
      Rdp_drive_path: "/tmp/test"
  Register: _Connection_info
  When: (item.connexion == "RDP")
  with_items:
    - "{{get_all_hosts}}"

If you can execute the playbook with the new argument name it means it's executing the patched module with the new argument name.

shilky69 commented 2 years ago

I did modify the module and I did modify the playbook but the change is not taken into account... maybe a caching from Ansbible? can we force the reload of the role?

shilky69 commented 2 years ago

So it works! I did not have to modify the file, however there is another line to modify, it is this one: 417 "enable_drive", Thank you very much for your response! Have a good day

pescobar commented 2 years ago

You are right I missed that one. good spot :)

I have updated the PR and I will publish a new version of the collection including this fix tomorrow.

pescobar commented 2 years ago

I have published a new version 0.0.17 to ansible galaxy which includes this fix