1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

scaleway: Misc doc changes (#2776) (#2785)

* Updated example section for ``variables``
* Added link about token generation
* Misc changes in doc

Fixes: #467

Signed-off-by: Abhijeet Kasurde <akasurde@redhat.com>
(cherry picked from commit 4b37b1bca6)

Co-authored-by: Abhijeet Kasurde <akasurde@redhat.com>
This commit is contained in:
patchback[bot] 2021-06-11 19:29:07 +02:00 committed by GitHub
parent d451fc6292
commit 4177da9560
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1,24 +1,24 @@
# Copyright (c) 2017 Ansible Project # Copyright: (c) 2017 Ansible Project
# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt) # GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = ''' DOCUMENTATION = r'''
name: scaleway name: scaleway
author: author:
- Remy Leone (@sieben) - Remy Leone (@sieben)
short_description: Scaleway inventory source short_description: Scaleway inventory source
description: description:
- Get inventory hosts from Scaleway - Get inventory hosts from Scaleway.
options: options:
plugin: plugin:
description: token that ensures this is a source file for the 'scaleway' plugin. description: Token that ensures this is a source file for the 'scaleway' plugin.
required: True required: True
choices: ['scaleway', 'community.general.scaleway'] choices: ['scaleway', 'community.general.scaleway']
regions: regions:
description: Filter results on a specific Scaleway region description: Filter results on a specific Scaleway region.
type: list type: list
default: default:
- ams1 - ams1
@ -26,11 +26,13 @@ DOCUMENTATION = '''
- par2 - par2
- waw1 - waw1
tags: tags:
description: Filter results on a specific tag description: Filter results on a specific tag.
type: list type: list
oauth_token: oauth_token:
required: True required: True
description: Scaleway OAuth token. description:
- Scaleway OAuth token.
- More details on L(how to generate token, https://www.scaleway.com/en/docs/generate-api-keys/).
env: env:
# in order of precedence # in order of precedence
- name: SCW_TOKEN - name: SCW_TOKEN
@ -48,14 +50,14 @@ DOCUMENTATION = '''
- hostname - hostname
- id - id
variables: variables:
description: 'set individual variables: keys are variable names and description: 'Set individual variables: keys are variable names and
values are templates. Any value returned by the values are templates. Any value returned by the
L(Scaleway API, https://developer.scaleway.com/#servers-server-get) L(Scaleway API, https://developer.scaleway.com/#servers-server-get)
can be used.' can be used.'
type: dict type: dict
''' '''
EXAMPLES = ''' EXAMPLES = r'''
# scaleway_inventory.yml file in YAML format # scaleway_inventory.yml file in YAML format
# Example command line: ansible-inventory --list -i scaleway_inventory.yml # Example command line: ansible-inventory --list -i scaleway_inventory.yml
@ -81,6 +83,15 @@ regions:
- par1 - par1
variables: variables:
ansible_host: public_ip.address ansible_host: public_ip.address
# Using static strings as variables
plugin: community.general.scaleway
hostnames:
- hostname
variables:
ansible_host: public_ip.address
ansible_connection: "'ssh'"
ansible_user: "'admin'"
''' '''
import json import json
@ -230,8 +241,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable):
if not matching_tags: if not matching_tags:
return set() return set()
else: return matching_tags.union((server_zone,))
return matching_tags.union((server_zone,))
def _filter_host(self, host_infos, hostname_preferences): def _filter_host(self, host_infos, hostname_preferences):