diff options
Diffstat (limited to 'ansible_collections/community/digitalocean/plugins/inventory')
-rw-r--r-- | ansible_collections/community/digitalocean/plugins/inventory/digitalocean.py | 16 |
1 files changed, 2 insertions, 14 deletions
diff --git a/ansible_collections/community/digitalocean/plugins/inventory/digitalocean.py b/ansible_collections/community/digitalocean/plugins/inventory/digitalocean.py index 6aafb5f45..b886fc114 100644 --- a/ansible_collections/community/digitalocean/plugins/inventory/digitalocean.py +++ b/ansible_collections/community/digitalocean/plugins/inventory/digitalocean.py @@ -30,15 +30,6 @@ options: this should always be C(community.digitalocean.digitalocean). required: true choices: ['community.digitalocean.digitalocean'] - api_token: - description: - - DigitalOcean OAuth token. - - Template expressions can be used in this field. - required: true - type: str - aliases: [ oauth_token ] - env: - - name: DO_API_TOKEN attributes: description: >- Droplet attributes to add as host vars to each inventory host. @@ -78,7 +69,7 @@ options: EXAMPLES = r""" # Using keyed groups and compose for hostvars plugin: community.digitalocean.digitalocean -api_token: '{{ lookup("pipe", "./get-do-token.sh" }}' +oauth_token: '{{ lookup("pipe", "./get-do-token.sh" }}' attributes: - id - name @@ -108,7 +99,6 @@ filters: - 'do_region.slug == "fra1"' """ -import re import json from ansible.errors import AnsibleError, AnsibleParserError from ansible.inventory.group import to_safe_group_name @@ -119,7 +109,6 @@ from ansible.plugins.inventory import BaseInventoryPlugin, Constructable, Cachea class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): - NAME = "community.digitalocean.digitalocean" # Constructable methods use the following function to construct group names. By @@ -160,7 +149,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): def _get_payload(self): # request parameters - api_token = self._template_option("api_token") + api_token = self._template_option("oauth_token") headers = { "Content-Type": "application/json", "Authorization": "Bearer {0}".format(api_token), @@ -195,7 +184,6 @@ class InventoryModule(BaseInventoryPlugin, Constructable, Cacheable): strict = self.get_option("strict") host_filters = self.get_option("filters") for record in records: - host_name = record.get("name") if not host_name: continue |