2018-05-31 18:20:51 +03:00
|
|
|
---
|
2019-11-25 18:26:21 +01:00
|
|
|
## This playbook deploys the installbox. Add 'hostname=XXX' and
|
|
|
|
## 'domain=YYY' to the installer boot parameters to set hostname and
|
|
|
|
## domain.
|
2018-05-31 18:20:51 +03:00
|
|
|
|
|
|
|
- name: apply configuration to the installbox
|
2018-06-04 18:00:25 +03:00
|
|
|
hosts: all
|
2018-05-31 18:20:51 +03:00
|
|
|
remote_user: ansible
|
|
|
|
become: yes
|
2019-11-25 18:26:21 +01:00
|
|
|
|
2018-05-31 18:20:51 +03:00
|
|
|
vars:
|
2019-10-25 21:28:32 +02:00
|
|
|
## This interface provides the default route:
|
2018-05-31 18:20:51 +03:00
|
|
|
if_wan: "{{ ansible_default_ipv4.interface }}"
|
2019-11-25 18:26:21 +01:00
|
|
|
|
2019-10-25 21:28:32 +02:00
|
|
|
## Use the first remaining interface for the LAN:
|
2019-10-26 09:15:16 +02:00
|
|
|
if_lan: "{{ ansible_interfaces | difference([if_wan, 'lo']) | first }}"
|
2019-11-25 18:26:21 +01:00
|
|
|
|
|
|
|
## LAN IP address range:
|
2019-11-28 16:34:37 +01:00
|
|
|
ipaddr_lan: 192.168.0.10/24
|
2019-11-29 14:38:07 +01:00
|
|
|
dhcp_range: 192.168.0.50,192.168.0.99,2h
|
2019-11-25 18:26:21 +01:00
|
|
|
|
|
|
|
di_dist: "{{ ansible_distribution_release }}"
|
|
|
|
di_version: "{{ ansible_distribution_major_version }}"
|
2019-05-24 22:17:33 +03:00
|
|
|
di_pkg: "debian-installer-{{ di_version }}-netboot-amd64"
|
2019-11-25 18:26:21 +01:00
|
|
|
|
2019-05-24 17:26:15 +03:00
|
|
|
ansible_user: ansible
|
2019-11-25 18:26:21 +01:00
|
|
|
repo_dir: "/home/{{ ansible_user }}/debian-lan"
|
|
|
|
ansible_python_interpreter: "/usr/bin/python3" ## needed for firewalld module
|
|
|
|
|
2018-06-04 18:00:25 +03:00
|
|
|
|
|
|
|
pre_tasks:
|
2019-10-24 20:27:35 +02:00
|
|
|
- name: validate if interfaces are available
|
2018-06-04 18:00:25 +03:00
|
|
|
fail:
|
2019-10-24 20:27:35 +02:00
|
|
|
msg: "Interfaces {{ ansible_interfaces }} found. WAN: '{{ if_wan }}', LAN: '{{ if_lan }}'. Two NICs needed."
|
2019-10-26 09:15:16 +02:00
|
|
|
when: (if_lan not in ansible_interfaces) or (if_wan not in ansible_interfaces) or (if_lan == if_wan)
|
2018-05-31 18:20:51 +03:00
|
|
|
|
2019-11-25 18:26:21 +01:00
|
|
|
|
2018-05-31 18:20:51 +03:00
|
|
|
roles:
|
|
|
|
- up2date-debian
|
2019-10-24 20:27:35 +02:00
|
|
|
- two-interface-firewalld
|
2018-05-31 18:20:51 +03:00
|
|
|
- dhcp-dns-dnsmasq
|
|
|
|
- tftp-netboot-installer
|
2019-10-24 20:27:35 +02:00
|
|
|
- apt-cacher
|
2019-11-25 18:26:21 +01:00
|
|
|
- prepare4clients
|