[TIDY] Update to ansible 4 module names
This commit is contained in:
parent
be3d627bdb
commit
5553f66031
|
@ -64,7 +64,7 @@ Playbook:
|
|||
hosts: tinc
|
||||
tasks:
|
||||
- name: Tinc - Distribute hostfiles
|
||||
import_role:
|
||||
ansible.builtin.import_role:
|
||||
name: tinc
|
||||
tasks_from: distribute
|
||||
```
|
||||
|
|
|
@ -2,12 +2,12 @@
|
|||
# Tinc VPN Hostfile Distribution
|
||||
|
||||
- name: Distribute - Set different base dir for macOS
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
tinc_base_dir: /usr/local/etc/tinc
|
||||
when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Darwin"
|
||||
|
||||
- name: Distribute - Copy hostfiles to targets
|
||||
become: yes
|
||||
copy:
|
||||
ansible.builtin.copy:
|
||||
src: "{{ role_path }}/files/tmp/"
|
||||
dest: "{{ tinc_base_dir }}/{{ tinc_vpn_id }}/hosts/"
|
||||
|
|
|
@ -2,26 +2,26 @@
|
|||
# Tinc VPN Setup and Configuration
|
||||
|
||||
- name: Main - Set different base dir for macOS
|
||||
set_fact:
|
||||
ansible.builtin.set_fact:
|
||||
tinc_base_dir: /usr/local/etc/tinc
|
||||
when: (override_os_family is defined) | ternary(override_os_family,ansible_os_family) == "Darwin"
|
||||
|
||||
- name: Main - Install tinc
|
||||
include_tasks: "{{ item }}"
|
||||
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"
|
||||
|
||||
- name: Main - Create tinc directories
|
||||
become: yes
|
||||
file:
|
||||
ansible.builtin.file:
|
||||
path: "{{ tinc_base_dir }}/{{ tinc_vpn_id }}/hosts"
|
||||
state: directory
|
||||
mode: "0755"
|
||||
|
||||
- name: Main - Create new host keypair
|
||||
become: yes
|
||||
shell: |
|
||||
ansible.builtin.shell: |
|
||||
export PATH=/usr/local/sbin:/usr/local/bin:$PATH
|
||||
tincd -n {{ tinc_vpn_id }} -K4096
|
||||
args:
|
||||
|
@ -30,40 +30,40 @@
|
|||
|
||||
- name: Main - Create config
|
||||
become: yes
|
||||
template:
|
||||
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
|
||||
fetch:
|
||||
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
|
||||
|
||||
- name: Main - Create own hostfile
|
||||
become: yes
|
||||
template:
|
||||
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
|
||||
template:
|
||||
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
|
||||
template:
|
||||
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
|
||||
fetch:
|
||||
ansible.builtin.fetch:
|
||||
src: "{{ tinc_base_dir }}/{{ tinc_vpn_id }}/hosts/{{ ansible_hostname | replace('-', '_') }}"
|
||||
dest: "{{ role_path }}/files/tmp/{{ ansible_hostname | replace('-', '_') }}"
|
||||
flat: yes
|
||||
|
@ -72,17 +72,17 @@
|
|||
become: yes
|
||||
block:
|
||||
- name: "Main - Enable {{ tinc_vpn_id }} in tinc config"
|
||||
lineinfile:
|
||||
ansible.builtin.lineinfile:
|
||||
name: "{{ tinc_base_dir }}/nets.boot"
|
||||
line: "{{ tinc_vpn_id }}"
|
||||
create: yes
|
||||
- name: "Main - Enable and restart tinc service"
|
||||
systemd:
|
||||
ansible.builtin.systemd:
|
||||
name: tinc
|
||||
state: restarted
|
||||
enabled: yes
|
||||
- name: "Main - Enable and restart tinc@{{ tinc_vpn_id }} service"
|
||||
systemd:
|
||||
ansible.builtin.systemd:
|
||||
name: "tinc@{{ tinc_vpn_id }}"
|
||||
state: restarted
|
||||
enabled: yes
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
# Tinc/Setup: Install tinc application - macOS Version
|
||||
|
||||
- name: Setup - Install
|
||||
package:
|
||||
ansible.builtin.package:
|
||||
name: "{{ packages }}"
|
||||
state: present
|
||||
vars:
|
||||
|
|
|
@ -3,7 +3,7 @@
|
|||
|
||||
- name: Setup - Install
|
||||
become: yes
|
||||
apt:
|
||||
ansible.builtin.apt:
|
||||
name: "{{ packages }}"
|
||||
state: present
|
||||
vars:
|
||||
|
|
Loading…
Reference in a new issue