mirror of
https://github.com/trailofbits/algo.git
synced 2025-06-07 07:33:52 +02:00
DigitalOcean - Add cleanup step for SSH key (#784)
* Add cleanup step for SSH key. * Two space tabs are hard to see.
This commit is contained in:
parent
d9b1b22fac
commit
7eb4fc5f22
1 changed files with 27 additions and 0 deletions
|
@ -101,6 +101,33 @@
|
||||||
line: "{{ item.networks.v4[0].ip_address }}"
|
line: "{{ item.networks.v4[0].ip_address }}"
|
||||||
with_items:
|
with_items:
|
||||||
- "{{ do_droplets.json.droplets }}"
|
- "{{ do_droplets.json.droplets }}"
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: "Delete the new Algo SSH key"
|
||||||
|
digital_ocean:
|
||||||
|
state: absent
|
||||||
|
command: ssh
|
||||||
|
api_token: "{{ do_token }}"
|
||||||
|
name: "{{ SSH_keys.comment }}"
|
||||||
|
register: ssh_keys
|
||||||
|
until: ssh_keys.changed != true
|
||||||
|
retries: 10
|
||||||
|
delay: 1
|
||||||
|
|
||||||
|
rescue:
|
||||||
|
- name: Collect the fail error
|
||||||
|
digital_ocean:
|
||||||
|
state: absent
|
||||||
|
command: ssh
|
||||||
|
api_token: "{{ do_token }}"
|
||||||
|
name: "{{ SSH_keys.comment }}"
|
||||||
|
register: ssh_keys
|
||||||
|
ignore_errors: yes
|
||||||
|
|
||||||
|
- debug: var=ssh_keys
|
||||||
|
|
||||||
|
- fail:
|
||||||
|
msg: "Please, ensure that your API token is not read-only."
|
||||||
rescue:
|
rescue:
|
||||||
- debug: var=fail_hint
|
- debug: var=fail_hint
|
||||||
tags: always
|
tags: always
|
||||||
|
|
Loading…
Add table
Reference in a new issue