aboutsummaryrefslogtreecommitdiffstats
path: root/ansible/project/delete_jail.yaml
blob: 1a976c5d740d837ba6cfd41cf57921f85e1b6a09 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
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