$ ansible -i hosts \* -m debug -a 'msg="${greeting}"' won't work...

martin f krafft madduck at madduck.net
Sat Jan 30 21:06:05 CET 2016


also sprach frank.stuppy at erv.de <frank.stuppy at erv.de> [2016-01-29 20:46 +1100]:
> ../reclass/examples/ansible> ansible -i hosts \* -m debug -a 'msg="${greeting}"'
> blue.example.org | SUCCESS => {
>     "msg": "${greeting}"
> }

Indeed, this isn't going to work. The ${…} style parameter expansion
*only* works within the reclass database. By the time Ansible sees
the reclass data, all such parameters will have been expanded.

> But when command is: ansible -i hosts \* -m debug -a 'msg="{{ greeting }}"'
> white.example.org | FAILED! => {
>     "failed": true,
>     "msg": "ERROR! 'greeting' is undefined"
> }

This on the other hand /should/ really work, but I honestly won't be
surprised if it does not. As I've said multiple times before,
Ansible is quite hackish in many places, and especially its usage of
templating is very inconsistent.

Have you tried accessing the variable from within a template in
a playbook? If that does not work, then there's a real problem,
possibly with reclass. But if that works, then the best you can do
is either accept that it doesn't work with the debug module, or take
this on with the Ansible community.

-- 
@martinkrafft | http://madduck.net/ | http://two.sentenc.es/
 
eleventh law of acoustics:
  in a minimum-phase system there is an inextricable link between
  frequency response, phase response and transient response, as they
  are all merely transforms of one another. this combined with
  minimalization of open-loop errors in output amplifiers and correct
  compensation for non-linear passive crossover network loading can
  lead to a significant decrease in system resolution lost. however,
  of course, this all means jack when you listen to pink floyd.
 
spamtraps: madduck.bogus at madduck.net
-------------- next part --------------
A non-text attachment was scrubbed...
Name: digital_signature_gpg.asc
Type: application/pgp-signature
Size: 1107 bytes
Desc: Digital signature (see http://martin-krafft.net/gpg/sig-policy/999bbcc4/current)
URL: <http://lists.pantsfullofunix.net/pipermail/reclass/attachments/20160131/83cc1deb/attachment.sig>


More information about the reclass mailing list