Is there a way to make my var less ugly?

So I created some tasks in one of my roles today that queries Jenkins to find the latest build of a project and then uses that build number to go get a zip file onto one of my managed servers.

The relevant part of my tasks/main.yml looks like this:

It works fine (thank you whoever created uri: module) but I’d like to assign a single variable name, say {{latestBuildNumber}}, rather than the {{jenkins_response.json.lastSuccessfulBuild.number}} which is a bit of a mouthful.

Maybe I’m thinking in programming mode and this is just the way it has to be, but I have the feeling I’ve been at the screen too long and I’m missing something obvious.

Jenkins can return a bunch of useful information about builds actually, so it would be nice to grab > 1 thing and assign it a more meaningful name that doesn’t directly reference the structure of the json response.

Many thanks,

Jon

You can use the set_fact module for that.

Thanks, just what I needed.