1

my cloud-init file looks like this I want to append random 1-byte hexa

#cloud-config
runcmd:
  - [ sudo, ip, link, set, dev, enp1s0, address, f4:f2:c7:f3:f4:"$(openssl rand -hex 1)" ]

no issue if i set static 6 bytes hexa like below

  - [ sudo, ip, link, set, dev, enp1s0, address, f4:f2:c7:f3:f4:c6 ]
hghew
  • 311
  • 2
  • 4
  • 15

1 Answers1

2

runcmd doesn't require every argument to be in a list.

Something like this should work:

#cloud-config
runcmd:
  - sudo ip link set dev enp1s0 address f4:f2:c7:f3:f4:"$(openssl rand -hex 1)"
falcojr
  • 1,299
  • 1
  • 10
  • 18