Skip to content

Commit

Permalink
add check for container
Browse files Browse the repository at this point in the history
  • Loading branch information
Xenion1987 committed Nov 26, 2023
1 parent a50654e commit 8c35242
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions playbooks/setup_ufw.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,13 @@
gather_facts: true

tasks:
- name: Skip if host is a container
ansible.builtin.command:
cmd: pgrep -f /sbin/init
changed_when: false
failed_when: false
register: get_pid_init
- name: Include role 'ufw'
ansible.builtin.include_role:
name: ufw
when: get_pid_init.stdout == "1"

0 comments on commit 8c35242

Please sign in to comment.