community.general.scaleway inventory – Scaleway inventory source

Note

This inventory plugin is part of the community.general collection (version 7.5.2).

You might already have this collection installed if you are using the ansible package. It is not included in ansible-core. To check whether it is installed, run ansible-galaxy collection list.

To install it, use: ansible-galaxy collection install community.general. You need further requirements to be able to use this inventory plugin, see Requirements for details.

To use it in a playbook, specify: community.general.scaleway.

Synopsis

  • Get inventory hosts from Scaleway.

Requirements

The below requirements are needed on the local controller node that executes this inventory.

  • PyYAML

Parameters

Parameter

Comments

hostnames

list / elements=string

List of preference about what to use as an hostname.

Choices:

  • "public_ipv4" ← (default)

  • "private_ipv4"

  • "public_ipv6"

  • "hostname"

  • "id"

Default: ["public_ipv4"]

oauth_token

string

Scaleway OAuth token.

If not explicitly defined or in environment variables, it will try to lookup in the scaleway-cli configuration file ($SCW_CONFIG_PATH, $XDG_CONFIG_HOME/scw/config.yaml, or ~/.config/scw/config.yaml).

More details on how to generate token.

Configuration:

plugin

string / required

Token that ensures this is a source file for the ‘scaleway’ plugin.

Choices:

  • "scaleway"

  • "community.general.scaleway"

regions

list / elements=string

Filter results on a specific Scaleway region.

Default: ["ams1", "par1", "par2", "waw1"]

scw_profile

string

added in community.general 4.4.0

The config profile to use in config file.

By default uses the one specified as active_profile in the config file, or falls back to default if that is not defined.

tags

list / elements=string

Filter results on a specific tag.

variables

dictionary

Set individual variables: keys are variable names and values are templates. Any value returned by the Scaleway API can be used.

Examples

# scaleway_inventory.yml file in YAML format
# Example command line: ansible-inventory --list -i scaleway_inventory.yml

# use hostname as inventory_hostname
# use the private IP address to connect to the host
plugin: community.general.scaleway
regions:
  - ams1
  - par1
tags:
  - foobar
hostnames:
  - hostname
variables:
  ansible_host: private_ip
  state: state

# use hostname as inventory_hostname and public IP address to connect to the host
plugin: community.general.scaleway
hostnames:
  - hostname
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'"

Authors

  • Remy Leone (@remyleone)

Hint

Configuration entries for each entry type have a low to high priority order. For example, a variable that is lower in the list will override a variable that is higher up.