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: # roles:
# - docker # - docker
- hosts: uatu.lan #- hosts: uatu.lan
roles: # roles:
# - ssh # - ssh
# - ubuntu # - ubuntu
# - docker # - docker
- duplicity # - duplicity
- hosts: node-01.lan
roles:
- network

View File

@ -1,12 +1,17 @@
--- ---
- name: create build directory - name: create directory
file: file:
path: build/dhcp path: /srv/dhcp/config
state: directory state: directory
- name: Create dhcpd.conf - name: Create dhcpd.conf
become: yes
template: template:
src: etc/dhcpd/dhcpd.conf.j2 src: etc/dhcpd/dhcpd.conf.j2
dest: build/dhcp/dhcpd.conf dest: /srv/dhcp/config/dhcpd.conf
vars: vars:
network: "{{ lan }}" 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: file:
path: build/dns path: /srv/bind/config
state: directory state: directory
- name: Create db lan - name: Create db lan
# become: yes
template: template:
src: etc/bind/db.lan.j2 src: etc/bind/db.lan.j2
dest: build/dns/db.lan dest: /srv/bind/config/db.lan
vars: vars:
network: "{{ lan }}" network: "{{ lan }}"
serial: "{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}02" serial: "{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}02"
- name: Create reverse db lan - name: Create reverse db lan
# become: yes
template: template:
src: etc/bind/db.reverse.j2 src: etc/bind/db.reverse.j2
dest: build/dns/db.{{ lan.network_reverse }} dest: /srv/bind/config/db.{{ lan.network_reverse }}
vars: vars:
network: "{{ lan }}" network: "{{ lan }}"
serial: "{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}02" serial: "{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}02"
- name: Create db iot - name: Create db iot
# become: yes
template: template:
src: etc/bind/db.lan.j2 src: etc/bind/db.lan.j2
dest: build/dns/db.iot dest: /srv/bind/config/db.iot
vars: vars:
network: "{{ iot }}" network: "{{ iot }}"
serial: "{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}02" serial: "{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}02"
- name: Create reverse db iot - name: Create reverse db iot
# become: yes
template: template:
src: etc/bind/db.reverse.j2 src: etc/bind/db.reverse.j2
dest: build/dns/db.{{ iot.network_reverse }} dest: /srv/bind/config/db.{{ iot.network_reverse }}
vars: vars:
network: "{{ iot }}" network: "{{ iot }}"
serial: "{{ ansible_date_time.year }}{{ ansible_date_time.month }}{{ ansible_date_time.day }}02" 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 - import_tasks: dns-file.yml
become: yes
- import_tasks: dhcp-file.yml - import_tasks: dhcp-file.yml
become: yes