add ability to nuke radius DBs

This commit is contained in:
Yohaï-Eliel BERREBY 2020-08-06 09:57:54 +02:00
parent e762091435
commit 30e503458e
2 changed files with 31 additions and 2 deletions

7
nuke-radius-dbs.yml Executable file
View file

@ -0,0 +1,7 @@
#!/usr/bin/env ansible-playbook
---
- hosts: ~radius-(edc|fleming|pacaterie|gs).*
roles:
- radius
vars:
nuke_radius: true

View file

@ -15,7 +15,7 @@
git:
repo: "https://gitlab.federez.net/re2o/re2o.git"
dest: "/var/www/re2o"
version: "master_freeradius_python3"
version: "dev"
force: true
- name: Template local re2o settings
@ -118,6 +118,29 @@
password: "{{ radius_pg_replication_password }}"
become_user: postgres
- name: Nuking - Stop freeradius
systemd:
name: freeradius
state: stopped
when: nuke_radius|bool
- name: Nuking - Remove old subscription if it exists
community.general.postgresql_subscription:
name: "re2o_subscription_{{ inventory_hostname_short | replace('-','_') }}"
db: re2o
state: absent
become_user: postgres
when: nuke_radius|bool
ignore_errors: yes
- name: Nuking - Destroy old local DB if it exists
community.general.postgresql_db:
name: re2o
state: absent
become_user: postgres
when: nuke_radius|bool
- name: Create local DB
community.general.postgresql_db:
name: re2o
@ -128,7 +151,6 @@
lc_ctype: 'fr_FR.UTF-8'
become_user: postgres
- name: Dump radius re2o PostgreSQL database schema from master
community.general.postgresql_db:
name: re2o