I wrote a custom fact which sits on a server and pulls out an array of 
supervisord programs:

#!/usr/bin/env python2.7

import os
import sys
import json

# Config to read
supervisord_config = '/etc/supervisord.conf';

# Define the main function
def main():
  file_object = open(supervisord_config, 'r');

  program_list = [];

  for line in file_object:
    if "programs" not in line:
      if "program:" in line:
        programs =  line.split(":")[1];
        programs =  programs.split("]")[0];
        program_list.append(programs);

  print json.dumps(program_list);

# Run the main function
if os.path.exists(supervisord_config):
  main()
else:
  sys.exit(1)

Running the setup module against the server, to be able to access the 
facts, this the above returns:

"ansible_local": {
            "supervisord_default": [
                "imageprocess",
                "replaceimage",
                "mobile_imageprocess",
                "mobile_replaceimage"
            ],
        },

That is correct and i can manipulate the output within tasks and templates 
perfectly, however i require one template to utilise facts from other 
servers and so i wanted to utilise the fact_caching functionality, however 
the above fact doesnt appear to be stored properly in the cache:

"supervisord_default": {},

That is all that the cache has..

How can i get it so that the cache has the correct data?





-- 
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/f67b6d28-204b-4e13-b829-60115951f8eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to