On Sat, 7 Jul 2012 20:56:45 -0600, Thomas S Hatch wrote:
> /etc/uuidfile:
> file.managed:
> - source: salt://somefile
> - template: jinja
> - uuid: {{salt['cmd.run']('python2 -c 'import uuid; print
> uuid.uuid5(uuid.NAMESPACE_DNS, ' + grains['server-id'] + 'service')}}
>
> Or at least get you closer, since I have not tested this
thanks again for the snippet. i forgot to post my solution after
fiddling around with the quoting and escaping escape-hell and want to
supply you with that, finally.
the following is my working real-world example. 'libvirt-network-config'
is the service tag.
@thomas: i guess it's not possible to define another variable inside
that resource-definition, prior to uuid and reference that inside the
uuid-definition?
/etc/libvirt/qemu/networks/virt.xml:
file.managed:
- source:
salt://ubuntu-virt-server/files/etc/libvirt/qemu/networks/virt.xml
- template: jinja
- uuid: {{ salt['cmd.run']('python2 -c \'import uuid; print
uuid.uuid5(uuid.NAMESPACE_DNS, ' + ' "' + grains['id'] +
'libvirt-network-config' + '")\'') }}
- makedirs: True
salt://ubuntu-virt-server/files/etc/libvirt/qemu/networks/virt.xml looks
like this:
<network>
<name>virt</name>
<uuid>{{ uuid }}</uuid>
<forward dev='eth0' mode='nat'/>
<bridge name='virt' stp='on' delay='0' />
<domain name='
virt.mediapeers.com'/>
<ip address='172.16.0.1' netmask='255.255.255.0'>
</ip>
</network>
cheers
pille