Implement better IP address/network notation.
This commit is contained in:
parent
3670bf6597
commit
2ff1354fe3
8 changed files with 9 additions and 10 deletions
|
@ -16,7 +16,7 @@
|
||||||
if_lan: "{{ ansible_interfaces | difference([if_wan, 'lo']) | first }}"
|
if_lan: "{{ ansible_interfaces | difference([if_wan, 'lo']) | first }}"
|
||||||
|
|
||||||
## LAN IP address range:
|
## LAN IP address range:
|
||||||
ipaddr_lan: 192.168.0.10
|
ipaddr_lan: 192.168.0.10/24
|
||||||
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) }}"
|
dhcp_list: "{{ lookup('sequence', 'start=50 end=150 format=192.168.0.%d', wantlist=True) }}"
|
||||||
|
|
||||||
|
|
|
@ -15,7 +15,7 @@
|
||||||
if_lan: "{{ ansible_interfaces | difference([if_wan, 'lo']) | first }}"
|
if_lan: "{{ ansible_interfaces | difference([if_wan, 'lo']) | first }}"
|
||||||
|
|
||||||
## LAN IP address range:
|
## LAN IP address range:
|
||||||
ipaddr_lan: 192.168.0.10
|
ipaddr_lan: 192.168.0.10/24
|
||||||
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) }}"
|
dhcp_list: "{{ lookup('sequence', 'start=50 end=150 format=192.168.0.%d', wantlist=True) }}"
|
||||||
|
|
||||||
|
|
|
@ -176,7 +176,7 @@
|
||||||
- name: "make 'kerberos' an alias hostname resolvable from the LAN"
|
- name: "make 'kerberos' an alias hostname resolvable from the LAN"
|
||||||
replace:
|
replace:
|
||||||
path: /etc/hosts
|
path: /etc/hosts
|
||||||
regexp: "^({{ ipaddr_lan }}\\s.+)$"
|
regexp: "^({{ ipaddr_lan | ipaddr('address') }}\\s.+)$"
|
||||||
replace: '\1 kerberos'
|
replace: '\1 kerberos'
|
||||||
when: not krb5kdc.stat.exists
|
when: not krb5kdc.stat.exists
|
||||||
|
|
||||||
|
|
|
@ -65,7 +65,7 @@
|
||||||
- name: "make 'ldap' an alias hostname resolvable from the LAN"
|
- name: "make 'ldap' an alias hostname resolvable from the LAN"
|
||||||
replace:
|
replace:
|
||||||
path: /etc/hosts
|
path: /etc/hosts
|
||||||
regexp: "^({{ ipaddr_lan }}\\s.+)$"
|
regexp: "^({{ ipaddr_lan | ipaddr('address') }}\\s.+)$"
|
||||||
replace: '\1 ldap'
|
replace: '\1 ldap'
|
||||||
when: not slapd.stat.exists
|
when: not slapd.stat.exists
|
||||||
|
|
||||||
|
|
|
@ -25,14 +25,14 @@
|
||||||
dest: /etc/exports
|
dest: /etc/exports
|
||||||
insertbefore: EOF
|
insertbefore: EOF
|
||||||
block: |
|
block: |
|
||||||
{{ export_root }} *(sec=krb5p,rw,fsid=0,crossmnt,no_subtree_check)
|
{{ export_root }} {{ ipaddr_lan | ipaddr('subnet') }}(sec=krb5p,rw,fsid=0,crossmnt,no_subtree_check)
|
||||||
{{ export_root }}/home/ *(sec=krb5p,rw,no_subtree_check)
|
{{ export_root }}/home/ {{ ipaddr_lan | ipaddr('subnet') }}(sec=krb5p,rw,no_subtree_check)
|
||||||
notify: "restart nfs-kernel-server"
|
notify: "restart nfs-kernel-server"
|
||||||
|
|
||||||
- name: "make 'nfs' an alias hostname resolvable from the LAN"
|
- name: "make 'nfs' an alias hostname resolvable from the LAN"
|
||||||
replace:
|
replace:
|
||||||
path: /etc/hosts
|
path: /etc/hosts
|
||||||
regexp: "^({{ ipaddr_lan }}\\s.+)$"
|
regexp: "^({{ ipaddr_lan | ipaddr('address') }}\\s.+)$"
|
||||||
replace: '\1 nfs'
|
replace: '\1 nfs'
|
||||||
when: not exports.stat.exists
|
when: not exports.stat.exists
|
||||||
|
|
||||||
|
|
|
@ -30,4 +30,4 @@
|
||||||
replace:
|
replace:
|
||||||
path: /etc/hosts
|
path: /etc/hosts
|
||||||
regexp: '^(127\.0\.1\.1.*)$'
|
regexp: '^(127\.0\.1\.1.*)$'
|
||||||
replace: '#\1\n{{ ipaddr_lan }} {{ ansible_hostname }}.{{ ansible_domain }} {{ ansible_hostname }}'
|
replace: '#\1\n{{ ipaddr_lan | ipaddr("address") }} {{ ansible_hostname }}.{{ ansible_domain }} {{ ansible_hostname }}'
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
auto {{ if_lan }}
|
auto {{ if_lan }}
|
||||||
allow-hotplug {{ if_lan }}
|
allow-hotplug {{ if_lan }}
|
||||||
iface {{ if_lan }} inet static
|
iface {{ if_lan }} inet static
|
||||||
address {{ ipaddr_lan }}/24
|
address {{ ipaddr_lan }}
|
||||||
|
|
|
@ -2,4 +2,3 @@ auto {{ if_lan }}
|
||||||
allow-hotplug {{ if_lan }}
|
allow-hotplug {{ if_lan }}
|
||||||
iface {{ if_lan }} inet static
|
iface {{ if_lan }} inet static
|
||||||
address {{ ipaddr_lan }}
|
address {{ ipaddr_lan }}
|
||||||
netmask 255.255.255.0
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue