diff options
author | binary <me@rgoncalves.se> | 2020-11-20 19:20:55 +0100 |
---|---|---|
committer | binary <me@rgoncalves.se> | 2020-11-20 19:20:55 +0100 |
commit | c110f9a103c2f676917e3fe5e33f4eaedfed070c (patch) | |
tree | 072f1b019ae7d0c39a0cbd9d88257688203edddc /roles/wireguard/tasks/generate.yml | |
parent | b739e2af7060cd10f65d97cd0bfc0e9adb7a5490 (diff) | |
download | infrastructure-c110f9a103c2f676917e3fe5e33f4eaedfed070c.tar.gz |
Refactor wireguard role with new host declaration.
Diffstat (limited to 'roles/wireguard/tasks/generate.yml')
-rw-r--r-- | roles/wireguard/tasks/generate.yml | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/roles/wireguard/tasks/generate.yml b/roles/wireguard/tasks/generate.yml deleted file mode 100644 index 6e60a92..0000000 --- a/roles/wireguard/tasks/generate.yml +++ /dev/null @@ -1,54 +0,0 @@ - -# wireguard ~~ tasks/generate.yml - -- stat: - path: "{{ wg_host_keys }}" - register: stat_host_keys - delegate_to: localhost - -- name: Generate domain keys - shell: | - umask 077 - wg genkey | tee "{{ wg_host_keys }}" | wg pubkey >> "{{ wg_host_keys }}" - args: - chdir: "{{ wg_dir }}" - when: not stat_host_keys.stat.exists or force is defined and force - delegate_to: localhost - -- name: Create wireguard dir on remote host - file: - path: /etc/wireguard - owner: root - state: directory - mode: "0700" - ignore_unreachable: true - -- name: Generate client configuration - template: - src: templates/host.conf.j2 - dest: "{{ item.path }}" - mode: "0600" - when: ansible_host != _i.dcontroller - delegate_to: "{{ item.name }}" - loop: - - { name: "{{ ansible_host }}", path: /etc/wireguard/dcontroller.conf } - - { name: localhost, path: "{{ wg_dir }}/{{ ansible_host}}.conf" } - ignore_unreachable: true - -- name: Generate server configuration - template: - src: templates/dcontroller.conf.j2 - dest: "{{ item.path }}" - mode: "0600" - when: ansible_host == _i.dcontroller - delegate_to: "{{ item.name }}" - loop: - - { name: "{{ ansible_host }}", path: /etc/wireguard/dcontroller.conf } - - { name: localhost, path: "{{ wg_dir }}/{{ ansible_host}}.conf" } - -- name: Generate server interface - template: - src: templates/hostname.j2 - dest: /etc/hostname.tun0 - when: ansible_host == _i.dcontroller - |