stafwag.etc_hosts
Ansible Role: etc_hosts
This is an Ansible role for managing the /etc/hosts
file.
Requirements
No specific requirements needed.
Role Variables
OS Related Variables
None.
Playbook Related Variables
- etc_hosts:
- hosts: A list of hosts
- name: The hostname.
- ip: The IP address.
- state: Can be "absent" or "present" (default is "present").
- hosts: A list of hosts
Dependencies
No dependencies.
Example Playbooks
Here's an example of how to use this role in a playbook:
- name: Configure /etc/hosts on DMZ systems
hosts: dmz
become: true
vars:
etc_hosts:
hosts:
- { name: "localhost", ip: "127.0.0.1", state: "present" }
- { name: "stafgit", ip: "10.10.10.10", state: "absent" }
- { name: "stafmail", ip: "10.10.10.10", state: "absent" }
roles:
- stafwag.etc_hosts
License
MIT/BSD
Author Information
Created by Staf Wagemakers. You can reach him at staf@wagemakers.be or visit his website at http://www.wagemakers.be.