community / community.general / 6.6.8 / filter / random_mac Generate a random MAC address Authors: unknowncommunity.general.random_mac (6.6.8) — filter
Install with ansible-galaxy collection install community.general:==6.6.8
collections: - name: community.general version: 6.6.8
Generates random networking interfaces MAC addresses for a given prefix.
- name: Random MAC given a prefix ansible.builtin.debug: msg: "{{ '52:54:00' | community.general.random_mac }}"
# => '52:54:00:ef:1c:03' - name: With a seed ansible.builtin.debug: msg: "{{ '52:54:00' | community.general.random_mac(seed=inventory_hostname) }}"
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 _input: description: A string prefix to use as a basis for the random MAC generated. required: true type: string
_value: description: The generated MAC. type: string