Switch network to update to live system

This commit is contained in:
Przemek Grondek 2023-05-11 22:37:41 +02:00
parent c1480a8403
commit d8c901424c
5 changed files with 28 additions and 21 deletions

View File

@ -1,4 +0,0 @@
---
- hosts: localhost
roles:
- network

View File

@ -24,9 +24,13 @@
# roles:
# - docker
- hosts: uatu.lan
roles:
#- hosts: uatu.lan
# roles:
# - ssh
# - ubuntu
# - docker
- duplicity
# - duplicity
- hosts: node-01.lan
roles:
- network

View File

@ -1,12 +1,17 @@
---
- name: create build directory
- name: create directory
file:
path: build/dhcp
path: /srv/dhcp/config
state: directory
- name: Create dhcpd.conf
become: yes
template:
src: etc/dhcpd/dhcpd.conf.j2
dest: build/dhcp/dhcpd.conf
dest: /srv/dhcp/config/dhcpd.conf
vars:
network: "{{ lan }}"
- name: restart container
shell:
cmd: docker service update --force --detach dhcp

View File

@ -1,41 +1,41 @@
---
- name: create build directory
- name: create dns directory
file:
path: build/dns
path: /srv/bind/config
state: directory
- name: Create db lan
# become: yes
template:
src: etc/bind/db.lan.j2
dest: build/dns/db.lan
dest: /srv/bind/config/db.lan
vars:
network: "{{ lan }}"
serial: "{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}02"
- name: Create reverse db lan
# become: yes
template:
src: etc/bind/db.reverse.j2
dest: build/dns/db.{{ lan.network_reverse }}
dest: /srv/bind/config/db.{{ lan.network_reverse }}
vars:
network: "{{ lan }}"
serial: "{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}02"
- name: Create db iot
# become: yes
template:
src: etc/bind/db.lan.j2
dest: build/dns/db.iot
dest: /srv/bind/config/db.iot
vars:
network: "{{ iot }}"
serial: "{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}02"
- name: Create reverse db iot
# become: yes
template:
src: etc/bind/db.reverse.j2
dest: build/dns/db.{{ iot.network_reverse }}
dest: /srv/bind/config/db.{{ iot.network_reverse }}
vars:
network: "{{ iot }}"
serial: "{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}02"
- name: restart container
shell:
cmd: docker service update --force --detach bind

View File

@ -1,4 +1,6 @@
---
- import_tasks: dns-file.yml
become: yes
- import_tasks: dhcp-file.yml
become: yes