fix container name numbering

add var container_number_start
This commit is contained in:
2023-10-14 12:39:33 +00:00
parent 43abe12bbd
commit 206b9f7659
3 changed files with 7 additions and 3 deletions

View File

@@ -17,6 +17,7 @@ scw_api_default_project_id:
scw_type: DEV1-S
container_action; delete or running
container_number: number of container to create
container_number_start: default 1 ( if container_number == container_number_start you'll create one container )
container_prefix: name of prefix to container #
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)

View File

@@ -4,3 +4,4 @@ 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,15 +1,17 @@
---
- community.general.scaleway_compute:
- name: "{{ container_prefix }} : {{ container_action }}"
community.general.scaleway_compute:
commercial_type: "{{ item.host_type|default( scw_type )}}"
region: par1
name: "{{ container_prefix+'%02x' | format(item) }}"
name: "{{ container_prefix+'%d' | format(item) }}.{{container_domain }}"
state: "{{ (container_action == 'delete' ) | ternary( 'absent', 'running' ) }}"
api_token: "{{ scw_api_secret_key }}"
image: "{{ container_image}}"
project: "{{ scw_api_default_project_id }}"
public_ip: dynamic
wait: true
loop: "{{ range(0, container_number , 1)|list }}"
loop: "{{ range( container_number_start, container_number +1, 1)|list }}"
register: "container_info"
- name: "generate host list"