'Getting a value in a variable from a command output and using using that variable in next command in ansible

ok: [localhost] => {
    "command_output.stdout_lines": [
        "Enter SYS, SYSTEM and PDB Admin user password: ",
        "Retype SYS, SYSTEM and PDB Admin user password: ",
        "{",
        "  \"jobId\" : \"17d14f12-4403-48f6-a0fe-00d645af86a9\",",
        "  \"status\" : \"Created\",",
        "  \"message\" : null,",
        "  \"reports\" : [ ],",
        "  \"createTimestamp\" : \"February 02, 2022 12:08:00 PM UTC\",",
        "  \"resourceList\" : [ ],",
        "  \"description\" : \"Database service creation with db name: AkashDB4\",",
        "  \"updatedTime\" : \"February 02, 2022 12:08:00 PM UTC\"",
        "}"
    ]
}

How do I get the value of jobId into a variable in ansible ?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source