Skip to content

Instantly share code, notes, and snippets.

@numb95
Created August 30, 2018 18:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save numb95/8a13d46f5fcf6ee00e370db3d443cdad to your computer and use it in GitHub Desktop.
Save numb95/8a13d46f5fcf6ee00e370db3d443cdad to your computer and use it in GitHub Desktop.

Create a file with a name ip.txt. add you IPs which you want to block them to this file. Just one IP per line. Add this block to your task file.

- name: block IP with iptables
  iptables:
    chain: INPUT
    source: '{{ item }}'
    jump: DROP
  with_lines: 
  - "cat ~/ansible/ip.txt"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment