diff --git a/localhost.yml b/localhost.yml deleted file mode 100644 index 8370992..0000000 --- a/localhost.yml +++ /dev/null @@ -1,4 +0,0 @@ ---- -- hosts: localhost - roles: - - network diff --git a/main.yml b/main.yml index ae40cbf..4fa8295 100644 --- a/main.yml +++ b/main.yml @@ -24,9 +24,13 @@ # roles: # - docker -- hosts: uatu.lan - roles: +#- hosts: uatu.lan +# roles: # - ssh # - ubuntu # - docker - - duplicity \ No newline at end of file +# - duplicity + +- hosts: node-01.lan + roles: + - network \ No newline at end of file diff --git a/roles/network/tasks/dhcp-file.yml b/roles/network/tasks/dhcp-file.yml index e5599f7..4a60d37 100644 --- a/roles/network/tasks/dhcp-file.yml +++ b/roles/network/tasks/dhcp-file.yml @@ -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 }}" \ No newline at end of file + network: "{{ lan }}" + +- name: restart container + shell: + cmd: docker service update --force --detach dhcp diff --git a/roles/network/tasks/dns-file.yml b/roles/network/tasks/dns-file.yml index 25358d3..5ec8871 100644 --- a/roles/network/tasks/dns-file.yml +++ b/roles/network/tasks/dns-file.yml @@ -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 diff --git a/roles/network/tasks/main.yml b/roles/network/tasks/main.yml index cb154d5..3bbf68a 100644 --- a/roles/network/tasks/main.yml +++ b/roles/network/tasks/main.yml @@ -1,4 +1,6 @@ --- - import_tasks: dns-file.yml + become: yes - import_tasks: dhcp-file.yml + become: yes