aboutsummaryrefslogtreecommitdiffstats
path: root/ansible/project/delete_jail.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'ansible/project/delete_jail.yaml')
-rw-r--r--ansible/project/delete_jail.yaml21
1 files changed, 21 insertions, 0 deletions
diff --git a/ansible/project/delete_jail.yaml b/ansible/project/delete_jail.yaml
new file mode 100644
index 0000000..1a976c5
--- /dev/null
+++ b/ansible/project/delete_jail.yaml
@@ -0,0 +1,21 @@
+- hosts: bsd_servers
+ tasks:
+ - name: delete jail
+ become: true
+ when: inventory_hostname == jail_host
+ block:
+ - name: stop jail
+ shell: service jail stop {{ jail_name }}
+
+ - name: delete jail config file
+ ansible.builtin.file:
+ path: "/etc/jail.conf.d/{{ jail_name }}.conf"
+ state: absent
+
+ - name: Remove all chflags from jail files
+ shell: chflags -R 0 {{ containers_path }}/{{ jail_name }}
+
+ - name: Remove jail directory
+ ansible.builtin.file:
+ path: "{{ containers_path }}/{{ jail_name }}"
+ state: absent