Compare commits
1 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 8f9eaacde9 |
41
Readme.md
41
Readme.md
@@ -1,13 +1,36 @@
|
|||||||
# ansible API
|
# ansible API
|
||||||
|
|
||||||
|
## Objectif
|
||||||
|
|
||||||
```yaml
|
Utiliser ansible pour créer un container sur le cloud scaleway
|
||||||
---
|
|
||||||
- hosts: localhost
|
## Documentation
|
||||||
vars:
|
|
||||||
scw_api_secret_key: CHANGEME
|
https://docs.ansible.com/ansible/2.9/modules/scaleway_compute_module.html#scaleway-compute-module
|
||||||
scw_api_default_project_id: 8cf65c8f-64c0-47d3-9f50-fbe249b76aae
|
|
||||||
container_name: evivbulgroz
|
## Informations utiles
|
||||||
roles:
|
|
||||||
- sib.scw_container
|
* 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 }
|
||||||
```
|
```
|
||||||
@@ -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
|
|
||||||
@@ -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).
|
|
||||||
@@ -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
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
# handlers file for tco.scw_container
|
|
||||||
@@ -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.
|
|
||||||
@@ -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
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
localhost
|
|
||||||
|
|
||||||
@@ -1,9 +0,0 @@
|
|||||||
---
|
|
||||||
- hosts: localhost
|
|
||||||
vars:
|
|
||||||
container_action: running
|
|
||||||
container_number: 4
|
|
||||||
container_prefix: plop
|
|
||||||
container_image: lezknfe2324
|
|
||||||
roles:
|
|
||||||
- tco.scw_container
|
|
||||||
@@ -1,2 +0,0 @@
|
|||||||
---
|
|
||||||
# vars file for tco.scw_container
|
|
||||||
Reference in New Issue
Block a user