aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2019-11-06 16:29:08 +0200
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2019-11-06 16:29:39 +0200
commit5646fbdc7947f62eb0c7b1faff967688d23f0a5c (patch)
treeb9a396585d3c9d8182c061bb859210b8813d0762
parent1e442e585b76abb5e2b8343d4b37eb501aee3db2 (diff)
downloadaports-5646fbdc7947f62eb0c7b1faff967688d23f0a5c.tar.bz2
aports-5646fbdc7947f62eb0c7b1faff967688d23f0a5c.tar.xz
main/ansible: lbu module
-rw-r--r--main/ansible/0001-new-module-lbu.patch151
-rw-r--r--main/ansible/APKBUILD6
2 files changed, 155 insertions, 2 deletions
diff --git a/main/ansible/0001-new-module-lbu.patch b/main/ansible/0001-new-module-lbu.patch
new file mode 100644
index 0000000000..9953946e4e
--- /dev/null
+++ b/main/ansible/0001-new-module-lbu.patch
@@ -0,0 +1,151 @@
+From a419a9539ddff10fa4d3fd7460b117a9f4dd2691 Mon Sep 17 00:00:00 2001
+From: Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
+Date: Thu, 19 Sep 2019 10:58:07 +0300
+Subject: [PATCH] new module: lbu
+
+Alpine Linux Local Backup Utility
+---
+ lib/ansible/modules/system/lbu.py | 131 ++++++++++++++++++++++++++++++
+ 1 file changed, 131 insertions(+)
+ create mode 100644 lib/ansible/modules/system/lbu.py
+
+diff --git a/lib/ansible/modules/system/lbu.py b/lib/ansible/modules/system/lbu.py
+new file mode 100644
+index 0000000000..9952ec29f1
+--- /dev/null
++++ b/lib/ansible/modules/system/lbu.py
+@@ -0,0 +1,131 @@
++#!/usr/bin/python
++
++# Copyright: (c) 2019, Kaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>
++# GNU General Public License v3.0+ (see COPYING or https://www.gnu.org/licenses/gpl-3.0.txt)
++
++from __future__ import absolute_import, division, print_function
++__metaclass__ = type
++
++ANSIBLE_METADATA = {
++ 'metadata_version': '1.1',
++ 'status': ['preview'],
++ 'supported_by': 'community'
++}
++
++DOCUMENTATION = '''
++---
++module: lbu
++
++short_description: Local Backup Utility for Alpine Linux
++
++version_added: "2.10"
++
++description:
++- Manage Local Backup Utility of Alpine Linux in run-from-RAM mode
++
++options:
++ commit:
++ description:
++ - Control whether to commit changed files.
++ type: bool
++ exclude:
++ description:
++ - List of paths to exclude.
++ type: list
++ include:
++ description:
++ - List of paths to include.
++ type: list
++
++author:
++- Kaarle Ritvanen (@kunkku)
++'''
++
++EXAMPLES = '''
++# Commit changed files (if any)
++- name: Commit
++ lbu:
++ commit: true
++
++# Exclude path and commit
++- name: Exclude directory
++ lbu:
++ commit: true
++ exclude:
++ - /etc/opt
++
++# Include paths without committing
++- name: Include file and directory
++ lbu:
++ include:
++ - /root/.ssh/authorized_keys
++ - /var/lib/misc
++'''
++
++RETURN = '''
++msg:
++ description: Error message
++ type: str
++ returned: on failure
++'''
++
++from ansible.module_utils.basic import AnsibleModule
++
++import os.path
++
++
++def run_module():
++ module = AnsibleModule(
++ argument_spec={
++ 'commit': {'type': 'bool'},
++ 'exclude': {'type': 'list', 'elements': 'str'},
++ 'include': {'type': 'list', 'elements': 'str'}
++ },
++ supports_check_mode=True
++ )
++
++ changed = False
++
++ def run_lbu(*args):
++ code, stdout, stderr = module.run_command(
++ [module.get_bin_path('lbu', required=True)] + list(args)
++ )
++ if code:
++ module.fail_json(changed=changed, msg=stderr)
++ return stdout
++
++ update = False
++ commit = False
++
++ for param in ('include', 'exclude'):
++ if module.params[param]:
++ paths = run_lbu(param, '-l').split('\n')
++ for path in module.params[param]:
++ if os.path.normpath('/' + path)[1:] not in paths:
++ update = True
++
++ if module.params['commit']:
++ commit = update or run_lbu('status') > ''
++
++ if module.check_mode:
++ module.exit_json(changed=update or commit)
++
++ if update:
++ for param in ('include', 'exclude'):
++ if module.params[param]:
++ run_lbu(param, *module.params[param])
++ changed = True
++
++ if commit:
++ run_lbu('commit')
++ changed = True
++
++ module.exit_json(changed=changed)
++
++
++def main():
++ run_module()
++
++
++if __name__ == '__main__':
++ main()
+--
+2.20.1
+
diff --git a/main/ansible/APKBUILD b/main/ansible/APKBUILD
index 8bd0110972..7780e44cab 100644
--- a/main/ansible/APKBUILD
+++ b/main/ansible/APKBUILD
@@ -4,7 +4,7 @@
# Maintainer: Fabian Affolter <fabian@affolter-engineering.ch>
pkgname=ansible
pkgver=2.8.6
-pkgrel=2
+pkgrel=3
pkgdesc="A configuration-management, deployment, task-execution, and multinode orchestration framework"
url="https://ansible.com/"
arch="noarch"
@@ -14,6 +14,7 @@ makedepends="python3-dev py3-setuptools"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://releases.ansible.com/ansible/ansible-$pkgver.tar.gz
add-lxc-container_shell-option.patch
+ 0001-new-module-lbu.patch
"
# secfixes:
@@ -53,4 +54,5 @@ package() {
}
sha512sums="8e29644b4651e72bd3fbd4ca91c2a36b76e5dde9bb445d3c6e0061c315eb66e1bc507729b70d82998c1cbb25f3ef0e20d281ab8354a047193e60bf4831938418 ansible-2.8.6.tar.gz
-f44f1492495abe092cd9f91669ccfee65748f43663571361de97c3b1c5c1219d355aa7236179decb73446376018fa81aace7eaeb8c10a83d3cf4e006508533dd add-lxc-container_shell-option.patch"
+f44f1492495abe092cd9f91669ccfee65748f43663571361de97c3b1c5c1219d355aa7236179decb73446376018fa81aace7eaeb8c10a83d3cf4e006508533dd add-lxc-container_shell-option.patch
+d6aa6827acee61d857444a00364f9b057a216a0a6f5217f353e8b8e0118db7aee54b7578a3fb31cb43bfa8e0709db8d43dcdb819eb28a457a692359887dad115 0001-new-module-lbu.patch"