get_service_mgr_facts error

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]: 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\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 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.

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

wintermute# ansible --version
ansible 2.0.2.0
  config file =
  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 => {
    "ansible_facts": {
        "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:/usr/obj/usr/src/sys/GENERIC"
    },
    "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

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 <-------- FreeBSD machine
Using /home/francisco/hg/natserv-sites/ansible.cfg as config file
<lunap2.nsinf.net> ESTABLISH SSH CONNECTION FOR USER: None
<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 ‘/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> PUT /tmp/tmp_mCHs5 TO /home/francisco/.ansible/tmp/ansible-tmp-1462754932.56-132886504159744/setup
<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]’
<lunap2.nsinf.net> ESTABLISH SSH CONNECTION FOR USER: None
<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 '/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 | 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 |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:/usr/obj/usr/src/sys/GENERIC”,

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/pull/15842

​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.​