fixed IP for local test VM
This commit is contained in:
parent
c42f4ee1fb
commit
39e6f7d0f2
6 changed files with 61 additions and 7 deletions
|
@ -28,4 +28,4 @@ linse.freifunk-mwu.de # ext. DNS-master
|
||||||
#pudding.freifunk-mwu.de #
|
#pudding.freifunk-mwu.de #
|
||||||
|
|
||||||
[test-vms]
|
[test-vms]
|
||||||
local-test-vm.ffmwu.local
|
local-test-vm.ffmwu.local ansible_host=192.168.137.7
|
||||||
|
|
29
loctevm-reset-net.inc.yml
Normal file
29
loctevm-reset-net.inc.yml
Normal file
|
@ -0,0 +1,29 @@
|
||||||
|
---
|
||||||
|
|
||||||
|
- name: find already defined local Vnets
|
||||||
|
virt_net: command=list_nets
|
||||||
|
delegate_to: 127.0.0.1 # local action
|
||||||
|
register: nets
|
||||||
|
|
||||||
|
- debug: var=nets
|
||||||
|
|
||||||
|
- block:
|
||||||
|
- name: construct Vnet xml file
|
||||||
|
template:
|
||||||
|
src: templates/loctenet.xml
|
||||||
|
dest: "{{ vm_path }}/loctenet.xml"
|
||||||
|
delegate_to: 127.0.0.1 # local action
|
||||||
|
|
||||||
|
- name: define Vnet
|
||||||
|
virt_net:
|
||||||
|
command: define
|
||||||
|
name: "ffmwu"
|
||||||
|
xml: "{{ lookup('file',vm_path ~ '/loctenet.xml') }}"
|
||||||
|
delegate_to: 127.0.0.1 # local action
|
||||||
|
|
||||||
|
when: not "ffmwu" in nets.list_nets
|
||||||
|
# block end
|
||||||
|
|
||||||
|
- name: exnsure activ Vnet ffmwu
|
||||||
|
virt_net: name=ffmwu state=active
|
||||||
|
delegate_to: 127.0.0.1 # local action
|
|
@ -3,8 +3,9 @@
|
||||||
# FIXME: do nothing for now
|
# FIXME: do nothing for now
|
||||||
# FIXME: how to learn about IP of VM ???
|
# FIXME: how to learn about IP of VM ???
|
||||||
|
|
||||||
#- name: prepare escalation
|
- name: prepare escalation
|
||||||
# set_fact: ansible_become_pass=bloed
|
set_fact: ansible_become_pass=bloed ansible_ssh_pass=bloed
|
||||||
#
|
|
||||||
#- name: ensure admin user
|
- name: ensure admin user
|
||||||
# user: comment=FFMWU Administrator name=admin state=present
|
user: comment="FFMWU Administrator" name=admin shell=/bin/bash state=present
|
||||||
|
become: True
|
||||||
|
|
|
@ -28,6 +28,9 @@
|
||||||
- name: get and prepare debian image file
|
- name: get and prepare debian image file
|
||||||
include: loctevm-reset-iso.inc.yml
|
include: loctevm-reset-iso.inc.yml
|
||||||
|
|
||||||
|
- name: define Vnd activate Vnet (if not already)
|
||||||
|
include: loctevm-reset-net.inc.yml
|
||||||
|
|
||||||
- name: define VM (if not already)
|
- name: define VM (if not already)
|
||||||
include: loctevm-reset-vm.inc.yml
|
include: loctevm-reset-vm.inc.yml
|
||||||
|
|
||||||
|
@ -37,9 +40,15 @@
|
||||||
name: "{{ inventory_hostname }}"
|
name: "{{ inventory_hostname }}"
|
||||||
delegate_to: 127.0.0.1 # local action
|
delegate_to: 127.0.0.1 # local action
|
||||||
|
|
||||||
|
- name: wait for port 80 to appear (after reboot after OS installation)
|
||||||
|
wait_for: host={{ansible_host}} port=80 state=started timeout=300
|
||||||
|
delegate_to: 127.0.0.1 # local action
|
||||||
|
|
||||||
- hosts: test-vms
|
- hosts: test-vms
|
||||||
remote_user: hein
|
remote_user: hein
|
||||||
|
gather_facts: False
|
||||||
# become: True
|
# become: True
|
||||||
|
|
||||||
|
tasks:
|
||||||
- name: prepare VM (if not already)
|
- name: prepare VM (if not already)
|
||||||
include: loctevm-reset-prereq.inc.yml
|
include: loctevm-reset-prereq.inc.yml
|
||||||
|
|
14
templates/loctenet.xml
Normal file
14
templates/loctenet.xml
Normal file
|
@ -0,0 +1,14 @@
|
||||||
|
<network>
|
||||||
|
<name>ffmwu</name>
|
||||||
|
<bridge macTableManager="libvirt"/>
|
||||||
|
<forward mode="nat">
|
||||||
|
<!-- interface dev='eth0'/>
|
||||||
|
<interface dev='wlan0'/ -->
|
||||||
|
</forward>
|
||||||
|
<ip address="192.168.137.1" netmask="255.255.255.0">
|
||||||
|
<dhcp>
|
||||||
|
<range start="192.168.137.10" end="192.168.137.11" />
|
||||||
|
<host mac="52:53:54:55:56:57" ip="{{ansible_host}}" />
|
||||||
|
</dhcp>
|
||||||
|
</ip>
|
||||||
|
</network>
|
|
@ -40,8 +40,9 @@
|
||||||
</disk>
|
</disk>
|
||||||
|
|
||||||
<interface type='network'>
|
<interface type='network'>
|
||||||
<source network='default'/>
|
<source network='ffmwu'/>
|
||||||
<model type='virtio'/>
|
<model type='virtio'/>
|
||||||
|
<mac address='52:53:54:55:56:57'/>
|
||||||
</interface>
|
</interface>
|
||||||
|
|
||||||
<serial type='pty'>
|
<serial type='pty'>
|
||||||
|
|
Loading…
Reference in a new issue