Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

@KellerFuchs
Last active September 26, 2017 17:46
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save KellerFuchs/6bcca085f232c155f687ecae413831eb to your computer and use it in GitHub Desktop.
Save KellerFuchs/6bcca085f232c155f687ecae413831eb to your computer and use it in GitHub Desktop.
Installing apt repos and keys and packages
# -*- eval: (ansible) -*-
- apt_repository:
filename: "{{ item }}"
repo: "{{ packages[item].repo | mandatory }}"
update_cache: no
notify: apt update
- apt_key:
keyring: "{{ item }}.gpg"
id: "{{ packages[item].key.id | mandatory }}"
url: "{{ packages[item].key.url }}"
when: packages[item].key.url is defined
notify: apt update
- apt_key:
keyring: "{{ item }}.gpg"
id: "{{ packages[item].key.id | mandatory }}"
keyserver: "{{ packages[item].key.keyserver | default('keys.gnupg.net') }}"
when: packages[item].key.url is not defined
notify: apt update
# -*- eval: (ansible) -*-
- hosts: localhost
become: True
tasks:
- include_vars:
name: packages
dir: .
files_matching: "packages_.*\.yml"
- include: apt.yml
with_items: "{{ packages.keys() }}"
# Force the 'apt update' handler to run now (if necessary at all)
- meta: flush_handlers
- apt:
name: "{{ item }}"
state: latest
with_items: "{{ packages.keys() | map('extract', packages, 'packages') | sum(start=[]) }}"
handlers:
- name: apt update
apt: update_cache=yes
cura:
repo: deb http://download.alephobjects.com/ao/aodeb {{ ansible_distribution_release }} main
key:
id: 0xDABF50135F6F1293ED0F60270EB44AD9A71B242A
url: http://download.alephobjects.com/ao/aodeb/aokey.pub
packages: [ cura ]
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment