unixadm.common

common plugins and filters

Repository

https://git.unixadm.org/phil/ansible-collection-common

Plugins

module

dnf_module - enable or disable a dnf module

Synopsis

enables or disables a given dnf module

Parameters
Parameter Choices/Defaults Description
name
(str)
required
the module name
profiles
(str)
the module's profiles
state
(str)
present
absent
enabled (present) or disabled (absent)
stream
(str)
the module's version stream

dnf_versionlock - sets or removes a dnf versionlock

Synopsis

this module sets or removes a dnf versionlock

Parameters
Parameter Choices/Defaults Description
name
(str)
required
package name(s)
state
(str)
present
absent
set ("present)" or remove ("absent") a versionlock
version
(str)
force locked version to given string (V-R or E:V-R)
Examples
---
- name: "set versionlock to currently installed version"
  unixadm.common.dnf_versionlock:
    name: bash

- name: "set versionlock to a specific version"
  unixadm.common.dnf_versionlock:
    name: bash
    version: 4.2.46-34.el7

- name: "remove versionlocks"
  unixadm.common.dnf_versionlock:
    name:
      - bash
      - tcsh
      - zsh
    state: absent

findcerts - search directories for certificates and keys

Synopsis

This module searches given directories for certificate and key files and returns the certificate data as well as the corresponding key file path.

Parameters
Parameter Choices/Defaults Description
cert_path
(path)
['/etc/pki/tls/certs'] directory/directories to look for certificate files
key_path
(path)
['/etc/pki/tls/private'] directory/directories to look for key files
skip_combined
(bool)
True ignore combined certificate/key files
skip_expired
(bool)
True ignore expired certificates
skip_invalid_chain
(bool)
True ignore certificate files containing invalid chain
subject
(str)
filter by subject
Examples
---
- name: "get all valid certificates for this host"
  unixadm.common.findcerts:
    subject: '{{ansible_fqdn}}'
    skip_combined: false
  register: t_certs
Return values
Key Returned Description
certs
(list)
Success list of dicts of matching certificates

genksfloppy - build a floppy image containing a kickstart file

Synopsis

This module builds a floppy image containing the kickstart file

Parameters
Parameter Choices/Defaults Description
ks
(str)
the kickstart as a text
ks_file
(path)
the path to a file that should be used as kickstart
path
(path)
required
the path where the floppy image will be generated

iproute - add or delete routes

Synopsis

This module adds or removes ip routes

Parameters
Parameter Choices/Defaults Description
gateway
(str)
the gateway for reaching the network
interface
(str)
required
the interface name
network
(str)
required
the network to route
can be specified as 'address' (for routing a single address) or either as 'network/prefix' or as 'network/netmask'.
state
(str)
present
absent
add/remove route
Examples
- name: "add interface route with gateway"
  unixadm.common.iproute:
    interface: eth1
    network: '172.16.255.0/24'
    gateway: '192.168.1.1'

- name: "remove interface route"
  unixadm.common.iproute:
    interface: eth1
    network: '172.16.128.0/24'
    state: absent

kill - send signal to process or get process' pid

Synopsis

send signal to a process or a pid or get the pid of a process

Parameters
Parameter Choices/Defaults Description
full
(bool)
False match pattern against full command line
pattern
(str)
pattern of the process name, must not be used together with pid=
pid
(int)
pid of the process, must not be used together with name=
signal
(str)
signal to send to the process (signal names are allowed)
Examples
---
- name: "send sigterm to smokeping.fcgi"
  unixadm.common.kill:
    pattern: smokeping.fcgi
    signal: term
Return values
Key Returned Description
pids
(list)
Success list of pids

network_manager - generate network-mnager config from dict

Synopsis

This module generates the network-manager config from a given dict. Please note that all slave devices (bond, bridge, ..) are set to "autoconnect false". Use "autoconnect-slaves 1" to automatically start the slave devices together with the master device.

Parameters
Parameter Choices/Defaults Description
apply
(bool)
False apply changes by reloading NetworkManager and restarting the connections
config
(dict)
required
Config dict with the interface name as key.
Keys starting with an underscore are ignored.
The interface name decides the network device type, e.g.
+ starting with 'br' or 'rawbr' is a bridge
+ starting with 'bond' is a bond
+ starting with 'sit' is a sit (simple internet transition) tunnel
+ starting with 'gre' is a gre tunnel
+ starting with 'ipip' is an ipip tunnel
+ starting with 'wg' is a wireguard interface
+ starting with 'lo_' is a virtual (dummy) interface
+ containing a dot is a vlan interface
+ eth, enp.. whatever is an ethernet interface
The dict's value is the interface configuration
+ ipv4 - dict
+ + address - list of address/prefix tuples or 'auto'
+ + gateway - gateway address
+ + route - host- or interface routes
+ + etc., see nm-config(5) for more options
+ ipv6 - dict
+ + address - list of address/prefix tuples or 'auto' or 'ignore'
+ + gateway - gateway address
+ + route - host- or interface routes
+ + privacy - boolean, enable privacy extensions
+ + etc., see nm-config(5) for more options
+ mac - mac address, defaults to mac address taken from ansible facts
+ rewrite_mac - rewrite this interface's mac address to this value
+ onboot - boolean, start interface on boot
+ interfaces - list of slave interfaces (bond and bridge only)
+ ethtool - ethtool options (ethernet only)
+ etc., see nm-config(5) for more options
path
(path)
/etc/NetworkManager/system-connections path to the NetworkManager connection files
Examples
- name: "generate network config"
  unixadm.common.network_manager:
    config:
      eth0:
        name: 'dialup'
        ipv4:
          address: ['auto']
          ignore_auto_dns: false
        ipv6:
          address: ['auto']
          privacy: true
          ignore_auto_dns: false
          _this_key_is_ignored: foo
        mac: '00:11:22:33:44:55'
        rewrite_mac: '00:22:44:66:88:aa'
        ethtool:
          ring_rx: 4096
          ring_tx: 4096
      bond0:
        ipv4:
          address:
            - '10.0.0.1/24'
          route:
            - '10.1.3.0/24;10.0.0.254'
        ipv6:
          address:
            - 'fc00::1/64'
            - 'fc00::2'
            - 'fc00::3'
        interfaces:
          - eth1
          - eth2
        mode: 4
        lacp_rate: 1
        miimon: 100
        xmit_hash_policy: 2
      br0:
        ipv4:
          address: ['10.1.0.1/24']
        interfaces:
          - eth3
          - eth4
      lo_:mysub:
        ipv4:
          address: ['10.2.0.1/32']
      bond1:
        interfaces:
          - eth4
          - eth5
      br1:
        interfaces:
          - bond1
      br1.1337:
        ipv4:
          address: ['10.3.0.1/24']
          dad_timeout: 200
      sit1:
        ipv6:
          address: ['fc01::1/64']
          remote: '192.0.2.1'
      wg0:
        ipv4:
          address: ['10.4.0.1/30']
        ipv6:
          address: ['fc04::1/64']
        listen_port: 12345
        privatekey: '6N7Sm8oWwWMNO6KS4bX95Ew/PAuI3mnjwzG0Ii7d9m0='
        peers:
          'gQBdyfAPzI+YTG6jXh9N130JHQcVY68OjphlpvNKD1E=':
            endpoint: '10.100.1.2:12345'
            psk: 'Iy+0sqf8ZksfG1TRwsOKAlcYdtc7DZZtGDVHyyv1tao='
            persistent_keepalive: 30
            allowed_ips:
              - '10.4.0.2/32'
              - 'fc04::/64'
    apply: true

network_route - add or delete interface routes

Synopsis

This module manages interface routes for network-script-based systems.

Parameters
Parameter Choices/Defaults Description
apply
(bool)
True apply route changes
deprecated as of version 0.2.13, will be removed with 0.3.0.
please use 'unixadm.common.iproute' instead.
gateway
(str)
the gateway for reaching the network
interface
(str)
required
the interface name
network
(str)
required
the network to route
can be specified as 'address' (for routing a single address) or either as 'network/prefix' or as 'network/netmask'.
state
(str)
present
absent
add/remove route
Examples
- name: "add interface route"
  unixadm.common.network_route:
    interface: eth1
    network: '172.16.255.0/24'
    gateway: '192.168.1.1'

- name: "remove interface route but do not apply changes"
  unixadm.common.network_route:
    interface: eth1
    network: '172.16.255.0/24'
    gateway: '192.168.1.1'
    apply: false
    state: absent

network_scripts - generate network-scripts from dict

Synopsis

this module generates the network-scripts config from a given dict

Parameters
Parameter Choices/Defaults Description
compatibility
(str)
NetworkManager
network-scripts
network manager compatibility
config
(dict)
required
config dict with the interface name as key.
The interface name decides the network device type, e.g
+ starting with 'br' or 'rawbr' is a bridge
+ starting with 'bond' is a bond
+ starting with 'sit' is a sit (simple internet transition) tunnel
+ starting with 'wg' is a wireguard interface
+ containing a dot is a vlan interface
+ containing a colon is a virtual interface
+ eth, enp.. whatever is an ethernet interface
the dict's value is the interface configuration
+ name - nickname, defaults to the interface name
+ ipv4 - address/prefix or list of addresses/prefixes or 'dhcp'
+ ipv6 - address/prefix or 'dhcpv6' or 'auto' for router advertisement
+ ipv6_privacy - boolean, enable privacy extensions
+ ipv6_pd - boolean, use prefix delegation
+ ipv6_secondaries - list of secondary ipv6 addresses
+ gateway - the interface's default ipv4 gateway
+ gateway6 - the interface's default ipv6 gateway
+ mac - mac address, defaults to mac address taken from ansible facts
+ rewrite_mac - rewrite this interface's mac address to this value
+ onboot - boolean, start interface on boot
+ peerdns - enable or disable peer dns (dhcp/dhcpv6 only)
+ slaves - list of slave interfaces (bond only)
+ bonding_opts - bonding options, defaults to "mode=0" (bond only)
+ interfaces - list of bridge members (bridge only)
+ ethtool_opts - ethtool options (ethernet only)
+ arpcheck - boolean, check using arping if ip address is already taken
+ peer - tunnel peer address (sit only)
+ scope - address scope (ethernet only)
Examples
- name: "generate network config"
  unixadm.common.network_scripts:
    config:
      'eth0':
        name: 'dialup'
        ipv4: 'dhcp'
        ipv6: 'dhcpv6'
        ipv6_privacy: true
        ipv6_pd: true
        peerdns: false
        mac: '00:11:22:33:44:55'
        rewrite_mac: '00:22:44:66:88:aa'
      'bond0':
        ipv4: '10.0.0.1/24'
        ipv6: 'fc00::1/64'
        ipv6_secondaries:
          - 'fc00::2'
          - 'fc00::3'
        slaves:
          - eth1
          - eth2
      'br0':
        ipv4:
          - '10.1.0.1/24'
          - '10.1.0.11/24'
        interfaces:
          - eth3
          - eth4
      'lo:mysub':
        ipv4: '10.2.0.1/32'
      'bond1':
        slaves:
          - eth4
          - eth5
      'br1':
        slaves:
          - bond1
      'br1.1337':
        ipv4: '10.3.0.1/24'
        arpcheck: false
      'sit1':
        ipv6: 'fc01::1/64'
        peer: '192.0.2.1'
      'wg0':
        ipv4: '10.4.0.1/30'
        ipv6: 'fc04::1/64'
        listen_port: 12345
        privatekey: '6N7Sm8oWwWMNO6KS4bX95Ew/PAuI3mnjwzG0Ii7d9m0='
        psk: 'Iy+0sqf8ZksfG1TRwsOKAlcYdtc7DZZtGDVHyyv1tao='
        peer: 'gQBdyfAPzI+YTG6jXh9N130JHQcVY68OjphlpvNKD1E='
        peer_endpoint: '10.100.1.2:12345'
        keepalive: 30
        allowed_ips:
          - '10.4.0.2/32'
          - 'fc04::/64'

  register: t_network_config

- name: "restart network"
  service: name=network state=restarted
  when: t_network_config is changed

sasldb - manipulate a sasldb

Synopsis

This module adds, updates or deletes sasl users

Parameters
Parameter Choices/Defaults Description
format
(str)
bdb
gdbm
database format
name
(str)
required
username to be added or removed
password
(str)
the user's password
path
(str)
/etc/sasl2/sasldb2 filename of the database
realm
(str)
the host's fqdn realm
state
(str)
present
absent
add/update (present) or remove (absent) user
Examples
- name: "add user to /etc/sasldb2 with a given realm"
  unixadm.common.sasldb:
    name: myusername
    password: "supersecretpassword"
    realm: '{{inventory_hostname}}'
    owner: cyrus
    group: mail
    mode: 0640

- name: "remove user from /path/to/sasldb"
  unixadm.common.sasldb:
    path: /path/to/sasldb
    name: myusername
    state: absent

subguid - Add/modify/remove user/group to/in/from /etc/subuid or /etc/subgid

Synopsis

This module adds, modifies or removes a user or a group to, in or from /etc/subuid or /etc/subgid.

Parameters
Parameter Choices/Defaults Description
count
(int)
amount of uids/gids to reserve
name
(str)
required
user or group name
operate_on
(str)
subuid
subgid
operate on either /etc/subuid or /etc/subgid
state
(str)
present
absent
add/modify (present) or remove (absent) user or group
Examples
- name: "add joe with 1024 uids to /etc/subuid"
  unixadm.common.subguid:
    name: joe
    operate_on: subuid
    count: 1024

- name: "remove john from /etc/subgid"
  unixadm.common.subguid:
    name: john
    operate_on: subgid
    state: absent

swap - activates or deactivates a swap device

Synopsis

This module activates or deactivates a swap device

Parameters
Parameter Choices/Defaults Description
dev
(str)
required
device name
state
(str)
present
absent
status
enable (present) or disable (absent) swap or show (status) swap state

sysfsctl - get or set sysfs values

Synopsis

This module gets or sets values from/to sysfs

Parameters
Parameter Choices/Defaults Description
key
(str)
required
sysfs key to operate on
state
(str)
get
set
read (get) or write (set) value
value
(str)
value to set sysfs key to
Return values
Key Returned Description
value
(str)
Success current value

yum_config_manager - enable/disable yum/dnf repositories

Synopsis

this module disables or enables yum/dnf repositories

Parameters
Parameter Choices/Defaults Description
name
(str)
required
name(s) of the repositor(y ies)
state
(str)
present
absent
disable ("absent") or enable ("present") given repositor(y ies)

yum_versionlock - sets or removes a yum versionlock

Synopsis

this module sets or removes a yum versionlock

Parameters
Parameter Choices/Defaults Description
name
(str)
required
package name(s)
state
(str)
present
absent
set ("present)" or remove ("absent") a versionlock
version
(str)
force locked version to given string (V-R or E:V-R)
Examples
---
- name: "set versionlock to currently installed version"
  unixadm.common.yum_versionlock:
    name: bash

- name: "set versionlock to a specific version"
  unixadm.common.yum_versionlock:
    name: bash
    version: 4.2.46-34.el7

- name: "remove versionlocks"
  unixadm.common.yum_versionlock:
    name:
      - bash
      - tcsh
      - zsh
    state: absent

filter

aes_crypt - aes encrypt a string

Synopsis

Returns an aes256/cfb encrypted string to a given plaintext and secret key.

Parameters
Parameter Choices/Defaults Description
_input
(str)
required
The to be encrypted string.
_key
(str)
required
The key to encrypt the string with.
format
(str)
base64
hex
Output format of the encrypted data.
iv
(str)
The initialization vector, useful to produce idempotent results.
Examples
foo: '{{ "hello" | unixadm.common.aes_crypt("world", iv=("whee"|to_uuid)[:16]) }}'

=> "ZTFkZjRkYTUtNDIzMC01N4HhgMzC"

bar: '{{ "hello" | unixadm.common.aes_crypt("world", format="hex") }}'

=> "4d6969b4cbae4374d40e0da1822bf7b68fe77f7b25" # with a random iv
Return values
Key Returned Description
_value
(str)
Success The encrypted string.

aes_decrypt - decrypt an aes encrypted string

Synopsis

Decrypts an aes128/192/256 encrypted string and returns the plain text.

Parameters
Parameter Choices/Defaults Description
_input
(str)
required
The encrypted string.
_key
(str)
required
The key to decrypt the string with.
Examples
foo: '{{ "ZTFkZjRkYTUtNDIzMC01N4HhgMzC" | unixadm.common.aes_decrypt("world") }}'

=> "hello"

bar: '{{ "4d6969b4cbae4374d40e0da1822bf7b68fe77f7b25" | unixadm.common.aes_decrypt("world") }}'

=> "hello"
Return values
Key Returned Description
_value
(string)
Success The decrypted string.

bcrypt_hash - return a bcrypt hash of a string

Synopsis

Returns a bcrypt hash of a given string. Optionally, a salt, a prefix and the logarithmic work factor (number of rounds) can be specified.

Parameters
Parameter Choices/Defaults Description
_input
(str)
required
The to be hashed string.
prefix
(str)
2b Salt prefix is no salt is specified.
rounds
(int)
12 Rounds for salt generation.
salt
(str)
Salt for the hash algorithm.
Examples
foo: '{{ "input" | unixadm.common.bcrypt_hash(salt="$2a$12$0Y6OWlmF3jPiXgQCDkuLo.") }}'

=> "$2a$12$0Y6OWlmF3jPiXgQCDkuLo.wFWkDOwgwagBGwGApklYMgLBae0fLH"
Return values
Key Returned Description
_value
(str)
Success The hash.

delete_keys - delete keys from dict

Synopsis

Removes a set of keys from a dict.

Parameters
Parameter Choices/Defaults Description
_input
(dict)
required
The dictionary.
_keys
(str)
required
Key or list of keys to delete.
Examples
foo: '{{ {"foo": "bar", "baz": "yatta"} | unixadm.common.delete_keys("baz") }}'

=>  { "foo". "bar" }

fuh: '{{ {"foo": "bar", "baz": "yatta"} | unixadm.common.delete_keys(["foo", "baz"]) }}'

=>  { }
Return values
Key Returned Description
_value
(dict)
Success The resulting dict.

dict - Merge list to dict

Synopsis

Merges a list of two elements to a key/value pair.

Parameters
Parameter Choices/Defaults Description
_input
(list)
required
The list containing exactly two elements.
Examples
foo: '{{["foo", "bar"|unixadm.common.dict}}'

=> {"bar": "baz"}
Return values
Key Returned Description
_value
(list)
Success The list with all elements suffixed with the given string.

from_ini - parse ini-string

Synopsis

Parses a given string in ini-format into a dict.

Parameters
Parameter Choices/Defaults Description
_dicts
(list)
Additional arguments that are recognised by configparser.
_input
(str)
required
The input string in ini-format.
Examples
foo: '{{ "[yatta]\nbar = baz" | unixadm.common.from_ini }}'

=> { "yatta": { "bar": "baz" } }
Return values
Key Returned Description
_value
(dict)
Success The parsed dict.

get_keys_by_value - return keys based on a value

Synopsis

Get keys from a given dict depending on their value.

Parameters
Parameter Choices/Defaults Description
_input
(dict)
required
The input dictionary.
_values
(list)
required
The values to search for.
Examples
foo: '{{ {"foo": "bar", "baz": "yatta", "zonk": "bar"} | unixadm.common.get_keys_by_value("bar") }}'

=> [ "foo", "zonk" ]
Return values
Key Returned Description
_value
(list)
Success The resulting keys.

math - Perform simple arithmetic operations

Synopsis

Performs simple arithmetic operations on a given input.

Parameters
Parameter Choices/Defaults Description
_input
(int)
required
Int or float to perform operation on.
_modifier
(int)
required
Modifier, int or float.
_operation
(str)
required
+
-
*
/
Operation to perform.
Examples
result: '{{ 49 | unixadm.common.math("/", 7) }}'

=> 7.0
Return values
Key Returned Description
_value
(int)
Success The result as float or int.

math - Perform simple arithmetic operations

Synopsis

Performs simple arithmetic operations on a given input.

Parameters
Parameter Choices/Defaults Description
_input
(int)
required
Int or float to perform operation on.
_modifier
(int)
required
Modifier, int or float.
_operation
(str)
required
+
-
*
/
Operation to perform.
Examples
result: '{{ 49 | unixadm.common.math("/", 7) }}'

=> 7.0
Return values
Key Returned Description
_value
(int)
Success The result as float or int.

multimap - extract multiple keys dict

Synopsis

Extracts multiple keys from a given dict. Intented to use as 'map(attribute=key)' pendant but with multiple keys.

Parameters
Parameter Choices/Defaults Description
_input
(dict)
required
The input dictionary.
_keys
(list)
required
List of keys to extract.
Examples
foo: '{{
  q("filetree", "/path/to/somewhere") |
  selectattr("state", "equalto", "file") |
  unixadm.common.multimap(["src", "path"])
}}'

