diff --git a/Vagrantfile b/Vagrantfile index 56a29cd72c8e4b1a97f8c8a089682eee3a8d79a4..1bbe216449127b8d687a743df3e520b8a9fa7d71 100644 --- a/Vagrantfile +++ b/Vagrantfile @@ -25,8 +25,10 @@ Vagrant.configure(2) do |config| end config.vm.define "kodi" do |kodi| - kodi.vm.hostname = "kodi.Ansible.vagrant" - kodi.vm.box = "remram/debian-9-amd64" + #kodi.vm.hostname = "kodi.Ansible.vagrant" + kodi.vm.box = "fujimakishouten/debian-stretch64" + kodi.vm.network "private_network", auto_config: false, ip: "172.28.128.4" + kodi.landrush.host_ip_address = "172.28.128.4" # TODO: Find the correct syntax for a single command. #kodi.vm.provider("virtualbox"), gui: true kodi.vm.provider "virtualbox" do |vb| @@ -35,9 +37,10 @@ Vagrant.configure(2) do |config| end config.vm.define "nspawn" do |nspawn| - nspawn.vm.hostname = "nspawn.Ansible.vagrant" + #nspawn.vm.hostname = "nspawn.Ansible.vagrant" nspawn.vm.box = "fujimakishouten/debian-stretch64" - #nspawn.vm.box = "remram/debian-9-amd64" + nspawn.vm.network "private_network", auto_config: false, ip: "172.28.128.5" + nspawn.landrush.host_ip_address = "172.28.128.5" end config.vm.define "gitolite" do |gitolite| diff --git a/files/kodi/enp0s8.network b/files/kodi/enp0s8.network new file mode 100644 index 0000000000000000000000000000000000000000..e541422b22dc5ec0737c497c5fad555e9b49dd43 --- /dev/null +++ b/files/kodi/enp0s8.network @@ -0,0 +1,5 @@ +[Match] +Name=enp0s8 + +[Network] +Address=172.28.128.4/24 diff --git a/files/nspawn/enp0s8.network b/files/nspawn/enp0s8.network new file mode 100644 index 0000000000000000000000000000000000000000..067e1a936b55b6762ca4508d8e11744a79896fd0 --- /dev/null +++ b/files/nspawn/enp0s8.network @@ -0,0 +1,5 @@ +[Match] +Name=enp0s8 + +[Network] +Address=172.28.128.5/24 diff --git a/networkd.yml b/networkd.yml new file mode 100644 index 0000000000000000000000000000000000000000..d4958456415922019a6441a7a59d934c4a9c55f3 --- /dev/null +++ b/networkd.yml @@ -0,0 +1,37 @@ +--- +# Bootstrap a Vagrant box with predictable network interface names. + +- hosts: + - all + tasks: + - name: Set hostname + hostname: + name: '{{ inventory_hostname }}.Ansible.vagrant' + + - name: Configure network interfaces + with_fileglob: + - 'files/{{ inventory_hostname }}/*.netdev' + - 'files/{{ inventory_hostname }}/*.network' + - 'files/{{ inventory_hostname }}/*.link' + copy: + src: '{{ item }}' + dest: '/etc/systemd/network/{{ item|basename }}' + owner: root + group: root + mode: '0644' + + - name: Disable ifupdown, enable networkd + with_items: + - name: systemd-resolved + state: started + enabled: yes + - name: systemd-networkd + state: started + enabled: yes + - name: networking + state: started + enabled: no + service: + name: '{{ item.name }}' + state: '{{ item.state }}' + enabled: '{{ item.enabled }}' diff --git a/site.yml b/site.yml index 825268da503e11949a5ed2d1c671e4792c2d8321..0586326d2bae2b0cd733be4969c4222b0f96a8ab 100644 --- a/site.yml +++ b/site.yml @@ -1,4 +1,9 @@ --- +- hosts: + - nspawn + - kodi + include: networkd.yml + - hosts: - all gather_facts: False