How to read ansible debug output as a variable in Json file .. example belowansible print debug msg variableI am trying to use vars_prompt but when i run the playbook it directly gives me prompt and ask for the value, it doesn't checks in inventory fileAnsible JSON OutputPrint Ansible debug output without quotes/escapesAnsible parsing a JSON outputHow to filter the content of Powershell script output?How to set tasks by variable in AnsibleAnsible how to get output as variable without brackets and uHow can I replace a template file in an Ansible role?How to debug below o/p in ansible
I drew a randomly colored grid of points with tikz, how do I force it to remember the first grid from then on?
What is the name of this hexagon/pentagon polyhedron?
Missing Piece of Pie - Can you find it?
I'm in your subnets, golfing your code
What to use instead of cling film to wrap pastry
What is the most remote airport from the center of the city it supposedly serves?
How wide is a neg symbol, how to get the width for alignment?
Would Hubble Space Telescope improve black hole image observed by EHT if it joined array of telesopes?
What matters more when it comes to book covers? Is it ‘professional quality’ or relevancy?
Why wasn't the Night King naked in S08E03?
What is the difference between 'unconcealed' and 'revealed'?
Does a card have a keyword if it has the same effect as said keyword?
Is this homebrew life-stealing melee cantrip unbalanced?
Shantae Dance Matching
How to convert a MULTIPOLYGON field stored as text to geometry data type in postGIS so that it can be plotted in QGIS
Is latino sine flexione dead?
How do LIGO and VIRGO know that a gravitational wave has its origin in a neutron star or a black hole?
A mathematically illogical argument in the derivation of Hamilton's equation in Goldstein
Upside-Down Pyramid Addition...REVERSED!
How can I close a gap between my fence and my neighbor's that's on his side of the property line?
Randomness of Python's random
How long would it take for people to notice a mass disappearance?
Why are prions in animal diets not destroyed by the digestive system?
Which module had more 'comfort' in terms of living space, the Lunar Module or the Command module?
How to read ansible debug output as a variable in Json file .. example below
ansible print debug msg variableI am trying to use vars_prompt but when i run the playbook it directly gives me prompt and ask for the value, it doesn't checks in inventory fileAnsible JSON OutputPrint Ansible debug output without quotes/escapesAnsible parsing a JSON outputHow to filter the content of Powershell script output?How to set tasks by variable in AnsibleAnsible how to get output as variable without brackets and uHow can I replace a template file in an Ansible role?How to debug below o/p in ansible
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty height:90px;width:728px;box-sizing:border-box;
This is my debug output ..
register: create
- debug:
msg: " create.json.info.0.value "
ok: [localhost] =>
"msg": "8308a020-5c9d-4936-8f1a-40f408d3a085"
Now I need to add the output as an input to JSON template. Below is my template...
"networkDomainId": "create.json.info.0.value"
"name": "Sandy_Smoke_VLAN",
"description": "For hosting our Smokeping_test Cloud Servers"
"privateIpv4NetworkAddress": "10.10.0.0"
"privateIpv4PrefixSize": 24
"attachedVlan": "gatewayAddressing": "HIGH"
But the above template is not working.
ansible ansible-playbook ansible-galaxy
add a comment |
This is my debug output ..
register: create
- debug:
msg: " create.json.info.0.value "
ok: [localhost] =>
"msg": "8308a020-5c9d-4936-8f1a-40f408d3a085"
Now I need to add the output as an input to JSON template. Below is my template...
"networkDomainId": "create.json.info.0.value"
"name": "Sandy_Smoke_VLAN",
"description": "For hosting our Smokeping_test Cloud Servers"
"privateIpv4NetworkAddress": "10.10.0.0"
"privateIpv4PrefixSize": 24
"attachedVlan": "gatewayAddressing": "HIGH"
But the above template is not working.
ansible ansible-playbook ansible-galaxy
1
If the example below does not work for you post the error.
– Vladimir Botka
Apr 26 at 9:24
add a comment |
This is my debug output ..
register: create
- debug:
msg: " create.json.info.0.value "
ok: [localhost] =>
"msg": "8308a020-5c9d-4936-8f1a-40f408d3a085"
Now I need to add the output as an input to JSON template. Below is my template...
"networkDomainId": "create.json.info.0.value"
"name": "Sandy_Smoke_VLAN",
"description": "For hosting our Smokeping_test Cloud Servers"
"privateIpv4NetworkAddress": "10.10.0.0"
"privateIpv4PrefixSize": 24
"attachedVlan": "gatewayAddressing": "HIGH"
But the above template is not working.
ansible ansible-playbook ansible-galaxy
This is my debug output ..
register: create
- debug:
msg: " create.json.info.0.value "
ok: [localhost] =>
"msg": "8308a020-5c9d-4936-8f1a-40f408d3a085"
Now I need to add the output as an input to JSON template. Below is my template...
"networkDomainId": "create.json.info.0.value"
"name": "Sandy_Smoke_VLAN",
"description": "For hosting our Smokeping_test Cloud Servers"
"privateIpv4NetworkAddress": "10.10.0.0"
"privateIpv4PrefixSize": 24
"attachedVlan": "gatewayAddressing": "HIGH"
But the above template is not working.
ansible ansible-playbook ansible-galaxy
ansible ansible-playbook ansible-galaxy
edited Apr 25 at 4:03
Eduardo Baitello
17910
17910
asked Apr 24 at 4:10
Sandeep C HSandeep C H
61
61
1
If the example below does not work for you post the error.
– Vladimir Botka
Apr 26 at 9:24
add a comment |
1
If the example below does not work for you post the error.
– Vladimir Botka
Apr 26 at 9:24
1
1
If the example below does not work for you post the error.
– Vladimir Botka
Apr 26 at 9:24
If the example below does not work for you post the error.
– Vladimir Botka
Apr 26 at 9:24
add a comment |
1 Answer
1
active
oldest
votes
An example is below. The play
- hosts: localhost
vars:
create:
json:
info:
- key: 'key_1', value: '8308a020-5c9d-4936-8f1a-40f408d3a085'
tasks:
- debug:
msg: " create.json.info.0.value "
- template:
src: test.j2
dest: /scratch/tmp/test
with the template test.j2
> cat test.j2
"networkDomainId": "create.json.info.0.value"
gives
PLAY [localhost]
TASK [debug]
ok: [localhost] =>
"msg": "8308a020-5c9d-4936-8f1a-40f408d3a085"
TASK [template]
changed: [localhost]
PLAY RECAP
localhost : ok=2 changed=1 unreachable=0 failed=0
> cat /scratch/tmp/test
"networkDomainId": "8308a020-5c9d-4936-8f1a-40f408d3a085"
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "2"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f964338%2fhow-to-read-ansible-debug-output-as-a-variable-in-json-file-example-below%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
An example is below. The play
- hosts: localhost
vars:
create:
json:
info:
- key: 'key_1', value: '8308a020-5c9d-4936-8f1a-40f408d3a085'
tasks:
- debug:
msg: " create.json.info.0.value "
- template:
src: test.j2
dest: /scratch/tmp/test
with the template test.j2
> cat test.j2
"networkDomainId": "create.json.info.0.value"
gives
PLAY [localhost]
TASK [debug]
ok: [localhost] =>
"msg": "8308a020-5c9d-4936-8f1a-40f408d3a085"
TASK [template]
changed: [localhost]
PLAY RECAP
localhost : ok=2 changed=1 unreachable=0 failed=0
> cat /scratch/tmp/test
"networkDomainId": "8308a020-5c9d-4936-8f1a-40f408d3a085"
add a comment |
An example is below. The play
- hosts: localhost
vars:
create:
json:
info:
- key: 'key_1', value: '8308a020-5c9d-4936-8f1a-40f408d3a085'
tasks:
- debug:
msg: " create.json.info.0.value "
- template:
src: test.j2
dest: /scratch/tmp/test
with the template test.j2
> cat test.j2
"networkDomainId": "create.json.info.0.value"
gives
PLAY [localhost]
TASK [debug]
ok: [localhost] =>
"msg": "8308a020-5c9d-4936-8f1a-40f408d3a085"
TASK [template]
changed: [localhost]
PLAY RECAP
localhost : ok=2 changed=1 unreachable=0 failed=0
> cat /scratch/tmp/test
"networkDomainId": "8308a020-5c9d-4936-8f1a-40f408d3a085"
add a comment |
An example is below. The play
- hosts: localhost
vars:
create:
json:
info:
- key: 'key_1', value: '8308a020-5c9d-4936-8f1a-40f408d3a085'
tasks:
- debug:
msg: " create.json.info.0.value "
- template:
src: test.j2
dest: /scratch/tmp/test
with the template test.j2
> cat test.j2
"networkDomainId": "create.json.info.0.value"
gives
PLAY [localhost]
TASK [debug]
ok: [localhost] =>
"msg": "8308a020-5c9d-4936-8f1a-40f408d3a085"
TASK [template]
changed: [localhost]
PLAY RECAP
localhost : ok=2 changed=1 unreachable=0 failed=0
> cat /scratch/tmp/test
"networkDomainId": "8308a020-5c9d-4936-8f1a-40f408d3a085"
An example is below. The play
- hosts: localhost
vars:
create:
json:
info:
- key: 'key_1', value: '8308a020-5c9d-4936-8f1a-40f408d3a085'
tasks:
- debug:
msg: " create.json.info.0.value "
- template:
src: test.j2
dest: /scratch/tmp/test
with the template test.j2
> cat test.j2
"networkDomainId": "create.json.info.0.value"
gives
PLAY [localhost]
TASK [debug]
ok: [localhost] =>
"msg": "8308a020-5c9d-4936-8f1a-40f408d3a085"
TASK [template]
changed: [localhost]
PLAY RECAP
localhost : ok=2 changed=1 unreachable=0 failed=0
> cat /scratch/tmp/test
"networkDomainId": "8308a020-5c9d-4936-8f1a-40f408d3a085"
answered Apr 26 at 9:23
Vladimir BotkaVladimir Botka
700212
700212
add a comment |
add a comment |
Thanks for contributing an answer to Server Fault!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fserverfault.com%2fquestions%2f964338%2fhow-to-read-ansible-debug-output-as-a-variable-in-json-file-example-below%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
1
If the example below does not work for you post the error.
– Vladimir Botka
Apr 26 at 9:24