mirror of
https://github.com/ansible-collections/community.general.git
synced 2025-07-08 22:30:04 -07:00
[Scaleway] Add module to manage containers (#5496)
Signed-off-by: Lunik <lunik@tiwabbit.fr> Signed-off-by: Lunik <lunik@tiwabbit.fr>
This commit is contained in:
parent
bc7e7f8fcb
commit
4fed0e13db
9 changed files with 960 additions and 0 deletions
|
@ -0,0 +1,6 @@
|
|||
# Copyright (c) 2022, Guillaume MARTINEZ <lunik@tiwabbit.fr>
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
cloud/scaleway
|
||||
unsupported
|
|
@ -0,0 +1,16 @@
|
|||
---
|
||||
# Copyright (c) 2022, Guillaume MARTINEZ <lunik@tiwabbit.fr>
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
scaleway_region: fr-par
|
||||
container_namespace_name: cn-ansible-test
|
||||
name: cn-ansible-test
|
||||
description: Container used for testing scaleway_container_info ansible module
|
||||
updated_description: Container used for testing scaleway_container_info ansible module (Updated description)
|
||||
environment_variables:
|
||||
MY_VAR: my_value
|
||||
secret_environment_variables:
|
||||
MY_SECRET_VAR: my_secret_value
|
||||
image: rg.fr-par.scw.cloud/namespace-ansible-ci/nginx:latest
|
||||
port: 80
|
|
@ -0,0 +1,63 @@
|
|||
---
|
||||
####################################################################
|
||||
# WARNING: These are designed specifically for Ansible tests #
|
||||
# and should not be used as examples of how to write Ansible roles #
|
||||
####################################################################
|
||||
|
||||
# Copyright (c) 2022, Guillaume MARTINEZ <lunik@tiwabbit.fr>
|
||||
# GNU General Public License v3.0+ (see LICENSES/GPL-3.0-or-later.txt or https://www.gnu.org/licenses/gpl-3.0.txt)
|
||||
# SPDX-License-Identifier: GPL-3.0-or-later
|
||||
|
||||
- name: Create container_namespace
|
||||
community.general.scaleway_container_namespace:
|
||||
state: present
|
||||
name: '{{ container_namespace_name }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
project_id: '{{ scw_project }}'
|
||||
description: '{{ description }}'
|
||||
register: integration_container_namespace
|
||||
|
||||
- name: Create container
|
||||
community.general.scaleway_container:
|
||||
state: present
|
||||
name: '{{ name }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
namespace_id: '{{ integration_container_namespace.container_namespace.id }}'
|
||||
registry_image: '{{ image }}'
|
||||
description: '{{ description }}'
|
||||
environment_variables: '{{ environment_variables }}'
|
||||
secret_environment_variables: '{{ secret_environment_variables }}'
|
||||
port: '{{ port }}'
|
||||
|
||||
- name: Get container info
|
||||
community.general.scaleway_container_info:
|
||||
name: '{{ name }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
namespace_id: '{{ integration_container_namespace.container_namespace.id }}'
|
||||
register: cn_info_task
|
||||
|
||||
- ansible.builtin.debug:
|
||||
var: cn_info_task
|
||||
|
||||
- name: Check module call result
|
||||
ansible.builtin.assert:
|
||||
that:
|
||||
- cn_info_task is success
|
||||
- cn_info_task is not changed
|
||||
|
||||
- name: Delete container
|
||||
community.general.scaleway_container:
|
||||
state: absent
|
||||
name: '{{ name }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
description: '{{ description }}'
|
||||
namespace_id: '{{ integration_container_namespace.container_namespace.id }}'
|
||||
registry_image: '{{ image }}'
|
||||
|
||||
- name: Delete container namespace
|
||||
community.general.scaleway_container_namespace:
|
||||
state: absent
|
||||
name: '{{ container_namespace_name }}'
|
||||
region: '{{ scaleway_region }}'
|
||||
description: '{{ description }}'
|
||||
project_id: '{{ scw_project }}'
|
Loading…
Add table
Add a link
Reference in a new issue