From 0590ce065ce51c208bce863365fa981cd931ce93 Mon Sep 17 00:00:00 2001 From: Brian Coca Date: Wed, 13 Jul 2022 16:47:43 -0400 Subject: [PATCH] example showing how to deal with keys w/o apt_key (#78206) --- lib/ansible/modules/apt_key.py | 12 ++++++++++++ lib/ansible/modules/apt_repository.py | 12 ++++++++++++ 2 files changed, 24 insertions(+) diff --git a/lib/ansible/modules/apt_key.py b/lib/ansible/modules/apt_key.py index 974e7bf91f7..4c4c3efb852 100644 --- a/lib/ansible/modules/apt_key.py +++ b/lib/ansible/modules/apt_key.py @@ -81,6 +81,18 @@ options: ''' EXAMPLES = ''' +- name: One way to avoid apt_key once it is removed from your distro + block: + - name: somerepo |no apt key + ansible.builtin.get_url: + url: https://download.example.com/linux/ubuntu/gpg + dest: /etc/apt/trusted.gpg.d/somerepo.asc + + - name: somerepo | apt source + ansible.builtin.apt_repository: + repo: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/somerepo.asc] https://download.example.com/linux/ubuntu {{ ansible_distribution_release }} stable" + state: present + - name: Add an apt key by id from a keyserver ansible.builtin.apt_key: keyserver: keyserver.ubuntu.com diff --git a/lib/ansible/modules/apt_repository.py b/lib/ansible/modules/apt_repository.py index 3454c90fd9c..42d4df81d13 100644 --- a/lib/ansible/modules/apt_repository.py +++ b/lib/ansible/modules/apt_repository.py @@ -131,6 +131,18 @@ EXAMPLES = ''' ansible.builtin.apt_repository: repo: 'ppa:nginx/stable' codename: trusty + +- name: One way to avoid apt_key once it is removed from your distro + block: + - name: somerepo |no apt key + ansible.builtin.get_url: + url: https://download.example.com/linux/ubuntu/gpg + dest: /etc/apt/trusted.gpg.d/somerepo.asc + + - name: somerepo | apt source + ansible.builtin.apt_repository: + repo: "deb [arch=amd64 signed-by=/etc/apt/trusted.gpg.d/somerepo.asc] https://download.example.com/linux/ubuntu {{ ansible_distribution_release }} stable" + state: present ''' RETURN = '''#'''