Compare commits

1 Commits

Author SHA1 Message Date
8f9eaacde9 maj instructions 2024-06-19 17:54:38 +02:00
10 changed files with 32 additions and 160 deletions

View File

@@ -1,13 +1,36 @@
# ansible API
## Objectif
```yaml
---
- hosts: localhost
vars:
scw_api_secret_key: CHANGEME
scw_api_default_project_id: 8cf65c8f-64c0-47d3-9f50-fbe249b76aae
container_name: evivbulgroz
roles:
- sib.scw_container
Utiliser ansible pour créer un container sur le cloud scaleway
## Documentation
https://docs.ansible.com/ansible/2.9/modules/scaleway_compute_module.html#scaleway-compute-module
## Informations utiles
* access_key: SCWR6N2K4C6HYH89H5GR
* secret_key: 33c114f3-b49a-4bcc-8ef0-38eb84f10612
* default_organization_id: 6357800e-8b77-47a3-af7a-84ee93f019c2
* default_project_id: 8cf65c8f-64c0-47d3-9f50-fbe249b76aae
## Instructions:
Écrire un rôle permettant de créer un container sur le cloud scaleway, en utilisant les informations ci-dessus.
Le rôle doit permettre de spécifier le nom du container que l'on souhaite créer
Une fois créé, le container doit être lancé.
Le rôle doit ensuite générer un fichier contenant:
* le nom du container
* son adresse ip
Ex:
```text
- { record_name: mzaldjmaz00, record_value: 51.158.125.92 }
- { record_name: mzaldjmaz01, record_value: 51.158.118.75 }
```

View File

@@ -1,10 +0,0 @@
---
- hosts: localhost
vars:
access_key: SCWR6N2K4C6HYH89H5GR
secret_key: 33c114f3-b49a-4bcc-8ef0-38eb84f10612
default_organization_id: 6357800e-8b77-47a3-af7a-84ee93f019c2
default_project_id: 8cf65c8f-64c0-47d3-9f50-fbe249b76aae
container_image: 26e4c50e-91d6-41a5-8898-9e40920e819d
roles:
- sib.scw_container

View File

@@ -1,54 +0,0 @@
Role Name
=========
Create or delete container on scaleaway cloud
Requirements
------------
None
Role Variables
--------------
secret_key:
default_project_id:
scw_type: DEV1-S
container_action; delete or running
container_name:
container_domain: default formation.opendoor.fr
scw_gen_hostlist: default true, wether we create a hostlist.yml file containing containers name and ip (to be fed to dns role to create records)
container_image: id of image default alma9 26e4c50e-91d6-41a5-8898-9e40920e819d
Dependencies
------------
None
Example Playbook
----------------
```yaml
---
- hosts: localhost
vars:
container_action: running
container_name: plope
container_image: lezknfe2324
roles:
- tco.scw_container
```
will create containers plope.formation.opendoor.fr
License
-------
BSD
Author Information
------------------
An optional section for the role authors to include contact information, or a website (HTML is not allowed).

View File

@@ -1,7 +0,0 @@
---
# defaults file for tco.scw_container
scw_gen_hostlist: true
scw_type: DEV1-S
container_domain: formation.opendoor.fr
container_image: 26e4c50e-91d6-41a5-8898-9e40920e819d
container_number_start: 1

View File

@@ -1,2 +0,0 @@
---
# handlers file for tco.scw_container

View File

@@ -1,52 +0,0 @@
galaxy_info:
author: your name
description: your role description
company: your company (optional)
# If the issue tracker for your role is not on github, uncomment the
# next line and provide a value
# issue_tracker_url: http://example.com/issue/tracker
# Choose a valid license ID from https://spdx.org - some suggested licenses:
# - BSD-3-Clause (default)
# - MIT
# - GPL-2.0-or-later
# - GPL-3.0-only
# - Apache-2.0
# - CC-BY-4.0
license: license (GPL-2.0-or-later, MIT, etc)
min_ansible_version: 2.1
# If this a Container Enabled role, provide the minimum Ansible Container version.
# min_ansible_container_version:
#
# Provide a list of supported platforms, and for each platform a list of versions.
# If you don't wish to enumerate all versions for a particular platform, use 'all'.
# To view available platforms and versions (or releases), visit:
# https://galaxy.ansible.com/api/v1/platforms/
#
# platforms:
# - name: Fedora
# versions:
# - all
# - 25
# - name: SomePlatform
# versions:
# - all
# - 1.0
# - 7
# - 99.99
galaxy_tags: []
# List tags for your role here, one per line. A tag is a keyword that describes
# and categorizes the role. Users find roles by searching for tags. Be sure to
# remove the '[]' above, if you add tags to this list.
#
# NOTE: A tag is limited to a single word comprised of alphanumeric characters.
# Maximum 20 tags per role.
dependencies: []
# List your role dependencies here, one per line. Be sure to remove the '[]' above,
# if you add dependencies to this list.

View File

@@ -1,13 +0,0 @@
---
- name: "{{ container_prefix }} : Add"
community.general.scaleway_compute:
commercial_type: "{{ scw_type }}"
region: par1
name: "{{ container_name }}"
state: "running"
api_token: "{{ secret_key }}"
image: "{{ container_image}}"
project: "{{ default_project_id }}"
public_ip: dynamic
wait: true

View File

@@ -1,2 +0,0 @@
localhost

View File

@@ -1,9 +0,0 @@
---
- hosts: localhost
vars:
container_action: running
container_number: 4
container_prefix: plop
container_image: lezknfe2324
roles:
- tco.scw_container

View File

@@ -1,2 +0,0 @@
---
# vars file for tco.scw_container