diff --git a/README.md b/README.md index 2b4b820..85d8743 100644 --- a/README.md +++ b/README.md @@ -11,6 +11,7 @@ Es wird ein Nutzer *demo* angelegt. Das Passwort ist *fai*. Dieser Nutzer kann A Server: * Debian Buster +* Zwei Netzwerkports oder zwei Netzwerkkarten (1x für WAN, 1x für LAN und FAI) Zu installierende Clients: @@ -24,7 +25,8 @@ Zu installierende Clients: Zunächst ansible für die automatische Installation und Konfiguration aller Komponeten herunterladen: ```console -apt install ansible +apt install python3-pip +pip3 install ansible ``` Danach ein Playbook (z.B. *fai.yml*) anlegen und die grundlegende Parameter festlegen: @@ -45,6 +47,26 @@ Danach das Playbook ausführen: ansible-playbook fai.yml ``` +### Virtuale Testinstanz + +Für eine testweise Installation kann Vagrant (https://www.vagrantup.com/) verwendet werden. Es richtet anhand der *Vagrantfile* eine virtuelle Maschine ein und provisioniert sie mittels Ansible. Vagrant unterstützt verschiedene Provider für Virtualisierungslösungen bspw. VirtualBox oder libvirt/KVM. + +Zur Installation muss zunächst Vagrant installiert werden. Hier beispielsweise zusammen mit VirtualBox + +``` +apt install vagrant virtualbox +``` + +Danach kann die virtuelle Umgebung erstellt und auotmatisch eingerichtet werden: + +``` +vagrant up +``` + +Die Vagrantfile definiert eine Maschinen mit zwei Ethernet-Ports. Der erste Port ist für Verwaltung von Vagrant und der zweite Port (IP: 192.168.33.1) um die notwendige FAI Services über ein virtuelles Netzwerk anzubieten. Mit diesen Netzwerk können dann weitere virtuelle Maschine verbunden werden, um sie mit FAI automatisch zu installieren. + +*Hinweis:* Die Verwendung von VirtualBox wird empfohlen. Bei libvirt/KVM gab es Probleme mit dem Starten von Clients für Testinstallationen im virtuellen Netzwerk. Hier kann es helfen das Netzwerk über *Virt-Manager* neuzustarten oder ein weiteres isoliertes Netzwerk zu erstellen und es mit dem zweiten Netzwerkport des FAI-Servers zu verbinden. + ### Konfiguration Über Ansible-Variablen kann die Installation noch weiter angepasst werden. diff --git a/Vagrantfile b/Vagrantfile index 7de8e6b..1cf3432 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -1,13 +1,6 @@ # -*- mode: ruby -*- # vi: set ft=ruby : -# start vagrant with: -# -# USE_ANSIBLE_IN_VM=true vagrant up -# -# to provision the VM with ansible in the VM -$use_ansible_in_vm = ENV['USE_ANSIBLE_IN_VM'] || false - def create(config, name) config.vm.define name do |v| v.vm.hostname = name @@ -21,10 +14,30 @@ def create(config, name) vb.customize ["modifyvm", :id, "--nicpromisc2", "allow-all"] end - # add a extra NIC for the DHCP services - v.vm.network "private_network", virtualbox__intnet: true, auto_config: false + v.vm.provider "libvirt" do |lv| + lv.cpus = 2 + lv.memory = 1024 + end + + # add a extra NIC for the DHCP services + v.vm.network "private_network", + auto_config: false, + ip: '192.168.33.1', + netmask: '255.255.255.0', + virtualbox__intnet: true, + libvirt__dhcp_enabled: false, + libvirt__forward_mode: 'none', + libvirt__guest_ipv6: false, + mode: 'isolated', + type: 'ethernet' + + if ENV['USE_ANSIBLE_IN_VM'] || false + # start vagrant with: + # + # USE_ANSIBLE_IN_VM=true vagrant up + # + # to provision the VM with ansible in the VM - if $use_ansible_in_vm # copy the project to vagrant user v.vm.synced_folder ".", "/home/vagrant/fai", type: "rsync" @@ -40,7 +53,7 @@ def create(config, name) v.vm.provision "shell", inline: $provision else - # ran provision with ansible and use VM as target host + # provision with ansible and use VM as target host v.vm.provision "ansible" do |ans| ans.playbook = "playbook-vagrant.yml" end