Vendor Galaxy Roles and Collections
This commit is contained in:
parent
c1e1897cda
commit
2aed20393f
6 changed files with 387444 additions and 2 deletions
|
|
@ -0,0 +1,19 @@
|
|||
debops.apt_listchanges - Manage apt-listchanges using Ansible
|
||||
|
||||
Copyright (C) 2016 Maciej Delmanowski <drybjed@gmail.com>
|
||||
Copyright (C) 2016 DebOps <https://debops.org/>
|
||||
SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
This Ansible role is part of DebOps.
|
||||
|
||||
DebOps is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License version 3, as
|
||||
published by the Free Software Foundation.
|
||||
|
||||
DebOps is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||
GNU General Public License for more details.
|
||||
|
||||
You should have received a copy of the GNU General Public License
|
||||
along with DebOps. If not, see https://www.gnu.org/licenses/.
|
||||
|
|
@ -0,0 +1,136 @@
|
|||
---
|
||||
# .. vim: foldmarker=[[[,]]]:foldmethod=marker
|
||||
|
||||
# .. Copyright (C) 2016 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# .. Copyright (C) 2016 DebOps <https://debops.org/>
|
||||
# .. SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
# .. _apt_listchanges__ref_defaults:
|
||||
|
||||
# debops.apt_listchanges default variables [[[
|
||||
# ============================================
|
||||
|
||||
# .. contents:: Sections
|
||||
# :local:
|
||||
#
|
||||
# .. include:: ../../../../includes/global.rst
|
||||
|
||||
|
||||
# APT package and installation [[[
|
||||
# --------------------------------
|
||||
|
||||
# .. envvar:: apt_listchanges__deploy_state [[[
|
||||
#
|
||||
# Specify if the :command:`apt-listchanges` package should be installed (``present``)
|
||||
# or not installed (``absent``). All specified packages will be purged if the
|
||||
# role is disabled using this variable.
|
||||
apt_listchanges__deploy_state: 'present'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: apt_listchanges__base_packages [[[
|
||||
#
|
||||
# List of APT packages to install.
|
||||
apt_listchanges__base_packages: [ 'apt-listchanges' ]
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: apt_listchanges__packages [[[
|
||||
#
|
||||
# List of additional APT packages to install with :command:`apt-listpackages`.
|
||||
apt_listchanges__packages: []
|
||||
# ]]]
|
||||
# ]]]
|
||||
# Main configuration options [[[
|
||||
# ------------------------------
|
||||
|
||||
# .. envvar:: apt_listchanges__mail_to [[[
|
||||
#
|
||||
# List of e-mail accounts to which messages from :command:`apt-listchanges` will be
|
||||
# sent.
|
||||
apt_listchanges__mail_to: '{{ ansible_local.core.admin_private_email | d(["root"]) }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: apt_listchanges__apt_frontend [[[
|
||||
#
|
||||
# Specify which :command:`apt-listchanges` frontend to use when the script is executed
|
||||
# by APT operations. By default the frontend is ``mail`` unless ``apticron`` is
|
||||
# detected in which case the APT frontend is disabled, since ``apticron`` will
|
||||
# send virtually the same e-mails anyway.
|
||||
#
|
||||
# See :command:`apt-listchanges(1)` for list of available frontends.
|
||||
apt_listchanges__apt_frontend: '{{ "none"
|
||||
if (ansible_local | d() and ansible_local.apticron | d() and
|
||||
ansible_local.apticron.enabled | bool)
|
||||
else (ansible_local.apt_listchanges.apt.frontend
|
||||
if (ansible_local.apt_listchanges.apt | d() and
|
||||
ansible_local.apt_listchanges.apt.frontend | d())
|
||||
else "mail") }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: apt_listchanges__apt_which [[[
|
||||
#
|
||||
# Specify what information should be sent when the script is run by APT
|
||||
# operations. Choices: ``news``, ``changelogs``, ``both``. By default only
|
||||
# important NEWS items will be sent.
|
||||
apt_listchanges__apt_which: 'news'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: apt_listchanges__apticron_frontend [[[
|
||||
#
|
||||
# Specify what frontend to use when the script is executed by ``apticron``. See
|
||||
# :command:`apt-listchanges(1)` for information about available frontends.
|
||||
apt_listchanges__apticron_frontend: 'mail'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: apt_listchanges__apticron_which [[[
|
||||
#
|
||||
# Specify what information should be sent when the script is run by
|
||||
# ``apticron``. Choices: ``news``, ``changelogs``, ``both``.
|
||||
apt_listchanges__apticron_which: 'both'
|
||||
# ]]]
|
||||
# ]]]
|
||||
# Configuration profiles [[[
|
||||
# --------------------------
|
||||
|
||||
# .. envvar:: apt_listchanges__profiles [[[
|
||||
#
|
||||
# YAML dictionary with information about :command:`apt-listchanges` profiles which
|
||||
# should be configured. Each value should be a YAML dictionary with key: value
|
||||
# pairs which define the configuration options. See :command:`apt-listchanges(1)` for
|
||||
# information about what options can be configured in a profile.
|
||||
apt_listchanges__profiles:
|
||||
'cmdline': '{{ apt_listchanges__profile_cmdline }}'
|
||||
'apt': '{{ apt_listchanges__profile_apt }}'
|
||||
'apticron': '{{ apt_listchanges__profile_apticron }}'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: apt_listchanges__profile_cmdline [[[
|
||||
#
|
||||
# Profile used when :command:`apt-listchanges` is run from the command line, according
|
||||
# th the manual.
|
||||
apt_listchanges__profile_cmdline:
|
||||
frontend: 'pager'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: apt_listchanges__profile_apt [[[
|
||||
#
|
||||
# Profile used when :command:`apt-listchanges` is executed during APT operations.
|
||||
apt_listchanges__profile_apt:
|
||||
frontend: '{{ apt_listchanges__apt_frontend }}'
|
||||
email_address: '{{ apt_listchanges__mail_to | join(",") }}'
|
||||
confirm: '0'
|
||||
which: '{{ apt_listchanges__apt_which }}'
|
||||
save_seen: '/var/lib/apt/listchanges.db'
|
||||
|
||||
# ]]]
|
||||
# .. envvar:: apt_listchanges__profile_apticron [[[
|
||||
#
|
||||
# Profile used when :command:`apt-listchanges` is run by ``apticron``.
|
||||
apt_listchanges__profile_apticron:
|
||||
frontend: '{{ apt_listchanges__apticron_frontend }}'
|
||||
email_address: '{{ apt_listchanges__mail_to | join(",") }}'
|
||||
confirm: '0'
|
||||
which: '{{ apt_listchanges__apticron_which }}'
|
||||
save_seen: '/var/lib/apt/listchanges.db'
|
||||
# ]]]
|
||||
# ]]]
|
||||
# ]]]
|
||||
|
|
@ -0,0 +1,32 @@
|
|||
---
|
||||
# Copyright (C) 2016 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# Copyright (C) 2016-2022 DebOps <https://debops.org/>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
# Ensure that custom Ansible plugins and modules included in the main DebOps
|
||||
# collection are available to roles in other collections.
|
||||
collections: [ 'debops.debops' ]
|
||||
|
||||
dependencies: []
|
||||
|
||||
galaxy_info:
|
||||
|
||||
author: 'Maciej Delmanowski'
|
||||
description: 'Manage apt-listchanges service'
|
||||
company: 'DebOps'
|
||||
license: 'GPL-3.0-only'
|
||||
min_ansible_version: '2.0.0'
|
||||
|
||||
platforms:
|
||||
|
||||
- name: 'Ubuntu'
|
||||
versions: [ 'all' ]
|
||||
|
||||
- name: 'Debian'
|
||||
versions: [ 'all' ]
|
||||
|
||||
galaxy_tags:
|
||||
- apt
|
||||
- changelog
|
||||
- news
|
||||
- debian
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
# Copyright (C) 2016 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# Copyright (C) 2016 DebOps <https://debops.org/>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
- name: Manage APT packages
|
||||
ansible.builtin.package:
|
||||
name: '{{ q("flattened", (apt_listchanges__base_packages
|
||||
+ apt_listchanges__packages)) }}'
|
||||
state: '{{ apt_listchanges__deploy_state }}'
|
||||
purge: True
|
||||
register: apt_listchanges__register_packages
|
||||
until: apt_listchanges__register_packages is succeeded
|
||||
|
||||
- name: Configure apt-listchanges
|
||||
ansible.builtin.template:
|
||||
src: 'etc/apt/listchanges.conf.j2'
|
||||
dest: '/etc/apt/listchanges.conf'
|
||||
owner: 'root'
|
||||
group: 'root'
|
||||
mode: '0644'
|
||||
when: apt_listchanges__deploy_state == 'present'
|
||||
|
||||
- name: Make sure that Ansible fact directory exists
|
||||
ansible.builtin.file:
|
||||
path: '/etc/ansible/facts.d'
|
||||
state: 'directory'
|
||||
owner: 'root'
|
||||
group: 'root'
|
||||
mode: '0755'
|
||||
|
||||
- name: Save apt-listchanges facts
|
||||
ansible.builtin.template:
|
||||
src: 'etc/ansible/facts.d/apt_listchanges.fact.j2'
|
||||
dest: '/etc/ansible/facts.d/apt_listchanges.fact'
|
||||
owner: 'root'
|
||||
group: 'root'
|
||||
mode: '0755'
|
||||
tags: [ 'meta::facts' ]
|
||||
|
|
@ -0,0 +1,40 @@
|
|||
#!{{ ansible_python['executable'] }}
|
||||
# -*- coding: utf-8 -*-
|
||||
|
||||
# Copyright (C) 2016 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# Copyright (C) 2016 DebOps <https://debops.org/>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
|
||||
# {{ ansible_managed }}
|
||||
|
||||
from __future__ import print_function
|
||||
from json import dumps
|
||||
from sys import exit
|
||||
from os import path
|
||||
|
||||
try:
|
||||
from configparser import ConfigParser
|
||||
except ImportError:
|
||||
from ConfigParser import ConfigParser
|
||||
|
||||
conf_file = '/etc/apt/listchanges.conf'
|
||||
output = {"installed": True}
|
||||
|
||||
if path.isfile(conf_file):
|
||||
config = ConfigParser()
|
||||
config.read(conf_file)
|
||||
|
||||
for section in config.sections():
|
||||
output[section] = {}
|
||||
|
||||
for name, value in config.items(section):
|
||||
output[section][name] = [x.strip() for x in value.split() if x]
|
||||
if len(output[section][name]) == 1:
|
||||
output[section][name] = output[section][name][0]
|
||||
elif len(output[section][name]) == 0:
|
||||
output[section][name] = ''
|
||||
|
||||
else:
|
||||
output = {"installed": False}
|
||||
|
||||
print(dumps(output, sort_keys=True, indent=4))
|
||||
|
|
@ -0,0 +1,13 @@
|
|||
{# Copyright (C) 2016 Maciej Delmanowski <drybjed@gmail.com>
|
||||
# Copyright (C) 2016 DebOps <https://debops.org/>
|
||||
# SPDX-License-Identifier: GPL-3.0-only
|
||||
#}
|
||||
# {{ ansible_managed }}
|
||||
|
||||
{% for name, profile in apt_listchanges__profiles | dictsort %}
|
||||
[{{ name }}]
|
||||
{% for key, value in profile | dictsort %}
|
||||
{{ key }} = {{ value }}
|
||||
{% endfor %}
|
||||
|
||||
{% endfor %}
|
||||
Loading…
Reference in a new issue