Explorar el Código

ranges for loops are working now too thanks to brainist

master
erin sims hace 2 años
padre
commit
f86d64c405
Se han modificado 2 ficheros con 18 adiciones y 14 borrados
  1. +4
    -4
      playbooks/create_droplet.yml
  2. +14
    -10
      playbooks/delete_droplet.yml

+ 4
- 4
playbooks/create_droplet.yml Ver fichero

@@ -5,7 +5,7 @@
vars:
mpdf:
- 'nyc3-mpdf'
number: 5
count: 5
mpdb:
- 'nyc3-mpdb'
tasks:
@@ -24,7 +24,7 @@
- 'ansible'
- 'mpdf'
register: created_droplets
with_sequence: count="{{ number }}"
loop: "{{ range(1,count+1)|list }}"

- name: create backend droplets
digital_ocean_droplet:
@@ -32,7 +32,7 @@
region: nyc3
image: debian-11-x64
wait_timeout: 100
name: "mpdf{{item }}"
name: "mpdf{{ item }}"
size_id: s-1vcpu-1gb
state: present
oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
@@ -41,5 +41,5 @@
- 'ansible'
- 'mpdb'
register: created_droplets
with_sequence: count="{{ number }}"
loop: "{{ range(1,count+1)|list }}"

+ 14
- 10
playbooks/delete_droplet.yml Ver fichero

@@ -5,9 +5,7 @@
vars:
mpdf:
- 'nyc3-mpdf'
number:
- '1'
- '2'
count: 5
mpdb:
- 'nyc3-mpdb'
tasks:
@@ -17,25 +15,31 @@
region: nyc3
image: debian-11-x64
wait_timeout: 100
name: "{{ item.0 }}{{item.1 }}"
name: "mpdb{{ item }}"
size_id: s-1vcpu-1gb
state: absent
oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
ssh_keys: [ '94:5e:bc:d4:fe:5a:b0:74:7f:06:fc:4e:3d:f7:3e:ea' ] # <---- put your numeric ssh key in here
tags:
- 'ansible'
- 'mpdf'
register: deleted_droplets
loop: "{{ mpdf | product(number) }}"
- name: delete backend droplets
loop: "{{ range(1,count+1)|list }}"
- name: delete backend droplets
digital_ocean_droplet:
unique_name: yes
region: nyc3
image: debian-11-x64
wait_timeout: 100
name: "{{ item.0 }}{{item.1 }}"
name: "mpdf{{ item }}"
size_id: s-1vcpu-1gb
state: absent
oauth_token: "{{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }}"
ssh_keys: [ '94:5e:bc:d4:fe:5a:b0:74:7f:06:fc:4e:3d:f7:3e:ea' ] # <---- put your numeric ssh key in here
tags:
- 'ansible'
- 'mpdb'
register: deleted_droplets
loop: "{{ mpdb | product(number) }}"
loop: "{{ range(1,count+1)|list }}"

Cargando…
Cancelar
Guardar