Ansible Resolv Save

Ansible role to configure /etc/resolv.conf

Project README

Ansible Role

ahuffman.resolv

An Ansible role to configure /etc/resolv.conf

Role Variables

Defaults

Variable Name Required Description Default Value Type
resolv_nameservers yes A list of up to 3 nameserver IP addresses [] list
resolv_domain no Local domain name "" string
resolv_search no List of up to 6 domains to search for host-name lookup [] list
resolv_sortlist no List of IP-address and netmask pairs to sort addresses returned by gethostbyname. [] list
resolv_options no List of options to modify certain internal resolver variables. [] 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 externaly 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

Open Source Agenda is not affiliated with "Ansible Resolv" Project. README Source: ahuffman/ansible-resolv
Stars
47
Open Issues
0
Last Commit
2 years ago
License
MIT

Open Source Agenda Badge

Open Source Agenda Rating