Hi, Not at all! The values are the same indeed but my problem is exactly that ;-). What I want to achieve is this:
I've got a variable (krb_hostname) that gets dynamically build by concatenating text and the inventory_hostname. Since there are '-' in the hostname I'm substituting t(hem by '_'. That value of krb_hostname is a variable name that I define in a var file so I would like to evaluate the value of krb_hostname instead of presenting the value itself in order to have the final value GDC-CO-TEST01\$\@MSGREEN.DOM. Does that reasoning make any sense? Kind regards, Eric On Monday, December 15, 2014 4:41:30 PM UTC+1, Michael DeHaan wrote: > > Sorry for being dense, but these two values look the same to me: > > krb_gdc_co_test01 > krb_gdc_co_test01 > > What part of that is the incorrect part? > > Thanks! > > > > > > On Mon, Dec 15, 2014 at 10:39 AM, Eric Van Steenbergen <[email protected] > <javascript:>> wrote: >> >> Hello Michael, >> >> Thank you for your reply. That's the main issue I'm facing. The variable >> krb_hostname gets substituted by the value krb_gdc_co_test01 while I would >> like to see the value of that variable krb_gdc_co_test01 which I defined in >> the vars file. >> >> Kind regards, >> >> Eric >> >> On Monday, December 15, 2014 12:54:13 PM UTC+1, Michael DeHaan wrote: >>> >>> Hi, I'm a little confused by the above, in particular this part: >>> >>> stderr: kinit: Keytab contains no suitable keys for >>> [email protected] while getting initial credentials >>> >>> This looks like [email protected] is being substituted >>> where you have {{ krb_hostname }} correctly. >>> >>> Can you elaborate on where the problem is in your view? >>> >>> Thanks! >>> >>> On Sat, Dec 13, 2014 at 12:14 AM, Eric Van Steenbergen <[email protected] >>> > wrote: >>> >>>> Hi all, >>>> >>>> I'm having an issue with a variable not providing the value it should. >>>> I'm creating a variable name dynamically and save it in a variable. When >>>> calling that variable I get what's stored in it which makes sense but I >>>> want the value (variable name) substituted by its value which is stored in >>>> a file. >>>> >>>> I've got my problem solved partially. So I have: >>>> >>>> in my var file: >>>> >>>> >>>> krb_hostname: "krb_{{ inventory_hostname_short | regex_replace('-', >>>> '_') }}" >>>> >>>> krb_gdc_in1_nbapi01: GDC-IN1-NBAPI01\$\@MSGREEN.DOM >>>> krb_gdc_in1_nbcl01besv01: GDC-IN1-NBC1BV1\$\@MSGREEN.DOM >>>> krb_gdc_in1_nbmess01: GDC-IN1-NBMESS1\$\@MSGREEN.DOM >>>> krb_gdc_in1_nbife01: GDC-IN1-NBIFE01\$\@MSGREEN.DOM >>>> krb_gdc_in1_nbfeed01: GDC-IN1-NBFEED1\$\@MSGREEN.DOM >>>> krb_gdc_in1_nbfe01: GDC-IN1-NBFE01\$\@MSGREEN.DOM >>>> krb_gdc_in1_nbfe02: GDC-IN1-NBFE02\$\@MSGREEN.DOM >>>> krb_gdc_in1_nbvodb01: GDC-IN1-NBVODB1\$\@MSGREEN.DOM >>>> >>>> My task: >>>> >>>> - name: Run kinit -k with hostname from varfile (tag = kerberos) >>>> shell: kinit -k {{ krb_hostname }} >>>> tags: >>>> - integration >>>> >>>> But when I run it, the result is this: >>>> >>>> failed: [gdc-co-test01] => {"changed": true, "cmd": "kinit -k >>>> krb_gdc_co_test01", "delta": "0:00:00.011155", "end": "2014-12-12 >>>> 13:41:04.489263", "rc": 1, "start": "2014-12-12 13:41:04.478108"} >>>> stderr: kinit: Keytab contains no suitable keys for >>>> [email protected] while getting initial credentials >>>> >>>> So the variable gets created correctly but krb_hostname is not being >>>> substituted by the value of the generated variable, in the example >>>> krb_gdc_co_test01 which is a variable in my var file and holds >>>> GDC-CO-TEST01\$\@MSGREEN.COM <http://msgreen.com/> as value. >>>> >>>> Any help is greatly appreciated. >>>> >>>> Kind regards, >>>> >>>> Eric >>>> >>>> -- >>>> You received this message because you are subscribed to the Google >>>> Groups "Ansible Project" group. >>>> To unsubscribe from this group and stop receiving emails from it, send >>>> an email to [email protected]. >>>> To post to this group, send email to [email protected]. >>>> To view this discussion on the web visit https://groups.google.com/d/ >>>> msgid/ansible-project/beb7f33e-6741-4950-a0c2- >>>> c3b0f27cc1aa%40googlegroups.com >>>> <https://groups.google.com/d/msgid/ansible-project/beb7f33e-6741-4950-a0c2-c3b0f27cc1aa%40googlegroups.com?utm_medium=email&utm_source=footer> >>>> . >>>> For more options, visit https://groups.google.com/d/optout. >>>> >>> -- >> You received this message because you are subscribed to the Google Groups >> "Ansible Project" group. >> To unsubscribe from this group and stop receiving emails from it, send an >> email to [email protected] <javascript:>. >> To post to this group, send email to [email protected] >> <javascript:>. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/ansible-project/f11c7284-c35f-4fb5-a340-01bd41e67826%40googlegroups.com >> >> <https://groups.google.com/d/msgid/ansible-project/f11c7284-c35f-4fb5-a340-01bd41e67826%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > -- You received this message because you are subscribed to the Google Groups "Ansible Project" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/cbe02a20-98c3-4e19-bd05-b07fd8aeed2e%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.
