Для этого вы можете использовать якоря / псевдонимы.
Например, для уменьшенной версии вашего примера
>>> import yaml
>>> doc = """
Configs:
Mars:
allowed_connections: &mars # Mark this as an anchor
- 88.99.99.99
- 88.99.99.98
- 88.99.99.97
Servers:
Server:
location: "Mars"
network: {ip: "0.0.0.3", mac: "00:00:00:00:00:03"}
inbound: *mars # references the anchor here
"""
>>> from pprint import pprint # just for formatting
>>> pprint(yaml.load(doc))
{'Configs': {'Mars': {'allowed_connections': ['88.99.99.99',
'88.99.99.98',
'88.99.99.97']}},
'Servers': {'Server': {'inbound': ['88.99.99.99',
'88.99.99.98',
'88.99.99.97'],
'location': 'Mars',
'network': {'ip': '0.0.0.3',
'mac': '00:00:00:00:00:03'}}}}
Обратите внимание, что раздел конфигурации должен быть перед разделом сервера, чтобы онможно ссылаться.
Дополнительные примеры здесь .