fix container name numbering
add var container_number_start
This commit is contained in:
@@ -17,6 +17,7 @@ scw_api_default_project_id:
|
|||||||
scw_type: DEV1-S
|
scw_type: DEV1-S
|
||||||
container_action; delete or running
|
container_action; delete or running
|
||||||
container_number: number of container to create
|
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_prefix: name of prefix to container #
|
||||||
container_domain: default formation.opendoor.fr
|
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)
|
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)
|
||||||
|
|||||||
@@ -4,3 +4,4 @@ scw_gen_hostlist: true
|
|||||||
scw_type: DEV1-S
|
scw_type: DEV1-S
|
||||||
container_domain: formation.opendoor.fr
|
container_domain: formation.opendoor.fr
|
||||||
container_image: 26e4c50e-91d6-41a5-8898-9e40920e819d
|
container_image: 26e4c50e-91d6-41a5-8898-9e40920e819d
|
||||||
|
container_number_start: 1
|
||||||
|
|||||||
@@ -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 )}}"
|
commercial_type: "{{ item.host_type|default( scw_type )}}"
|
||||||
region: par1
|
region: par1
|
||||||
name: "{{ container_prefix+'%02x' | format(item) }}"
|
name: "{{ container_prefix+'%d' | format(item) }}.{{container_domain }}"
|
||||||
state: "{{ (container_action == 'delete' ) | ternary( 'absent', 'running' ) }}"
|
state: "{{ (container_action == 'delete' ) | ternary( 'absent', 'running' ) }}"
|
||||||
api_token: "{{ scw_api_secret_key }}"
|
api_token: "{{ scw_api_secret_key }}"
|
||||||
image: "{{ container_image}}"
|
image: "{{ container_image}}"
|
||||||
project: "{{ scw_api_default_project_id }}"
|
project: "{{ scw_api_default_project_id }}"
|
||||||
public_ip: dynamic
|
public_ip: dynamic
|
||||||
wait: true
|
wait: true
|
||||||
loop: "{{ range(0, container_number , 1)|list }}"
|
loop: "{{ range( container_number_start, container_number +1, 1)|list }}"
|
||||||
register: "container_info"
|
register: "container_info"
|
||||||
|
|
||||||
- name: "generate host list"
|
- name: "generate host list"
|
||||||
|
|||||||
Reference in New Issue
Block a user