Hi Jerry,
Did you reloaded the local facts in your tasks before trying to use the
facts.
- local_action: setup filter=ansible_local
Regards,
Vikas
On Thursday, 8 October 2015 08:56:10 UTC+11, Jerry Steele wrote:
>
> Hello,
>
>
> Ansible_version: 1.9.2 stable
>
> I have a custom fact, generated via bash:
>
> #!/bin/bash
> MYSQL_PW=$(cat /etc/psa/.psa.shadow)
>
> cat << EOF
> {
> "pw":"$MYSQL_PW"
> }
> EOF
>
> When I run this on the command line, it gives the expected output:
>
> {
> "pw":"$AES-128-xxxx$xxxxxxxxxxxxxxxxxxx$xxxxxxxxxxxxxxxxxxx"
> }
>
> (note: the above is obfuscated)
>
> However when I use the setup module, the value of "pw" is empty:
>
> "ansible_local": {
> "mysql": {
> "pw": ""
> }
> }
>
> ,
>
> I tested this by catting another file, and this gave the expected string
> when ran standalone and via the setup module:
> ......
> MYSQL_PW=$(cat /usr/local/psa/version)
> .....
>
>
>
> gives
>
> "ansible_local": {
> "mysql": {
> "pw": "12.0.18 Ubuntu 14.04 1200150817.13"
> }
> }
>
> which is what we expect. I think the error is due to the presence of "$"
> in the output of the first fact-generating script, but I'm not sure how to
> get round this.
>
>
> Does anyone have any ideas?
>
--
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/408ce20a-26ee-493f-a582-6250cf6f9e4e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.