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)

* 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>
This commit is contained in:
Brian Coca 2022-04-27 17:13:05 -04:00 committed by GitHub
parent 378b20ac32
commit e62a56e15c
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)
__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
from random import Random, SystemRandom