diff --git a/netmaker/defauls/netmaker.yml b/netmaker/defauls/netmaker.yml new file mode 100644 index 0000000..2be09fa --- /dev/null +++ b/netmaker/defauls/netmaker.yml @@ -0,0 +1,4 @@ +netclient: + # Token to join default-network + # leave empty to ignore + join_network_token: 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/certs.yml b/netmaker/tasks/certs.yml new file mode 100644 index 0000000..a13e98e --- /dev/null +++ b/netmaker/tasks/certs.yml @@ -0,0 +1,4 @@ +- name: Deploy CA Certificate + ansible.builtin.copy: + src: secret_files/netmaker_server/ca/ca.crt + dest: /etc/ssl/certs/netmaker-ca.pem 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..0cc5cb0 --- /dev/null +++ b/netmaker/tasks/join-network.yml @@ -0,0 +1,5 @@ +- name: Join netmaker-network + when: "netclient.join_network_token is defined" + command: "netclient join -t {{ netclient.join_network_token }}" + failed_when: command.rc != 0 + register: command diff --git a/netmaker/tasks/main.yml b/netmaker/tasks/main.yml new file mode 100644 index 0000000..9b522e8 --- /dev/null +++ b/netmaker/tasks/main.yml @@ -0,0 +1,5 @@ +- import_tasks: ./certs.yml + +- import_tasks: ./install.yml + +- import_tasks: ./join-network.yml