=> [ { "path": "foobar", "src": "/path/to/somewhere/foobar" }, ... ]
Return values
Key Returned Description
_value
(list)
Success The resulting list.

prefix - prepend list elements with a given string

Synopsis

Prepends each element of a list with a given string.

Parameters
Parameter Choices/Defaults Description
_input
(list)
required
The list of strings.
_prefix
(str)
required
The prefix.
Examples
foo: '{{ [ "foo", "bar", "baz" ] | unixadm.common.prefix("my_") }}'

=> [ "my_foo", "my_bar", "my_baz" ]
Return values
Key Returned Description
_value
(list)
Success The list with all elements prefixed with the given string.

suffix - append string to list elements

Synopsis

Appends a given string to each element of a list.

Parameters
Parameter Choices/Defaults Description
_input
(list)
required
The list of strings.
_suffix
(str)
required
The suffix.
Examples
foo: '{{ [ "foo", "bar", "baz" ] | unixadm.common.suffix("_yay") }}'

=> [ "foo_yay", "bar_yay", "baz_yay" ]
Return values
Key Returned Description
_value
(list)
Success The list with all elements suffixed with the given string.

lookup

first_exists - return first file or directory found

Synopsis

Returns the first file or directory found

Parameters
Parameter Choices/Defaults Description
_terms
(list)
required
list of paths to examine
Examples
---
- name: "copy either contents of directoryA or directoryB to dest"
  copy:
    src: '{{lookup("unixadm.common.first_exists",
      ["/tmp/directoryA", "/tmp/directoryB"]
    )}}'
    dest: /usr/local/share/foo/
    recursive: true
