3 cj @ s U d Z ddlZddlmZ ddlmZmZ ddlmZ ddl m Z ddlmZm Z ddlmZ ejeZd d dZdZd ddedddddddddddddddgeedgd gd!Zee eZ d"d# Zee eedd$d%d&ZdS )'z"Resolv Conf: configure resolv.conf N)dedent) templaterutil)Cloud)Config) MetaSchemaget_meta_doc)PER_INSTANCEzresolv.confzsystemd.resolved.conf)z/etc/resolv.confz/etc/systemd/resolved.confa Unless manually editing :file:`/etc/resolv.conf` is the correct way to manage nameserver information on your operating system, you do not want to use this module. Many distros have moved away from manually editing ``resolv.conf`` so please verify that this is the preferred nameserver management method for your distro before using this module. Note that using :ref:`network_config` is preferred, rather than using this module, when possible. This module is intended to manage resolv.conf in environments where early configuration of resolv.conf is necessary for further bootstrapping and/or where configuration management such as puppet or chef own DNS configuration. When using a :ref:`datasource_config_drive` and a RHEL-like system, resolv.conf will also be managed automatically due to the available information provided for DNS servers in the :ref:`network_config_v2` format. For those that wish to have different settings, use this module. In order for the ``resolv_conf`` section to be applied, ``manage_resolv_conf`` must be set ``true``. .. note:: For Red Hat with sysconfig, be sure to set PEERDNS=no for all DHCP enabled NICs. Zcc_resolv_confzResolv ConfzConfigure resolv.confZ almalinuxZalpineZ cloudlinuxZfedoraZmarinerZopensusez opensuse-leapzopensuse-microoszopensuse-tumbleweedZphotonZrhelZsle_hpcz sle-microZslesZ openeulera manage_resolv_conf: true resolv_conf: nameservers: - 8.8.8.8 - 8.8.4.4 searchdomains: - foo.example.com - bar.example.com domain: example.com sortlist: - 10.0.0.1/255 - 10.0.0.2 options: rotate: true timeout: 1 manage_resolv_conf)idnametitledescriptionZdistrosZ frequencyZexamplesZactivate_by_schema_keysc C s g }g }d|krNx<|d j D ],\}}t|tr|r@|j| q|j| qW x|| D ]}|d |= qXW |jds|i |d<