ansible-freebsd-jailhost-tools/tasks/jail/update_etc_hosts.yml

31 lines
1.1 KiB
YAML
Raw Normal View History

2018-10-03 19:00:29 +02:00
# IMPORTANT: after the IP that is 2 TABULATOR characters !
- name: Replacing appropriate jail names with new IP addresses in /etc/hosts files (IPv4)
lineinfile:
dest: /etc/hosts
2019-01-13 16:33:53 +01:00
regexp: '^\d+\.\d+\.\d+\.\d+ jail-{{ jail_name.replace("_", "-") }}'
line: '{{ vars["jail_" + jail_name + "_new_ip4"] }} jail-{{ jail_name.replace("_", "-") }}'
state: present
2018-10-03 19:00:29 +02:00
- block:
# IMPORTANT: after the IP that is 2 TABULATOR characters !
- name: Replacing appropriate jail names with new IP addresses in /etc/hosts files (IPv6)
lineinfile:
dest: /etc/hosts
2019-01-13 16:33:53 +01:00
regexp: '^[0-9a-f:]+ jail-{{ jail_name.replace("_", "-") }}'
line: '{{ jail_THIS_with_ip6 }} jail-{{ jail_name.replace("_", "-") }}'
2018-10-03 19:00:29 +02:00
state: present
when: 'jail_THIS_with_ip6 != False'
2019-09-01 15:40:55 +02:00
- name: Sending HUP to any any crucial processes to reload their configuration
2021-05-16 20:12:06 +02:00
ansible.builtin.command:
/usr/bin/killall -HUP dnsmasq
failed_when: false
- name: Restarting syslog to put its log socket into the new jail
service:
name: syslogd
state: restarted
2019-09-01 17:12:05 +02:00
# vim: sw=2