expand template instructions in 'token' property (#49)

fixes #48
This commit is contained in:
Tobias Fischer 2021-04-07 08:17:03 +02:00 committed by GitHub
parent ded9d9ddf8
commit a393f4e862
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -112,7 +112,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
def _configure_hcloud_client(self): def _configure_hcloud_client(self):
self.token_env = self.get_option("token_env") self.token_env = self.get_option("token_env")
self.api_token = self.get_option("token") or os.getenv(self.token_env) self.api_token = self.templar.template(self.get_option("token"), fail_on_undefined=False) or os.getenv(self.token_env)
if self.api_token is None: if self.api_token is None:
raise AnsibleError( raise AnsibleError(
"Please specify a token, via the option token, via environment variable HCLOUD_TOKEN " "Please specify a token, via the option token, via environment variable HCLOUD_TOKEN "