Files
ansible_scw_container/tasks/main.yml
Thomas Constans fabd695cb9 initial version: gimme a list of container name, i will create them in
"formation" project and generate a list you ca feed tco.dns with, to
create appropriate dns record
2023-10-10 14:39:59 +02:00

23 lines
791 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'