Closed conclavia closed 6 years ago
Thanks for the report. I will look for a better workaround than including the entire role twice. Might be as simple as using a separate task to set the name and description if provided.
I've released a workaround for this issue in #20. Feel free to re-open this issue if this does not solve the problem for now
When applying the role to a fresh machine the hostname and description aren't being populated in ZeroTier.
The machine is a VirtualBox VM running Raspbian (2017-06-22-rpd-x86-jessie) which is based on Debian 8.10. I've tested using the current ansible-galaxy version of the role as well as the latest version from master.
I can see that the necessary fields are included correctly in the JSON data being POSTed to the API:
When I view the member in the ZeroTier web console I can see that it has been automatically authorized and connected to the network as expected, however the name and description are left blank.
I've been able to reproduce the issue by calling the ZeroTier API manually. If I POST a new member to the API before it has ever actually connected to the ZeroTier network, the name and description don't get set. If I send exactly the same request to the API after the machine first appears in the ZeroTier web console then the name and description are populated correctly.
This makes me think it is a timing issue: Ansible is running the task to authorize the new member after telling the machine to join the network but before it has actually managed to do so. For whatever reason ZeroTier doesn't retain the name and description when this happens.
Interestingly, if I repeat the POST a second time the name and description get populated even if the machine hasn't yet connected to the network. I seem to have been able to work around the issue successfully by including the role twice to exploit this behaviour:
If I'm right this is probably more of a bug in the ZeroTier API than an issue with the Ansible role, but I wanted to raise it here in case there is a better workaround and/or I'm missing something obvious.
Thanks!