ahuffman.resolv

Ansible Role

ahuffman.resolv

This is an Ansible role for setting up the /etc/resolv.conf file.

Role Variables

Defaults

Variable Name Required Description Default Value Type
resolv_nameservers yes A list of up to 3 IP addresses for nameservers [] list
resolv_domain no Your local domain name "" string
resolv_search no A list of up to 6 domains to look for hostnames [] list
resolv_sortlist no A list of IP addresses and netmasks for sorting [] list
resolv_options no Options to change certain internal resolver settings [] list

Example Playbooks

Role Invocation

    - name: "Role Invocation - ahuffman.resolv Example"
      hosts: "all"
      roles:
        - role: "ahuffman.resolv"
          resolv_nameservers:
            - "8.8.8.8"
            - "8.8.4.4"
          resolv_domain: "foo.org"
          resolv_search:
            - "foo.bar"
            - "foobar.com"
          resolv_options:
            - "timeout:2"
            - "rotate"

Role Invocation with externally defined variables (group_vars / host_vars)

    - name: "Role Invocation - ahuffman.resolv Example"
      hosts: "all"
      roles:
        - role: "ahuffman.resolv"
          when:
            - resolv_nameservers is defined
            - resolv_nameservers | length > 0

Included Role

---
- name: "Included Role - ahuffman.resolv Example"
  hosts: "all"
  tasks:
    - name: "Configure resolv.conf"
      include_role:
        name: "ahuffman.resolv"
      vars:
        resolv_nameservers:
          - "8.8.8.8"
          - "8.8.4.4"
        resolv_domain: "foo.org"
        resolv_search:
          - "foo.bar"
          - "foobar.com"
        resolv_options:
          - "timeout:2"
          - "rotate"

License

MIT

Author Information

Andrew J. Huffman

Informazioni sul progetto

An Ansible role to configure /etc/resolv.conf

Installa
ansible-galaxy install ahuffman.resolv
Licenza
mit
Download
1.2M
Proprietario