...
Return values
Key Returned Description
_raw
(str)
Success path to item

stat - return the file's or directory's stat

Synopsis

Returns the file's or directory's stats

Parameters
Parameter Choices/Defaults Description
_terms
(path)
required
path
Examples
---
- name: "get file size"
  debug:
    msg: '{{myfilestats.st_size}}'
  vars:
    myfilestats: '{{lookup("unixadm.common.stat", "/foo/bar")}}'
...
Return values
Key Returned Description
_raw
(str)
Success stat dict

version - return this collection's version

Synopsis

Returns this collection's version

Examples
---
- assert:
    that: "lookup('unixadm.common.version') is version_compare('0.0.1', '>=')"
Return values
Key Returned Description
_raw
(str)
Success version string

inventory

debug_groups - show groups with their prio and depth

Synopsis

show groups with their prio and depth

Parameters
Parameter Choices/Defaults Description
plugin
(str)
required
debug_groups
unixadm.common.debug_groups
Name of the plugin
Examples
---
plugin: 'unixadm.common.debug_groups'
...

virtual_groups - group hosts by pattern

Synopsis

group hosts by pattern

Parameters
Parameter Choices/Defaults Description
children
(dict)
dict of groups with corresponding children group patterns
deprecated as of version 0.2.5, will be removed with 0.3.0
groupofgroups
(dict)
dict of groups with corresponding children group patterns, priorities
and depths
groups
(dict)
dict of groups with corresponding host patterns
plugin
(str)
required
virtual_groups
unixadm.common.virtual_groups
Name of the plugin
Examples
---
plugin: 'unixadm.common.virtual_groups'
groups:
  mywebservers:
    - '^web\d+\.'
  mydbservers:
    - '^mysql\d+\.'
    - '^pgsql\d+\.'
  myserverclass_$1_$2:
    - '^server(foo|bar|baz)\.([a-z]{3})\.domain\.example$'
groupofgroups:
  myservers:
    patterns:
      - '^mywebservers$'
      - '^mydbservers$'
    prio: 10
...

test

pair_eq - checks if elements of pair are equal

Synopsis

Check if the provided pair has equal elements

Parameters
Parameter Choices/Defaults Description
_input
(list)
A list with two elements
Examples
pair_match: '{{["foo", "foo"]|select("unixadm.common.pair_eq")}}'
pair_nomatch: '{{["foo", "bar"]|select("unixadm.common.pair_eq")}}'
Return values
Key Returned Description
_value
(bool)
Success Returns True if the both elements of the given list are equal, c(False) if otherwise.

pair_in - checks if elements of pair match

Synopsis

Check if the provided pair's elements are a subset of each other

Parameters
Parameter Choices/Defaults Description
_input
(list)
A list with two elements
Examples
pair_match: '{{["foobar", "foo"]|select("unixadm.common.pair_in")}}'
pair_nomatch: '{{["foo", "bar"]|select("unixadm.common.pair_in")}}'
Return values
Key Returned Description
_value
(bool)
Success Returns True if the one element of the given list is a subset of the other, c(False) if otherwise.

Authors

  • Philippe Kueck <projects at unixadm dot org>

Licenses

GPL-2.0-only