From 4cb418e2b63d7035a5550a3efbc2b661a855eac1 Mon Sep 17 00:00:00 2001 From: Ruakij Date: Mon, 17 Oct 2022 14:51:52 +0200 Subject: [PATCH] Add role netmaker (netclient) --- netmaker/meta/main.yml | 3 +++ netmaker/tasks/install.yml | 25 +++++++++++++++++++++++++ netmaker/tasks/join-network.yml | 4 ++++ netmaker/tasks/main.yml | 5 +++++ netmaker/tasks/prerequisites.yml | 0 5 files changed, 37 insertions(+) create mode 100644 netmaker/meta/main.yml create mode 100644 netmaker/tasks/install.yml create mode 100644 netmaker/tasks/join-network.yml create mode 100644 netmaker/tasks/main.yml create mode 100644 netmaker/tasks/prerequisites.yml diff --git a/netmaker/meta/main.yml b/netmaker/meta/main.yml new file mode 100644 index 0000000..3b2d8d8 --- /dev/null +++ b/netmaker/meta/main.yml @@ -0,0 +1,3 @@ +--- + dependencies: + - role: docker diff --git a/netmaker/tasks/install.yml b/netmaker/tasks/install.yml new file mode 100644 index 0000000..239dfec --- /dev/null +++ b/netmaker/tasks/install.yml @@ -0,0 +1,25 @@ +- name: Install Packages +# when: docker_file.stat.exists == False + package: + name: + - gpg + - gpg-agent + +- name: Add netmaker-key + apt_key: + url: https://apt.netmaker.org/gpg.key + state: present + +- name: Add netmaker-repository + apt_repository: + repo: "deb https:apt.netmaker.org stable main" + state: present + filename: netmaker + update_cache: yes + +- name: Install wireguard & netclient + package: + name: + - wireguard + - netclient + state: latest diff --git a/netmaker/tasks/join-network.yml b/netmaker/tasks/join-network.yml new file mode 100644 index 0000000..b57ad1a --- /dev/null +++ b/netmaker/tasks/join-network.yml @@ -0,0 +1,4 @@ +- name: Join netmaker-network + when: "netclient.join_network_token is defined" + command: "netclient join -t {{ netclient.join_network_token }}" + failed_when: command.rc != 0 diff --git a/netmaker/tasks/main.yml b/netmaker/tasks/main.yml new file mode 100644 index 0000000..78b8f81 --- /dev/null +++ b/netmaker/tasks/main.yml @@ -0,0 +1,5 @@ +- import_tasks: ./prerequisites.yml + +- import_tasks: ./install.yml + +- import_tasks: ./join-network.yml diff --git a/netmaker/tasks/prerequisites.yml b/netmaker/tasks/prerequisites.yml new file mode 100644 index 0000000..e69de29