autogenerate hosts
This commit is contained in:
parent
523cfec521
commit
dce5b25702
@ -4,7 +4,5 @@
|
|||||||
|
|
||||||
# LAN static IP address
|
# LAN static IP address
|
||||||
local_subnet: 192.168.0.0/24
|
local_subnet: 192.168.0.0/24
|
||||||
# local IP of bastion node
|
|
||||||
bastion_ip: null
|
|
||||||
|
|
||||||
sshd_port: 2500
|
sshd_port: 2500
|
||||||
|
@ -14,7 +14,7 @@
|
|||||||
|
|
||||||
- name: Set default sources (fleet server)
|
- name: Set default sources (fleet server)
|
||||||
set_fact:
|
set_fact:
|
||||||
default_firewall_src: "{{ bastion_ip }}"
|
default_firewall_src: "{{ host_vars[groups['bastion'][0]]['local_ip'] }}"
|
||||||
when: "fleet" in group_names
|
when: "fleet" in group_names
|
||||||
|
|
||||||
- name: Allow service ports
|
- name: Allow service ports
|
||||||
|
6
roles/networking/hosts/tasks/main.yml
Normal file
6
roles/networking/hosts/tasks/main.yml
Normal file
@ -0,0 +1,6 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- name: Deploy /etc/hosts template
|
||||||
|
template:
|
||||||
|
src: hosts.j2
|
||||||
|
dest: /etc/hosts
|
9
roles/networking/hosts/templates/hosts.j2
Normal file
9
roles/networking/hosts/templates/hosts.j2
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
# Static table lookup for hostnames.
|
||||||
|
# See hosts(5) for details.
|
||||||
|
|
||||||
|
# This file (/etc/hosts) is automatically generated via Ansible.
|
||||||
|
# Modifications will be lost!
|
||||||
|
|
||||||
|
{% for host in groups["all"] %}
|
||||||
|
{{ host_vars[host]["local_ip"] }} {{ host }}
|
||||||
|
{% endfor %}
|
Loading…
Reference in New Issue
Block a user