Skip to content

Commit

Permalink
hosts
Browse files Browse the repository at this point in the history
  • Loading branch information
bbaassssiiee committed Dec 19, 2024
1 parent a934489 commit 43e8aec
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 0 deletions.
8 changes: 8 additions & 0 deletions roles/clusterlust.hosts/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
- name: Create /etc/hosts file
ansible.builtin.template:
src: hosts.j2
dest: /etc/hosts
owner: root
group: root
mode: '0644'
6 changes: 6 additions & 0 deletions roles/clusterlust.hosts/templates/hosts.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# {{ ansible_managed }}
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
{% for host in groups['all'] %}
{{ hostvars[host]['ansible_host'] }} {{ host }}
{% endfor %}

0 comments on commit 43e8aec

Please sign in to comment.