Hi,

I am working on some tasks related with local facts and not sure whether 
followig issue is a bug or is designed.
Following ansible documentation localfacts can be in JSON or INI format. 
I've choosen JSON format - is much more easier to write variables like this:

module:
  name: "apache"
  version: "1.0.4"
  status: "Installed"

Saving this with following task brings result:
- name: Write variable to json file
  copy: content="{{ module }}" dest=/etc/ansible/facts.d/{{ module.name 
}}.fact 
        owner=root group=root mode=0644

Result:
{'status': 'Installed', 'version': '1.0.4', 'name': 'apache'}

However python is not able read this anymore - including ansible:

ok: [IP-HERE] => 
{                                                                
    "msg": "work - variable: {u'apache': u'error loading fact - please 
check content'}" 
}                                                                               
        


Command from python:
# cat apache.fact | python -mjson.tool
Expecting property name: line 1 column 1 (char 1)

Converting this local facts with following task / command - automatically 
allow read this file by python and ansible.

- name: Fix wrong json format in local facts
  shell: sed -i "s/'/\"/g" *.fact chdir=/etc/ansible/facts.d/

Could you advice whether I should raise this on Github bug list or this is 
working exectly as should? 

Best regards,
Marcin Praczko

-- 
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 ansible-project+unsubscr...@googlegroups.com.
To post to this group, send email to ansible-project@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/dff152ee-8b4e-424a-8985-f75b868ed3ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to