Exemplo n.º 1
0
    def playbook_on_stats(self, stats):
        if not self.out_vars:
            return

        result = dict()

        all_vars = self.var_manager._nonpersistent_fact_cache

        for fact in self.out_vars:
            fact_by_host = dict()
            for host, vars in all_vars.items():
                if fact in vars:
                    fact_by_host[host] = vars[fact]
            result[fact] = fact_by_host

        if '_stats' in self.out_vars:
            result['_stats'] = ConcordAnsibleStats.build_stats_data(stats)

        target_file = open(self.out_vars_file_name, "w")
        target_file.write(json.dumps(result, indent=2))
        print "Variables saved to:", self.out_vars_file_name
Exemplo n.º 2
0
 def playbook_on_stats(self, stats):
     self.log(ConcordAnsibleStats.build_stats_data(stats))