From 7570b9135b254e8797a17b540b1c6e69894421ed Mon Sep 17 00:00:00 2001 From: mwiegand Date: Sat, 19 Jun 2021 01:27:43 +0200 Subject: [PATCH] wip --- bundles/apt/items.py | 40 ++++++++++++++++++++++++++++++++++++ bundles/apt/metadata.py | 6 ++++++ bundles/dovecot/metadata.py | 1 - bundles/gcloud/items.py | 0 bundles/gcloud/metadata.py | 12 +++++++++++ data/apt/keys/gcloud.gpg | Bin 0 -> 2537 bytes groups/os/debian-10.py | 1 + groups/os/debian.py | 12 +++++++++++ nodes/htz.mails.py | 1 + 9 files changed, 72 insertions(+), 1 deletion(-) create mode 100644 bundles/apt/metadata.py create mode 100644 bundles/gcloud/items.py create mode 100644 bundles/gcloud/metadata.py create mode 100644 data/apt/keys/gcloud.gpg diff --git a/bundles/apt/items.py b/bundles/apt/items.py index df661a4..1d19c32 100644 --- a/bundles/apt/items.py +++ b/bundles/apt/items.py @@ -1,3 +1,21 @@ +from glob import glob +from os.path import join, basename + +directories = { + '/etc/apt/sources.list.d': { + 'purge': True, + 'triggers': { + 'action:apt_update', + }, + }, +} + +files = { + '/etc/apt/sources.list': { + 'content': '# managed' + }, +} + actions = { 'apt_update': { 'command': 'apt-get update', @@ -9,5 +27,27 @@ actions = { }, } +for name, content in node.metadata.get('apt/sources').items(): + files[f'/etc/apt/sources.list.d/{name}.list'] = { + 'content': content.format( + release=node.metadata.get('os_release') + ), + 'triggers': { + 'action:apt_update', + }, + } + + matches = glob(join(repo.path, 'data', 'apt', 'keys', f'{name}.*')) + if matches: + assert len(matches) == 1 + files[f'/etc/apt/trusted.gpg.d/{basename(matches[0])}'] = { + 'source': matches[0], + 'content_type': 'binary', + 'triggers': { + 'action:apt_update', + }, + } + + for package, options in node.metadata.get('apt/packages', {}).items(): pkg_apt[package] = options diff --git a/bundles/apt/metadata.py b/bundles/apt/metadata.py new file mode 100644 index 0000000..9919741 --- /dev/null +++ b/bundles/apt/metadata.py @@ -0,0 +1,6 @@ +defaults = { + 'apt': { + 'packages': {}, + 'sources': {}, + }, +} diff --git a/bundles/dovecot/metadata.py b/bundles/dovecot/metadata.py index 44be492..fb75bf5 100644 --- a/bundles/dovecot/metadata.py +++ b/bundles/dovecot/metadata.py @@ -24,5 +24,4 @@ defaults = { 'dbuser': 'mailserver', }, }, - } diff --git a/bundles/gcloud/items.py b/bundles/gcloud/items.py new file mode 100644 index 0000000..e69de29 diff --git a/bundles/gcloud/metadata.py b/bundles/gcloud/metadata.py new file mode 100644 index 0000000..80a08a2 --- /dev/null +++ b/bundles/gcloud/metadata.py @@ -0,0 +1,12 @@ +defaults = { + 'apt': { + 'packages': { + 'apt-transport-https': {}, + 'ca-certificates': {}, + 'gnupg': {}, + }, + 'sources': { + 'gcloud': 'deb https://packages.cloud.google.com/apt cloud-sdk main', + }, + }, +} diff --git a/data/apt/keys/gcloud.gpg b/data/apt/keys/gcloud.gpg new file mode 100644 index 0000000000000000000000000000000000000000..3f0b5a850ba73c4b6d7fe5b206030ee9d0b4da46 GIT binary patch literal 2537 zcmajfc{mj69tZFtYb6Ywv1ebZVJuB(aK<`@5*dapjltLl&DfcP9E`}sG{~;3VJfmD zVak?WwAd1|j4j&@rK{6@o_kOCKF|H<{p0t(fBc^B`+Yv`Ef?9Y>G0XHZ~{`Sx~!T!dveZitA&#vuaeY1DI5>;d|o*d4Lp%{Zqwntwi(+p z&Bu6qBYHxkM)FlF1?NBexq_|FI7ZMRv{MlQfEd*#I?S2~-S?+DRbCJj{x0&zaHoZQ z@XaU&J8W*5{FcKo43vWU4Q!jZW?C$j#Cni=E&V2IAI@Oiq;9Kw&NOJ%(OSBnBrU$X z=14XJdhj?r=p0b}R#OU_@|^`VEqP>`34ZLlyHAxPSo3e(9U6k5dJlF&d^A%%f{gE^`-@y{a6B3mlz$$u#o%;ymD4kW91po+l z;{rT1#VSq7Iw*T{#`DM4<>BIFZ2wHUlknyiqNAb7aNx);hMZ^Dv1wr_Utf{2C<$@n zkIiR35y`vYkSzBnB6-)b!D}YqOMT75_}G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