Handle systems where the main if is not eth0 a bit better

ifcfg.j2 has a pretty awkward assumption that the interface
connected to the infra network will be eth0 (or enc900) - it
only includes the GATEWAY, DOMAIN and DNS1/DNS2 lines if the
interface is one of those two. It seems we were trying quite
hard to make eth0 always be "the interface", but now that's
been broken in a few systems. enc900 was added as apparently
that's what the main interface is called on some s390 boxes;
on openqa-ppc64le-01 the if that's connected is eth2 (eth0 is
present, but not connected), and on the new qa01 and qa02, it's
em3 (according to smooge, we have to use 'predictable' interface
names on those boxes as the old names really *do* get assigned
to different interfaces on each boot).

So since we now have several different cases where the 'eth0'
assumption doesn't hold, let's build a slightly better system
for handling it. This replaces ifcfg.j2's hard-coded list with
a variable, and sets the default value of the variable to the
two names ifcfg.j2 handled before: [ 'eth0', 'enc900' ]. This
allows the systems where the main interface is *not* one of
these to set the variable accordingly, and hopefully that'll
give them correct ifcfg files.

This *should* solve the problem of openqa-ppc64le-01.qa and qa01
and qa02 constantly dropping out of network connectivity any
time they got rebooted or the network plays got run.

Signed-off-by: Adam Williamson <awilliam@redhat.com>
This commit is contained in:
Adam Williamson 2018-12-15 11:09:49 -08:00
parent 68970d5012
commit d9db9714d8
5 changed files with 16 additions and 1 deletions

View file

@ -55,6 +55,13 @@ mem_size: 2048
num_cpus: 2
lvm_size: 20000
# on MOST infra systems, the interface connected to the infra network
# is eth0. but not on quite ALL systems. e.g. on s390 boxes it's enc900,
# on openqa-ppc64le-01.qa it's eth2 for some reason, and on qa01.qa and
# qa02.qa it's em3. currently this only affects whether GATEWAY, DOMAIN
# and DNS1/DNS2 lines are put into ifcfg-(device).
ansible_ifcfg_infra_net_devices: [ 'eth0', 'enc900' ]
# Default netmask. Almost all our phx2 nets are /24's with the
# exception of 10.5.124.128/25. Almost all of our non phx2 sites are
# less than a /24.

View file

@ -1,5 +1,7 @@
---
freezes: false
# the if connected to the infra network on this box is eth2, not eth0
ansible_ifcfg_infra_net_devices: [ 'eth2' ]
gw: 10.5.131.254
dns: 10.5.126.21
eth2_ip: 10.5.131.73

View file

@ -5,6 +5,9 @@ sudoers: "{{ private }}/files/sudo/qavirt-sudoers"
nrpe_procs_warn: 1400
nrpe_procs_crit: 1600
# the if connected to the infra network on this box is em3, not eth0
ansible_ifcfg_infra_net_devices: [ 'em3' ]
em3_ip: 10.5.124.151
em3_nm: 255.255.255.0
gw: 10.5.124.254

View file

@ -5,6 +5,9 @@ sudoers: "{{ private }}/files/sudo/qavirt-sudoers"
nrpe_procs_warn: 1400
nrpe_procs_crit: 1600
# the if connected to the infra network on this box is em3, not eth0
ansible_ifcfg_infra_net_devices: [ 'em3' ]
em3_ip: 10.5.124.152
em3_nm: 255.255.255.0
gw: 10.5.124.254

View file

@ -6,7 +6,7 @@ SUBCHANNELS="0.0.0900,0.0.0901,0.0.0902"
NETTYPE="qeth"
OPTIONS="layer2=1 portno=0"
{% endif %}
{% if item == "eth0" or item == "enc900" %}
{% if item in ansible_ifcfg_infra_net_devices %}
GATEWAY="{{gw}}"
DOMAIN="phx2.fedoraproject.org vpn.fedoraproject.org fedoraproject.org"
DNS1="{{ dns1 }}"