{"action":"created","issue":{"url":"https://api.github.com/repos/ansible/ansible/issues/15096","repository_url":"https://api.github.com/repos/ansible/ansible","labels_url":"https://api.github.com/repos/ansible/ansible/issues/15096/labels{/name}","comments_url":"https://api.github.com/repos/ansible/ansible/issues/15096/comments","events_url":"https://api.github.com/repos/ansible/ansible/issues/15096/events","html_url":"https://github.com/ansible/ansible/issues/15096","id":142732872,"number":15096,"title":"ansible_distribution fact does not work for CoreOS","user":{"login":"danehans","id":1878195,"avatar_url":"https://avatars.githubusercontent.com/u/1878195?v=3","gravatar_id":"","url":"https://api.github.com/users/danehans","html_url":"https://github.com/danehans","followers_url":"https://api.github.com/users/danehans/followers","following_url":"https://api.github.com/users/danehans/following{/other_user}","gists_url":"https://api.github.com/users/danehans/gists{/gist_id}","starred_url":"https://api.github.com/users/danehans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danehans/subscriptions","organizations_url":"https://api.github.com/users/danehans/orgs","repos_url":"https://api.github.com/users/danehans/repos","events_url":"https://api.github.com/users/danehans/events{/privacy}","received_events_url":"https://api.github.com/users/danehans/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":1,"created_at":"2016-03-22T18:07:30Z","updated_at":"2016-03-23T20:43:57Z","closed_at":null,"body":"##### Issue Type:\r\n\r\n - Bug Report\r\n\r\n##### Ansible Version:\r\n\r\n```\r\n# ansible --version\r\nansible 1.9.4\r\n  configured module search path = None\r\n```\r\n\r\n##### Ansible Configuration:\r\n\r\nNo changes to default settings.\r\n\r\n##### Environment:\r\n\r\nOS Running Ansible:\r\n\r\n```\r\n# cat /etc/os-release \r\nNAME=\"CentOS Linux\"\r\nVERSION=\"7 (Core)\"\r\nID=\"centos\"\r\nID_LIKE=\"rhel fedora\"\r\nVERSION_ID=\"7\"\r\nPRETTY_NAME=\"CentOS Linux 7 (Core)\"\r\nANSI_COLOR=\"0;31\"\r\nCPE_NAME=\"cpe:/o:centos:centos:7\"\r\nHOME_URL=\"https://www.centos.org/\"\r\nBUG_REPORT_URL=\"https://bugs.centos.org/\"\r\n\r\nCENTOS_MANTISBT_PROJECT=\"CentOS-7\"\r\nCENTOS_MANTISBT_PROJECT_VERSION=\"7\"\r\nREDHAT_SUPPORT_PRODUCT=\"centos\"\r\nREDHAT_SUPPORT_PRODUCT_VERSION=\"7\"\r\n```\r\n\r\nOS Being Managed:\r\n```\r\n$ cat /etc/os-release\r\nNAME=CoreOS\r\nID=coreos\r\nVERSION=983.0.0\r\nVERSION_ID=983.0.0\r\nBUILD_ID=2016-03-10-0808\r\nPRETTY_NAME=\"CoreOS 983.0.0 (Coeur Rouge)\"\r\nANSI_COLOR=\"1;32\"\r\nHOME_URL=\"https://coreos.com/\"\r\nBUG_REPORT_URL=\"https://github.com/coreos/bugs/issues\"\r\n```\r\n##### Summary:\r\n\r\nThe ansible_distribution fact does not work for CoreOS:\r\n\r\nhttps://gist.github.com/danehans/dc7081b4ac5dfe857cfe#file-coreos_ansible_facts-L99-L102\r\n\r\nEven with the development branch, the distribution does not return 'coreos':\r\n\r\nhttps://github.com/ansible/ansible/blob/devel/lib/ansible/module_utils/facts.py#L519\r\n\r\nAnsible should be checking /etc/os-release to create the ansible_distribution facts:\r\n```\r\n$ cat /etc/os-release\r\nNAME=CoreOS\r\nID=coreos\r\nVERSION=983.0.0\r\nVERSION_ID=983.0.0\r\nBUILD_ID=2016-03-10-0808\r\nPRETTY_NAME=\"CoreOS 983.0.0 (Coeur Rouge)\"\r\nANSI_COLOR=\"1;32\"\r\nHOME_URL=\"https://coreos.com/\"\r\nBUG_REPORT_URL=\"https://github.com/coreos/bugs/issues\"\r\n```\r\n\r\n##### Steps To Reproduce:\r\n\r\nInstall CoreOS on a server/vm that will be managed by Ansible. Make sure to add the SSH public key of the Ansible controller to the CoreOS server/vm. The following examples are bases on this Ansible project:\r\n\r\nhttps://github.com/kubernetes/contrib/tree/master/ansible\r\n\r\nAdd a CoreOS machine/vm to your Ansible inventory:\r\n\r\n```\r\n# cat inventory\r\n\r\n[masters]\r\ncore-master\r\n```\r\n\r\nHere is my playbook (but any simple playbook will due):\r\n\r\n```\r\n# cat cluster.yml \r\n---\r\n# This playbook deploys a kubernetes cluster \r\n# with the default addons.\r\n\r\n- hosts: all\r\n  gather_facts: false\r\n  sudo: yes\r\n  roles:\r\n    - pre-ansible\r\n  tags:\r\n    - pre-ansible\r\n\r\n# Install etcd\r\n- hosts: etcd\r\n  sudo: yes\r\n  roles:\r\n    - etcd\r\n  tags:\r\n    - etcd\r\n\r\n- hosts: all\r\n  sudo: yes\r\n  roles:\r\n    - common\r\n    - docker\r\n  tags:\r\n    - docker\r\n\r\n# install flannel\r\n- hosts:\r\n    - etcd\r\n    - masters\r\n    - nodes\r\n  sudo: yes\r\n  roles:\r\n    - { role: flannel, when: networking == 'flannel' }\r\n  tags:\r\n    - network-service-install\r\n\r\n# install opencontrail\r\n- hosts: all\r\n  sudo: yes\r\n  roles:\r\n    - { role: opencontrail, when: networking == 'opencontrail'}\r\n  tags:\r\n    - network-service-install\r\n\r\n# install kube master services\r\n- hosts: masters\r\n  sudo: yes\r\n  roles:\r\n    - master\r\n  tags:\r\n    - masters\r\n\r\n# launch addons, like dns\r\n- hosts: masters\r\n  sudo: yes\r\n  roles:\r\n    - kubernetes-addons\r\n  tags:\r\n    - addons\r\n    - dns\r\n\r\n# install kubernetes on the nodes\r\n- hosts: nodes\r\n  sudo: yes\r\n  roles:\r\n    - node\r\n  tags:\r\n    - nodes\r\n\r\n# provision opencontrail once the services are operational\r\n- hosts:\r\n    - masters[0]\r\n    - nodes\r\n  sudo: yes\r\n  roles:\r\n    - { role: opencontrail-provision, when: networking == 'opencontrail' }\r\n  tags:\r\n    - network-service-config\r\n```\r\n\r\nRun the following command on your Ansible controller:\r\n```\r\n# ansible -i inventory all -m setup | grep distr\r\n        \"ansible_distribution\": \"NA\", \r\n        \"ansible_distribution_major_version\": \"NA\", \r\n        \"ansible_distribution_release\": \"NA\", \r\n        \"ansible_distribution_version\": \"NA\", \r\n```\r\n\r\n##### Expected Results:\r\n\r\n```\r\n# ansible -i inventory all -m setup | grep distr\r\n        \"ansible_distribution\": \"CoreOS\", \r\n        \"ansible_distribution_major_version\": \"983.0.0\", \r\n        \"ansible_distribution_release\": \"983.0.0\", \r\n        \"ansible_distribution_version\": \"983.0.0\", \r\n```\r\n\r\n##### Actual Results:\r\n\r\n```\r\n# ansible -i inventory all -m setup | grep distr\r\n        \"ansible_distribution\": \"NA\", \r\n        \"ansible_distribution_major_version\": \"NA\", \r\n        \"ansible_distribution_release\": \"NA\", \r\n        \"ansible_distribution_version\": \"NA\", \r\n```\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/ansible/ansible/issues/comments/200537076","html_url":"https://github.com/ansible/ansible/issues/15096#issuecomment-200537076","issue_url":"https://api.github.com/repos/ansible/ansible/issues/15096","id":200537076,"user":{"login":"danehans","id":1878195,"avatar_url":"https://avatars.githubusercontent.com/u/1878195?v=3","gravatar_id":"","url":"https://api.github.com/users/danehans","html_url":"https://github.com/danehans","followers_url":"https://api.github.com/users/danehans/followers","following_url":"https://api.github.com/users/danehans/following{/other_user}","gists_url":"https://api.github.com/users/danehans/gists{/gist_id}","starred_url":"https://api.github.com/users/danehans/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/danehans/subscriptions","organizations_url":"https://api.github.com/users/danehans/orgs","repos_url":"https://api.github.com/users/danehans/repos","events_url":"https://api.github.com/users/danehans/events{/privacy}","received_events_url":"https://api.github.com/users/danehans/received_events","type":"User","site_admin":false},"created_at":"2016-03-23T20:43:56Z","updated_at":"2016-03-23T20:43:56Z","body":"It looks like someone successfully tested the ansible_ditribution fact for coreos [1]. I tried to do the same for my use case [2] and ansible dies [3].\r\n\r\n[1] https://github.com/kubernetes/contrib/pull/604\r\n[2] https://github.com/kubernetes/contrib/tree/master/ansible \r\n[3] https://gist.github.com/danehans/b8566fc0ba455089a7bc"}}