Returns unique K3S bearer token
When using the K3S service, one might expect to get a list of bearer tokens instead of a unique one...
Code line
https://gitlab.inria.fr/discovery/enoslib/-/blob/main/enoslib/service/k3s/k3s.py#L119
Use case
k3s = en.K3s(master=roles['master'], agent=list()) # Here roles['master'] contains multiple hosts
k3s.depoy() # Returns a single bearer token
Possible fix?
What I went with to "fix" the issue on my side (would be nice to have it as the default behaviour)
with actions(roles=roles['master'], gather_facts=False) as p:
p.shell(
f"export KUBECONFIG={KUBECONFIG_LOCATION_K3S} && kubectl -n kubernetes-dashboard describe secret admin-user-token | grep '^token'", # noqa
task_name="token",
)
env["k3s-token"] = [res.stdout for res in p.results.filter(task="token")]
Pretty much the same code already present in the service, but returning a list