From 92b386f75bdfb8d23530e849ce27d2e60d5b57ac Mon Sep 17 00:00:00 2001 From: Stefan Date: Thu, 13 Apr 2023 15:30:53 +0200 Subject: [PATCH] Add Unifi Rollout --- host_vars/unifi.yml | 4 +++ hosts.yml | 5 ++++ roles/21-install-oitc/tasks/main.yml | 9 ++++--- roles/21-unifi/tasks/main.yml | 37 ++++++++++++++++++++++++++++ system-setup-unifi.yml | 11 +++++++++ 5 files changed, 62 insertions(+), 4 deletions(-) create mode 100644 host_vars/unifi.yml create mode 100644 roles/21-unifi/tasks/main.yml create mode 100644 system-setup-unifi.yml diff --git a/host_vars/unifi.yml b/host_vars/unifi.yml new file mode 100644 index 0000000..f235aad --- /dev/null +++ b/host_vars/unifi.yml @@ -0,0 +1,4 @@ +ansible_host: 5.9.220.118 +ansible_port: 22 +ansible_ssh_user: root +ansible_python_interpreter: /usr/bin/python3 \ No newline at end of file diff --git a/hosts.yml b/hosts.yml index bb5c588..0f83f4a 100644 --- a/hosts.yml +++ b/hosts.yml @@ -18,6 +18,11 @@ all: freifunk-supernodes: hosts: vpn02: + service_server: + children: + unifi: + hosts: + unifi: edge_router: hosts: edge1: diff --git a/roles/21-install-oitc/tasks/main.yml b/roles/21-install-oitc/tasks/main.yml index eb5eee3..ba3dcde 100644 --- a/roles/21-install-oitc/tasks/main.yml +++ b/roles/21-install-oitc/tasks/main.yml @@ -1,12 +1,13 @@ -- name: Repo Key Import - ansible.builtin.shell: curl https://packages.openitcockpit.io/repokey.txt | sudo apt-key add +- name: Add OITC GPG Key + ansible.builtin.get_url: + url: https://packages.openitcockpit.io/repokey.txt + dest: /etc/apt/keyrings/openitcockpit-agent-keyring.asc - name: Add specified repository into sources list ansible.builtin.apt_repository: - repo: deb https://packages.openitcockpit.io/openitcockpit-agent/deb/stable deb main + repo: "deb [signed-by=/etc/apt/keyrings/openitcockpit-agent-keyring.asc] https://packages.openitcockpit.io/openitcockpit-agent/deb/stable deb main" state: present - - name: Install OITC-Agent apt: name={{ item }} state=latest update_cache=yes with_items: diff --git a/roles/21-unifi/tasks/main.yml b/roles/21-unifi/tasks/main.yml new file mode 100644 index 0000000..8950b1b --- /dev/null +++ b/roles/21-unifi/tasks/main.yml @@ -0,0 +1,37 @@ +--- +- name: Install Packages for Unifi APT + ansible.builtin.apt: + name: + - ca-certificates + - apt-transport-https + state: latest + update_cache: yes + +- name: Add MongoDB GPG Key + ansible.builtin.get_url: + url: https://www.mongodb.org/static/pgp/server-3.0.asc + dest: /etc/apt/keyrings/mongodb-3.0.asc + +- name: Add Unifi GPG Key + ansible.builtin.get_url: + url: https://dl.ui.com/unifi/unifi-repo.gpg + dest: /etc/apt/trusted.gpg.d/unifi-repo.gpg + +- name: Add MongoDB repository into sources list using specified filename + ansible.builtin.apt_repository: + repo: "deb [trusted=yes] http://repo.mongodb.org/apt/ubuntu precise/mongodb-org/3.0 multiverse" + state: present + filename: mongodb + +- name: Add Unifi repository into sources list using specified filename + ansible.builtin.apt_repository: + repo: deb https://www.ui.com/downloads/unifi/debian stable ubiquiti + state: present + filename: unifi + +- name: Install Unifi via APT + ansible.builtin.apt: + name: + - unifi + state: latest + update_cache: yes \ No newline at end of file diff --git a/system-setup-unifi.yml b/system-setup-unifi.yml new file mode 100644 index 0000000..e3007f2 --- /dev/null +++ b/system-setup-unifi.yml @@ -0,0 +1,11 @@ +# ansible-playbook -i hosts.yml system-setup-unifi.yml +- name: System preperation + hosts: service_server + roles: + #- 00-ubuntu-basic + - 21-install-oitc + +- name: Unifi Setup + hosts: unifi + roles: + - 21-unifi \ No newline at end of file