1
0
Fork 0
mirror of https://github.com/ansible-collections/community.general.git synced 2024-09-14 20:13:21 +02:00

Add docs for ansible-core 2.13 use (#4202) (#4586)

* Add docs for ansible-core 2.13 use

local testing shows fine, adding here as example for other filters/tests

* Update plugins/filter/random_mac.py

* Improve docs.

* Remove wrong 'positional'.

Co-authored-by: Felix Fontein <felix@fontein.de>
(cherry picked from commit e62a56e15c)

Co-authored-by: Brian Coca <bcoca@users.noreply.github.com>
This commit is contained in:
patchback[bot] 2022-04-28 07:45:16 +02:00 committed by GitHub
parent 348d2c26de
commit 020fa081d7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,6 +20,35 @@
from __future__ import (absolute_import, division, print_function) from __future__ import (absolute_import, division, print_function)
__metaclass__ = type __metaclass__ = type
DOCUMENTATION = '''
name: random_mac
short_description: Generate a random MAC address
description:
- Generates random networking interfaces MAC addresses for a given prefix.
options:
_input:
description: A string prefix to use as a basis for the random MAC generated.
type: string
required: true
seed:
description:
- A randomization seed to initialize the process, used to get repeatable results.
- If no seed is provided, a system random source such as C(/dev/urandom) is used.
required: false
type: string
'''
EXAMPLES = '''
- name: Random MAC given a prefix
debug:
msg: "{{ '52:54:00' | community.general.random_mac }}"
# => '52:54:00:ef:1c:03'
- name: With a seed
debug:
msg: "{{ '52:54:00' | community.general.random_mac(seed=inventory_hostname) }}"
'''
import re import re
from random import Random, SystemRandom from random import Random, SystemRandom