Generate IP address list automatically.
This commit is contained in:
		
							parent
							
								
									7404d7ace4
								
							
						
					
					
						commit
						dd89bbb9a4
					
				
					 2 changed files with 8 additions and 0 deletions
				
			
		| 
						 | 
					@ -11,6 +11,7 @@
 | 
				
			||||||
    hostname: "{{ ansible_hostname }}"
 | 
					    hostname: "{{ ansible_hostname }}"
 | 
				
			||||||
    ipaddr_lan: 192.168.0.10
 | 
					    ipaddr_lan: 192.168.0.10
 | 
				
			||||||
    dhcp_range: 192.168.0.50,192.168.0.150,2h
 | 
					    dhcp_range: 192.168.0.50,192.168.0.150,2h
 | 
				
			||||||
 | 
					    dhcp_list: "{{ lookup('sequence', 'start=50 end=150 format=192.168.0.%d', wantlist=True) }}"
 | 
				
			||||||
    tftp_root: "/var/lib/tftpboot"
 | 
					    tftp_root: "/var/lib/tftpboot"
 | 
				
			||||||
    deb_mirror: "deb.debian.org"
 | 
					    deb_mirror: "deb.debian.org"
 | 
				
			||||||
    di_dist: "buster"
 | 
					    di_dist: "buster"
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -3,6 +3,13 @@
 | 
				
			||||||
    name: dnsmasq
 | 
					    name: dnsmasq
 | 
				
			||||||
    state: latest
 | 
					    state: latest
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					- name: add client hostnames and IP addresses to /etc/hosts
 | 
				
			||||||
 | 
					  lineinfile:
 | 
				
			||||||
 | 
					    dest: /etc/hosts
 | 
				
			||||||
 | 
					    line: "{{ item.1 }}\t{{ 'debian%03d' | format(item.0) }}"
 | 
				
			||||||
 | 
					  with_indexed_items: "{{ dhcp_list }}"
 | 
				
			||||||
 | 
					  notify: "restart dnsmasq"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
- name: configure dnsmasq
 | 
					- name: configure dnsmasq
 | 
				
			||||||
  template:
 | 
					  template:
 | 
				
			||||||
    src: dnsmasq-transparent-proxy.j2
 | 
					    src: dnsmasq-transparent-proxy.j2
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		
		Reference in a new issue