From 4177da95601c56538c71891f13429d6d31fc7b04 Mon Sep 17 00:00:00 2001 From: "patchback[bot]" <45432694+patchback[bot]@users.noreply.github.com> Date: Fri, 11 Jun 2021 19:29:07 +0200 Subject: [PATCH] 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 (cherry picked from commit 4b37b1bca630d240a9d0a1b7b5344100b1041a6f) Co-authored-by: Abhijeet Kasurde --- plugins/inventory/scaleway.py | 32 +++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 11 deletions(-) diff --git a/plugins/inventory/scaleway.py b/plugins/inventory/scaleway.py index ad0a2321ae..843a006738 100644 --- a/plugins/inventory/scaleway.py +++ b/plugins/inventory/scaleway.py @@ -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) from __future__ import (absolute_import, division, print_function) __metaclass__ = type -DOCUMENTATION = ''' +DOCUMENTATION = r''' name: scaleway author: - Remy Leone (@sieben) short_description: Scaleway inventory source description: - - Get inventory hosts from Scaleway + - Get inventory hosts from Scaleway. options: 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 choices: ['scaleway', 'community.general.scaleway'] regions: - description: Filter results on a specific Scaleway region + description: Filter results on a specific Scaleway region. type: list default: - ams1 @@ -26,11 +26,13 @@ DOCUMENTATION = ''' - par2 - waw1 tags: - description: Filter results on a specific tag + description: Filter results on a specific tag. type: list oauth_token: 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: # in order of precedence - name: SCW_TOKEN @@ -48,14 +50,14 @@ DOCUMENTATION = ''' - hostname - id 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 L(Scaleway API, https://developer.scaleway.com/#servers-server-get) can be used.' type: dict ''' -EXAMPLES = ''' +EXAMPLES = r''' # scaleway_inventory.yml file in YAML format # Example command line: ansible-inventory --list -i scaleway_inventory.yml @@ -81,6 +83,15 @@ regions: - par1 variables: 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 @@ -230,8 +241,7 @@ class InventoryModule(BaseInventoryPlugin, Constructable): if not matching_tags: return set() - else: - return matching_tags.union((server_zone,)) + return matching_tags.union((server_zone,)) def _filter_host(self, host_infos, hostname_preferences):