From cceeb8ee66636ba59a9827cf9dca0b55983b6838 Mon Sep 17 00:00:00 2001 From: Vladimir Blando Date: Tue, 30 Jun 2020 21:37:43 +0800 Subject: [PATCH] added task to add custom repo Change-Id: I0b7e0da2621ee94d26af3802551f8f48b80666b8 --- defaults/main.yml | 8 ++++++++ tasks/main.yml | 18 ++++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/defaults/main.yml b/defaults/main.yml index c1da392..3d8e025 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -15,3 +15,11 @@ base_server_groups: [] base_server_users: [] +base_server_apt_keys: + - id: "1586E327" + url: "http://repo.vexxhost.net/key.gpg" + state: "present" +base_server_apt_repositories: + - filename: "vexxhost" + url: "deb http://repo.vexxhost.net/ buster main" + state: "present" diff --git a/tasks/main.yml b/tasks/main.yml index eab0385..6903dbc 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -36,3 +36,21 @@ state: "{{ item.state | default(omit) }}" become: true with_items: "{{ base_server_users }}" + +- name: Import APT keys + apt_key: + id: "{{ item.id }}" + url: "{{ item.url }}" + state: "{{ item.state | default(omit) }}" + become: true + when: ansible_os_family == "Debian" + loop: "{{ base_server_apt_keys }}" + +- name: Add APT repositories + apt_repository: + repo: "{{ item.url }}" + filename: "{{ item.filename }}" + state: "{{ item.state | default(omit) }}" + become: true + when: ansible_os_family == "Debian" + with_items: "{{ base_server_apt_repositories }}"