|
- ---
- - hosts: localhost
- connection: local
- gather_facts: true
- vars:
- mpdf:
- - 'nyc3-mpdf'
- count: 3
- mpdb:
- - 'nyc3-mpdb'
- tasks:
- - name: delete frontend droplets
- digital_ocean_droplet:
- unique_name: yes
- region: nyc3
- image: debian-11-x64
- wait_timeout: 100
- 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: "{{ range(1,count|int + 1) }}"
-
- - name: delete backend droplets
- digital_ocean_droplet:
- unique_name: yes
- region: nyc3
- image: debian-11-x64
- wait_timeout: 100
- 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: "{{ range(1,count|int + 1) }}"
- - name: update inventory
- ansible.builtin.command: "do-ansible-inventory --access-token {{ lookup('ansible.builtin.env', 'DO_API_TOKEN') }} > /etc/ansible/hosts"
|