Add filter to turn a string into a UUID

This filter was made because I needed to create idempotent UUIDs when
installing the agent for Go (http://go.cd), which uses UUIds to
distinguish the agents from each other.

It uses a newly created Ansible namespace to distinguish UUIDs created
by Ansible from any other source. The new namespace is a random one
created by uuidgen on OSX.
This commit is contained in:
Björn Andersson 2015-01-21 06:09:22 +08:00
parent 2a04663255
commit 65e4f2b2bc
3 changed files with 18 additions and 0 deletions

View file

@ -131,6 +131,11 @@ class TestFilters(unittest.TestCase):
'a\\1')
assert a == 'ansible'
def test_to_uuid(self):
a = ansible.runner.filter_plugins.core.to_uuid('example.com')
assert a == 'ae780c3a-a3ab-53c2-bfb4-098da300b3fe'
#def test_filters(self):
# this test is pretty low level using a playbook, hence I am disabling it for now -- MPD.