Add support for Scaleway object storage (#46353)

This commit is contained in:
Rémy Léone 2018-11-09 17:16:53 +01:00 committed by John R Barker
parent b047591dee
commit f4fa3314c4
14 changed files with 535 additions and 0 deletions

View file

@ -242,3 +242,52 @@ As you can see, we get different groups of hosts.
In case a filter parameter is not defined, the plugin supposes all values possible are wanted.
This means that for each tag that exists on your Scaleway compute nodes, a group based on each tag will be created.
Scaleway S3 object storage
==========================
`Object Storage <https://www.scaleway.com/object-storage>`_ allows you to store any kind of objects (documents, images, videos, etc.).
As the Scaleway API is S3 compatible, Ansible supports it natively through the modules: :ref:`s3_bucket_module`, :ref:`aws_s3_module`.
You can find many examples in ``./test/legacy/roles/scaleway_s3``
.. code-block:: yaml
- hosts: myserver
vars:
scaleway_region: nl-ams
s3_url: https://s3.nl-ams.scw.cloud
environment:
# AWS_ACCESS_KEY matches your scaleway organization id available at https://cloud.scaleway.com/#/account
AWS_ACCESS_KEY: 00000000-1111-2222-3333-444444444444
# AWS_SECRET_KEY matches a secret token that you can retrieve at https://cloud.scaleway.com/#/credentials
AWS_SECRET_KEY: aaaaaaaa-bbbb-cccc-dddd-eeeeeeeeeeee
module_defaults:
group/aws:
s3_url: '{{ s3_url }}'
region: '{{ scaleway_region }}'
tasks:
# use a fact instead of a variable, otherwise template is evaluate each time variable is used
- set_fact:
bucket_name: "{{ 99999999 | random | to_uuid }}"
# "requester_pays:" is mandatory because Scaleway doesn't implement related API
# another way is to use aws_s3 and "mode: create" !
- s3_bucket:
name: '{{ bucket_name }}'
requester_pays:
- name: Another way to create the bucket
aws_s3:
bucket: '{{ bucket_name }}'
mode: create
encrypt: false
register: bucket_creation_check
- name: add something in the bucket
aws_s3:
mode: put
bucket: '{{ bucket_name }}'
src: /tmp/test.txt # needs to be created before
object: test.txt
encrypt: false # server side encryption must be disabled