You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
48 lines
1.3 KiB
YAML
48 lines
1.3 KiB
YAML
---
|
|
- hosts: '{{ host | default("all") }}'
|
|
serial: "{{ serial_number | default(5) }}"
|
|
vars:
|
|
ansible_ssh_host: "{{ stage_server_domain }}"
|
|
become: yes
|
|
gather_facts: no
|
|
|
|
vars_prompt:
|
|
- name: "check_deleting"
|
|
prompt: "Are you sure to delete the following servers: {{ play_hosts }}? yes / no(default) "
|
|
private: no
|
|
default: 'no'
|
|
- name: "check_deleting_2nd"
|
|
prompt: "Are you COMPLETELY sure to delete them: {{ play_hosts }}? yes / no(default) "
|
|
private: no
|
|
default: 'no'
|
|
|
|
pre_tasks:
|
|
- name: "Import constraints check"
|
|
import_tasks: tasks/constraints_check.yml
|
|
tags:
|
|
- always
|
|
|
|
- name: "Import autodiscover pre-tasks"
|
|
import_tasks: tasks/autodiscover_pre_tasks.yml
|
|
become: false
|
|
tags:
|
|
- always
|
|
|
|
tasks:
|
|
- block:
|
|
- name: "Delete server <{{ inventory_hostname }}>"
|
|
include_role:
|
|
name: hetzner-ansible-hcloud
|
|
tasks_from: _set_server_state
|
|
vars:
|
|
- server_state: "absent"
|
|
- name: "Delete DNS entry <{{ inventory_hostname }}> for <{{ domain }}>"
|
|
include_role:
|
|
name: hetzner-ansible-dns
|
|
tasks_from: _remove_dns
|
|
vars:
|
|
record_to_remove: '{{ inventory_hostname }}'
|
|
when:
|
|
- check_deleting == 'yes'
|
|
- check_deleting_2nd == 'yes'
|