diff --git a/tasks/distribute.yml b/tasks/distribute.yml index 00d3a1e..0386f48 100644 --- a/tasks/distribute.yml +++ b/tasks/distribute.yml @@ -7,7 +7,7 @@ tinc_base_dir: /usr/local/etc/tinc - name: Distribute - Copy hostfiles to targets - become: yes + become: true ansible.builtin.copy: src: "{{ role_path }}/files/tmp/" dest: "{{ tinc_base_dir }}/{{ tinc_vpn_id }}/hosts/" diff --git a/tasks/main.yml b/tasks/main.yml index daf33b9..441b4fa 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -2,7 +2,7 @@ # Tinc VPN Setup and Configuration - name: Main - Set different base dir for macOS - when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Darwin" + when: (override_os_family is defined) | ternary(override_os_family, ansible_os_family) == "Darwin" ansible.builtin.set_fact: tinc_base_dir: /usr/local/etc/tinc @@ -10,17 +10,17 @@ ansible.builtin.include_tasks: "{{ item }}" with_first_found: - "setup-{{ ansible_distribution }}.yml" - - "setup-{{ (override_os_family is defined) | ternary(override_os_family,ansible_os_family) }}.yml" + - "setup-{{ (override_os_family is defined) | ternary(override_os_family, ansible_os_family) }}.yml" - name: Main - Create tinc directories - become: yes + become: true ansible.builtin.file: path: "{{ tinc_base_dir }}/{{ tinc_vpn_id }}/hosts" state: directory mode: "0755" - name: Main - Create new host keypair - become: yes + become: true ansible.builtin.shell: | export PATH=/usr/local/sbin:/usr/local/bin:$PATH tincd -n {{ tinc_vpn_id }} -K4096 @@ -29,61 +29,61 @@ creates: rsa_key.priv - name: Main - Create config - become: yes + become: true ansible.builtin.template: src: "{{ role_path }}/templates/tinc.conf.j2" dest: "{{ tinc_base_dir }}/{{ tinc_vpn_id }}/tinc.conf" - name: Main - Fetch public key - become: yes + become: true ansible.builtin.fetch: src: "{{ tinc_base_dir }}/{{ tinc_vpn_id }}/rsa_key.pub" dest: "{{ role_path }}/templates/tmp/rsa_key-{{ ansible_hostname | replace('-', '_') }}.pub" - flat: yes + flat: true - name: Main - Create own hostfile - become: yes + become: true ansible.builtin.template: src: "{{ role_path }}/templates/hostfile.j2" dest: "{{ tinc_base_dir }}/{{ tinc_vpn_id }}/hosts/{{ ansible_hostname | replace('-', '_') }}" - name: Main - Create tinc-up script - become: yes + become: true ansible.builtin.template: src: "{{ role_path }}/templates/tinc-up.j2" dest: "{{ tinc_base_dir }}/{{ tinc_vpn_id }}/tinc-up" mode: "0755" - name: Main - Create tinc-down script - become: yes + become: true ansible.builtin.template: src: "{{ role_path }}/templates/tinc-down.j2" dest: "{{ tinc_base_dir }}/{{ tinc_vpn_id }}/tinc-down" mode: "0755" - name: Main - Fetch all hostfiles - become: yes + become: true ansible.builtin.fetch: src: "{{ tinc_base_dir }}/{{ tinc_vpn_id }}/hosts/{{ ansible_hostname | replace('-', '_') }}" dest: "{{ role_path }}/files/tmp/{{ ansible_hostname | replace('-', '_') }}" - flat: yes + flat: true - name: "Main - Enable {{ tinc_vpn_id }}" when: ansible_os_family != 'Darwin' - become: yes + become: true block: - name: "Main - Enable {{ tinc_vpn_id }} in tinc config" ansible.builtin.lineinfile: name: "{{ tinc_base_dir }}/nets.boot" line: "{{ tinc_vpn_id }}" - create: yes + create: true - name: "Main - Enable and restart tinc service" ansible.builtin.systemd: name: tinc state: restarted - enabled: yes + enabled: true - name: "Main - Enable and restart tinc@{{ tinc_vpn_id }} service" ansible.builtin.systemd: name: "tinc@{{ tinc_vpn_id }}" state: restarted - enabled: yes + enabled: true diff --git a/tasks/setup-Darwin.yml b/tasks/setup-Darwin.yml index 21a3ab2..33e1196 100644 --- a/tasks/setup-Darwin.yml +++ b/tasks/setup-Darwin.yml @@ -8,3 +8,4 @@ vars: packages: - tinc + diff: false diff --git a/tasks/setup-Debian.yml b/tasks/setup-Debian.yml index b29d2c0..7d7b20a 100644 --- a/tasks/setup-Debian.yml +++ b/tasks/setup-Debian.yml @@ -2,10 +2,11 @@ # Tinc/Setup: Install tinc application - Debian Version - name: Setup - Install - become: yes + become: true ansible.builtin.apt: name: "{{ packages }}" state: present vars: packages: - tinc + diff: false