mirror of
				https://git.lapiole.org/dani/ansible-roles.git
				synced 2025-10-31 02:41:36 +01:00 
			
		
		
		
	Update to 2022-09-22 16:00
This commit is contained in:
		
							
								
								
									
										28
									
								
								roles/nomad/files/iptables_cleanup.pl
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										28
									
								
								roles/nomad/files/iptables_cleanup.pl
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,28 @@ | ||||
| #!/usr/bin/env perl | ||||
|    | ||||
| use warnings; | ||||
| use strict; | ||||
|  | ||||
| my $ipt = $ARGV[0]; | ||||
|  | ||||
| open(IPT, '<', $ipt) or die "Couldn't open $ipt\n"; | ||||
| my @rules = (); | ||||
| my $change = 0; | ||||
| while (<IPT>){ | ||||
|   chomp; | ||||
|   if ( | ||||
|       (m/(^:|.*\-[Aj]\s+)(CNI|NOMAD\-(?!ADMIN)|DOCKER).*/) or | ||||
|       (m/.*-A\s+NOMAD\-ADMIN/ and not m/\-\-comment\s+"ansible/) or | ||||
|       (m/.*\-o\s+docker0.*/) | ||||
|      ){ | ||||
|     $change = 1; | ||||
|     next; | ||||
|   } | ||||
|   push @rules, $_; | ||||
| } | ||||
| close IPT; | ||||
| if ($change){ | ||||
|   open(IPT, '>', $ipt) or die "Couldn't open $ipt\n"; | ||||
|   print IPT join("\n", @rules); | ||||
|   close IPT; | ||||
| } | ||||
		Reference in New Issue
	
	Block a user
	 Daniel Berteaud
					Daniel Berteaud