23 lines
792 B
YAML
23 lines
792 B
YAML
---
|
|
- community.general.scaleway_compute:
|
|
commercial_type: DEV1-S
|
|
region: par1
|
|
name: "{{ item}}"
|
|
state: "{{ (container_action == 'delete' ) | ternary( 'absent', 'running' ) }}"
|
|
api_token: "{{ scw_api_secret_key }}"
|
|
image: 26e4c50e-91d6-41a5-8898-9e40920e819d
|
|
project: "{{ scw_api_default_project_id }}"
|
|
public_ip: dynamic
|
|
loop: "{{ container_list }}"
|
|
register: "container_info"
|
|
|
|
- name: "generate host list"
|
|
ansible.builtin.lineinfile:
|
|
create: yes
|
|
path: "hostlist.yml"
|
|
line: "- { record_name: {{ item.msg.name}}, record_type: A, record_value: {{ item.msg.public_ip.address }} }"
|
|
state: present
|
|
loop: "{{ container_info.results }}"
|
|
when: scw_gen_hostlist is true and container_action !='delete'
|
|
|