# get\_service\_mgr\_facts error

**URL:** <https://forum.ansible.com/t/get-service-mgr-facts-error/21381>\
**Category:** Ansible Project\
**Tags:** ubuntu\
**Created:** [May 8, 2016, 3:58pm UTC](https://forum.ansible.com/t/get-service-mgr-facts-error/21381 "2016-05-08T15:58:26Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![Francisco\_Reyes](https://avatars.discourse-cdn.com/v4/letter/f/b77776/32.png) [@Francisco\_Reyes](https://forum.ansible.com/u/Francisco_Reyes)\
**Post date:** [May 8, 2016, 3:58pm UTC](https://forum.ansible.com/t/get-service-mgr-facts-error/21381/1 "2016-05-08T15:58:26Z")

</div>

Trying to switch from Ansible 1.94 to Ansible 2.X (whatever the current latest is… just did a git clone)

A playbook that works in 1,94 give me the error below.

fatal: [[lunap2.nsinf.net](http://lunap2.nsinf.net)]: FAILED! =\> {“changed”: false, “failed”: true, “invocation”: {“module\_name”: “setup”}, “module\_stderr”: “OpenSSH\_6.6.1, OpenSSL 1.0.1f 6 Jan 2014\r\ndebug1: Reading configuration data /home/francisco/.ssh/config\r\ndebug1: /home/francisco/.ssh/config line 167: Applying options for [lunap2.nsinf.net](http://lunap2.nsinf.net)\r\ndebug1: Reading configuration data /etc/ssh/ssh\_config\r\ndebug1: /etc/ssh/ssh\_config line 19: Applying options for \*\r\ndebug1: auto-mux: Trying existing master\r\ndebug2: fd 3 setting O\_NONBLOCK\r\ndebug2: mux\_client\_hello\_exchange: master version 4\r\ndebug3: mux\_client\_forwards: request forwardings: 0 local, 0 remote\r\ndebug3: mux\_client\_request\_session: entering\r\ndebug3: mux\_client\_request\_alive: entering\r\ndebug3: mux\_client\_request\_alive: done pid = 14749\r\ndebug3: mux\_client\_request\_session: session request sent\r\ndebug1: mux\_client\_request\_session: master session id: 2\r\ndebug3: mux\_client\_read\_packet: read header failed: Broken pipe\r\ndebug2: Received exit status from master 0\r\nShared connection to [lunap2.nsinf.net](http://lunap2.nsinf.net) closed.\r\n”, “module\_stdout”: “Traceback (most recent call last):\r\n File "/tmp/ansible\_qm7eFt/ansible\_module\_setup.py", line 127, in \r\n main()\r\n File "/tmp/ansible\_qm7eFt/ansible\_module\_setup.py", line 119, in main\r\n data = get\_all\_facts(module)\r\n File "/tmp/ansible\_qm7eFt/ansible\_modlib.zip/ansible/module\_utils/facts.py", line 3240, in get\_all\_facts\r\n File "/tmp/ansible\_qm7eFt/ansible\_modlib.zip/ansible/module\_utils/facts.py", line 3184, in ansible\_facts\r\n File "/tmp/ansible\_qm7eFt/ansible\_modlib.zip/ansible/module\_utils/facts.py", line 189, in **init** \r\n File "/tmp/ansible\_qm7eFt/ansible\_modlib.zip/ansible/module\_utils/facts.py", line 357, in get\_service\_mgr\_facts\r\nKeyError: ‘distribution’\r\n”, “msg”: “MODULE FAILURE”, “parsed”: false}

Running Ansible from an Ubuntu machine and the target machine is a FreeBSD machine.

Any suggestions / ideas? This is my third attempt to move from 1.X to 2.X and every time have run into issues.

---

<div class="post-metadata">

**Author:** ![Johannes\_Kastl](https://avatars.discourse-cdn.com/v4/letter/j/bbe5ce/32.png) [@Johannes\_Kastl](https://forum.ansible.com/u/Johannes_Kastl)\
**Post date:** [May 8, 2016, 8:17pm UTC](https://forum.ansible.com/t/get-service-mgr-facts-error/21381/2 "2016-05-08T20:17:56Z")

</div>

Does a FreeBSD machine provide a 'distribution' variable in its facts?

ansible -m setup freebsd-machine |grep distribution

I do not know why this should have changed from 1.9 to 2.x, just a  
guess...

Johannes

---

<div class="post-metadata">

**Author:** ![dch](https://sea1.discourse-cdn.com/ansible/user_avatar/forum.ansible.com/dch/32/7132_2.png) [@dch](https://forum.ansible.com/u/dch)\
**Post date:** [May 8, 2016, 9:49pm UTC](https://forum.ansible.com/t/get-service-mgr-facts-error/21381/3 "2016-05-08T21:49:35Z")

</div>

wintermute# ansible --version  
ansible 2.0.2.0  
&nbsp;&nbsp;config file =  
&nbsp;&nbsp;configured module search path = Default w/o overrides

wintermute# ansible -m setup localhost, -a  
'filter=ansible\_distribution\*'  
[WARNING]: Host file not found: /usr/local/etc/ansible/hosts

localhost | SUCCESS =\> {  
&nbsp;&nbsp;&nbsp;&nbsp;"ansible\_facts": {  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"ansible\_distribution": "FreeBSD",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"ansible\_distribution\_release": "10.3-RELEASE-p2",  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;"ansible\_distribution\_version": "FreeBSD 10.3-RELEASE-p2 #0: Wed  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;May 4 06:03:51 UTC 2016  
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;root@amd64-builder.daemonology.net:/usr/obj/usr/src/sys/GENERIC"  
&nbsp;&nbsp;&nbsp;&nbsp;},  
&nbsp;&nbsp;&nbsp;&nbsp;"changed": false  
}

This is what I'd expect to see in your case. You may want to read up the  
debugging sections of ansible docs and see if you can see anything  
specifically different. I'd also confirm using -vvv that the ssh command  
used works as expected.

A+  
Dave

---

<div class="post-metadata">

**Author:** ![Francisco\_Reyes](https://avatars.discourse-cdn.com/v4/letter/f/b77776/32.png) [@Francisco\_Reyes](https://forum.ansible.com/u/Francisco_Reyes)\
**Post date:** [May 9, 2016, 12:55am UTC](https://forum.ansible.com/t/get-service-mgr-facts-error/21381/4 "2016-05-09T00:55:09Z")

</div>

> wintermute# ansible --version  
> ansible 2.0.2.0

…

> “ansible\_facts”: {  
> “ansible\_distribution”: “FreeBSD”,

Running setup on 1.94 works… running on 2.2.0 crashes against a FreeBSD machine, but works against an Ubuntu machine.

$ansible --version  
ansible 2.2.0 (devel 848b015ce6) last updated 2016/05/08 11:39:41 (GMT -400)

$ansible -vvv -m setup [lunap2.nsinf.net](http://lunap2.nsinf.net) \<-------- FreeBSD machine  
Using /home/francisco/hg/natserv-sites/ansible.cfg as config file  
\<[lunap2.nsinf.net](http://lunap2.nsinf.net)\> ESTABLISH SSH CONNECTION FOR USER: None  
\<[lunap2.nsinf.net](http://lunap2.nsinf.net)\> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o Port=2233 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/francisco/.ansible/cp/ansible-ssh-%h-%p-%r [lunap2.nsinf.net](http://lunap2.nsinf.net) ‘/bin/sh -c ‘"’"’( umask 77 && mkdir -p “`echo $HOME/.ansible/tmp/ansible-tmp-1462754932.56-132886504159744`” && echo “`echo $HOME/.ansible/tmp/ansible-tmp-1462754932.56-132886504159744`” )‘"’“‘’  
\<[lunap2.nsinf.net](http://lunap2.nsinf.net)\> PUT /tmp/tmp\_mCHs5 TO /home/francisco/.ansible/tmp/ansible-tmp-1462754932.56-132886504159744/setup  
\<[lunap2.nsinf.net](http://lunap2.nsinf.net)\> SSH: EXEC sftp -b - -C -o ControlMaster=auto -o ControlPersist=60s -o Port=2233 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/francisco/.ansible/cp/ansible-ssh-%h-%p-%r ‘[[lunap2.nsinf.net](http://lunap2.nsinf.net)]’  
\<[lunap2.nsinf.net](http://lunap2.nsinf.net)\> ESTABLISH SSH CONNECTION FOR USER: None  
\<[lunap2.nsinf.net](http://lunap2.nsinf.net)\> SSH: EXEC ssh -C -q -o ControlMaster=auto -o ControlPersist=60s -o Port=2233 -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 -o ControlPath=/home/francisco/.ansible/cp/ansible-ssh-%h-%p-%r -tt [lunap2.nsinf.net](http://lunap2.nsinf.net) '/bin/sh -c '”‘“‘LANG=C LC\_ALL=C LC\_MESSAGES=C /usr/local/bin/python /home/francisco/.ansible/tmp/ansible-tmp-1462754932.56-132886504159744/setup; rm -rf “/home/francisco/.ansible/tmp/ansible-tmp-1462754932.56-132886504159744/” \> /dev/null 2\>&1’”’"‘’  
[lunap2.nsinf.net](http://lunap2.nsinf.net) | FAILED! =\> {  
“changed”: false,  
“failed”: true,  
“invocation”: {  
“module\_name”: “setup”  
},  
“module\_stderr”: “”,  
“module\_stdout”: “Traceback (most recent call last):\r\n File "/tmp/ansible\_EiQL5i/ansible\_module\_setup.py", line 127, in \r\n main()\r\n File "/tmp/ansible\_EiQL5i/ansible\_module\_setup.py", line 119, in main\r\n data = get\_all\_facts(module)\r\n File "/tmp/ansible\_EiQL5i/ansible\_modlib.zip/ansible/module\_utils/facts.py", line 3240, in get\_all\_facts\r\n File "/tmp/ansible\_EiQL5i/ansible\_modlib.zip/ansible/module\_utils/facts.py", line 3184, in ansible\_facts\r\n File "/tmp/ansible\_EiQL5i/ansible\_modlib.zip/ansible/module\_utils/facts.py", line 189, in **init** \r\n File "/tmp/ansible\_EiQL5i/ansible\_modlib.zip/ansible/module\_utils/facts.py", line 357, in get\_service\_mgr\_facts\r\nKeyError: ‘distribution’\r\n”,  
“msg”: “MODULE FAILURE”,  
“parsed”: false

$ansible -m setup [cas1.nsinf.net](http://cas1.nsinf.net) |grep distribution \<-------- Ubuntu machine  
“ansible\_distribution”: “Ubuntu”,  
“ansible\_distribution\_major\_version”: “14”,  
“ansible\_distribution\_release”: “trusty”,  
“ansible\_distribution\_version”: “14.04”,

$ansible --version  
ansible 1.9.4 (stable-1.9 4472889632) last updated 2015/10/25 18:37:06 (GMT -400)

$ansible -m setup lunap2.nsinf.net|grep distribution \<-------- FreeBSD machine - exact same FreeBSD machine that crashes with 2.2.0  
“ansible\_distribution”: “FreeBSD”,  
“ansible\_distribution\_release”: “10.3-RELEASE-p2”,  
“ansible\_distribution\_version”: “FreeBSD 10.3-RELEASE-p2 #0: Wed May 4 06:03:51 UTC 2016 [root@amd64-builder.daemonology.net](mailto:root@amd64-builder.daemonology.net):/usr/obj/usr/src/sys/GENERIC”,

---

<div class="post-metadata">

**Author:** ![Francisco\_Reyes](https://avatars.discourse-cdn.com/v4/letter/f/b77776/32.png) [@Francisco\_Reyes](https://forum.ansible.com/u/Francisco_Reyes)\
**Post date:** [May 13, 2016, 8:28pm UTC](https://forum.ansible.com/t/get-service-mgr-facts-error/21381/5 "2016-05-13T20:28:52Z")

</div>

Went to create bug report on this… but there was already a bug report and a pull request

[https://github.com/ansible/ansible/issues/15841](https://github.com/ansible/ansible/issues/15841)

[https://github.com/ansible/ansible/pull/15842](https://github.com/ansible/ansible/pull/15842)

---

<div class="post-metadata">

**Author:** ![Brian\_Coca](https://avatars.discourse-cdn.com/v4/letter/b/6de8d8/32.png) [@Brian\_Coca](https://forum.ansible.com/u/Brian_Coca)\
**Post date:** [May 13, 2016, 8:38pm UTC](https://forum.ansible.com/t/get-service-mgr-facts-error/21381/6 "2016-05-13T20:38:16Z")

</div>

​2.0 to 2.1 should work with FreeBSD, current devel (2.2) has a revamp on how distribution facts are gathered and is currently broken for FreeBSD (as per the tickets you mention above), we hope to have this fixed soon.​
