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
This commit is contained in:
2023-10-10 14:37:22 +02:00
commit fabd695cb9
8 changed files with 139 additions and 0 deletions

22
tasks/main.yml Normal file
View File

@@ -0,0 +1,22 @@
---
- 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'