<p dir="auto"><em>From <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/d3v1an7/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/d3v1an7">@d3v1an7</a> on July 21, 2016 8:38</em></p>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report [or]</li>
<li>Documentation Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">osx_defaults</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.2.0 (devel 372018dfce) last updated 2016/07/21 18:27:38 (GMT +1100)
  lib/ansible/modules/core: (detached HEAD 7de287237f) last updated 2016/07/21 18:27:59 (GMT +1100)
  lib/ansible/modules/extras: (detached HEAD 68ca157f3b) last updated 2016/07/21 18:28:05 (GMT +1100)
  config file =
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">ansible 2.2.0 (devel 372018dfce) last updated 2016/07/21 18:27:38 (GMT +1100)
  lib/ansible/modules/core: (detached HEAD 7de287237f) last updated 2016/07/21 18:27:59 (GMT +1100)
  lib/ansible/modules/extras: (detached HEAD 68ca157f3b) last updated 2016/07/21 18:28:05 (GMT +1100)
  config file =
  configured module search path = Default w/o overrides
</code></pre></div>
<p dir="auto">Also had issue on 2.1.</p>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">Playbook level ansible.cfg</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="retry_files_enabled = False"><pre class="notranslate"><code class="notranslate">retry_files_enabled = False
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">10.11.5</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">When attempting to interface with an array, I get the error: <code class="notranslate">Invalid value. Expected value to be an array</code>.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">Copy code from docs: <a href="http://docs.ansible.com/ansible/osx_defaults_module.html" rel="nofollow">http://docs.ansible.com/ansible/osx_defaults_module.html</a></p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- osx_defaults:
    key: AppleLanguages
    type: array
    value: [&quot;en&quot;, &quot;nl&quot;]"><pre class="notranslate"><code class="notranslate">- osx_defaults:
    key: AppleLanguages
    type: array
    value: ["en", "nl"]
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">A green ok :)</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK [system/install : osx_defaults] *******************************************
fatal: [localhost]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;failed&quot;: true, &quot;msg&quot;: &quot;Invalid value. Expected value to be an array&quot;}"><pre class="notranslate"><code class="notranslate">TASK [system/install : osx_defaults] *******************************************
fatal: [localhost]: FAILED! =&gt; {"changed": false, "failed": true, "msg": "Invalid value. Expected value to be an array"}
</code></pre></div>
<p dir="auto"><em>Copied from original issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="166766074" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible-modules-extras/issues/2610" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible-modules-extras/issues/2610/hovercard" href="https://github.com/ansible/ansible-modules-extras/issues/2610">ansible/ansible-modules-extras#2610</a></em></p>
<h5 dir="auto">ISSUE TYPE</h5>
<p dir="auto">bug report</p>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">service module</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<p dir="auto">ansible 1.9.4</p>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">retry_files_enabled = False</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Running from Mac OS X 10.10.5 python 2.7.10<br>
to FreeBSD 10.1-RELEASE-p16 0 Tue Jul 28 120419 UTC 2015<br>
with PostgreSQL 9.4.5</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">Attempting to use the 'service' module to control PostgreSQL hangs every time. I strongly suspect that this is the same issue as <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="27221082" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/5923" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/5923/hovercard" href="https://github.com/ansible/ansible/issues/5923">#5923</a></p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="1) Install postgres94-client and postgres94-server packages on FreeBSD 10.1
2) set up inventory so that the dbserver is in group fll2-dev-dbservers in inventory file development.ini
[fll2-dev-dbservers]
fll2gdbs01dev

3) ansible -vvvv -i development.ini fll2-dev-dbservers -m service -a &quot;name=postgresql state=stopped&quot;"><pre class="notranslate"><code class="notranslate">1) Install postgres94-client and postgres94-server packages on FreeBSD 10.1
2) set up inventory so that the dbserver is in group fll2-dev-dbservers in inventory file development.ini
[fll2-dev-dbservers]
fll2gdbs01dev

3) ansible -vvvv -i development.ini fll2-dev-dbservers -m service -a "name=postgresql state=stopped"
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">pg_ctl is called to stop the server, returns when finished, ansible reports success/failure and server state</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&lt;fll2gdbs01dev&gt; ESTABLISH CONNECTION FOR USER: rmartin
&lt;fll2gdbs01dev&gt; REMOTE_MODULE service name=postgresql state=restarted
&lt;fll2gdbs01dev&gt; EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=&quot;/Users/rmartin/.ansible/cp/ansible-ssh-%h-%p-%r&quot; -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 fll2gdbs01dev /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931 &amp;&amp; chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931 &amp;&amp; echo $HOME/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931'
&lt;fll2gdbs01dev&gt; PUT /var/folders/j_/gh1x7cn138b04zb7w6q41ffw59y07m/T/tmpHfd5G9 TO /home/rmartin/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931/service
&lt;fll2gdbs01dev&gt; EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath=&quot;/Users/rmartin/.ansible/cp/ansible-ssh-%h-%p-%r&quot; -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 fll2gdbs01dev /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/local/bin/python2.7 /home/rmartin/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931/service; rm -rf /home/rmartin/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931/ &gt;/dev/null 2&gt;&amp;1'"><pre class="notranslate"><code class="notranslate">&lt;fll2gdbs01dev&gt; ESTABLISH CONNECTION FOR USER: rmartin
&lt;fll2gdbs01dev&gt; REMOTE_MODULE service name=postgresql state=restarted
&lt;fll2gdbs01dev&gt; EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/rmartin/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 fll2gdbs01dev /bin/sh -c 'mkdir -p $HOME/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931 &amp;&amp; chmod a+rx $HOME/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931 &amp;&amp; echo $HOME/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931'
&lt;fll2gdbs01dev&gt; PUT /var/folders/j_/gh1x7cn138b04zb7w6q41ffw59y07m/T/tmpHfd5G9 TO /home/rmartin/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931/service
&lt;fll2gdbs01dev&gt; EXEC ssh -C -tt -vvv -o ControlMaster=auto -o ControlPersist=60s -o ControlPath="/Users/rmartin/.ansible/cp/ansible-ssh-%h-%p-%r" -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o ConnectTimeout=10 fll2gdbs01dev /bin/sh -c 'LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/local/bin/python2.7 /home/rmartin/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931/service; rm -rf /home/rmartin/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931/ &gt;/dev/null 2&gt;&amp;1'
</code></pre></div>

<p dir="auto">ps auxww excerpt on the server during the hang:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="rmartin 1258   0.0  0.1 17068  2484  0  Is+   3:14PM  0:00.01 /bin/sh -c LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/local/bin/python2.7 /home/rmartin/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931/service; rm -rf /home/rmartin/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931/ &gt;/dev/null 2&gt;&amp;1
rmartin 1259   0.0  0.3 81724 13236  0  S+    3:14PM  0:00.16 /usr/local/bin/python2.7 /home/rmartin/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931/service
rmartin 1261   0.0  0.1 17068  2852  0  I+    3:14PM  0:00.03 /bin/sh /usr/local/etc/rc.d/postgresql onestatus
root    1268   0.0  0.1 49768  2652  0  I&lt;+   3:14PM  0:00.00 su -l pgsql -c exec /usr/local/bin/pg_ctl -D /usr/local/pgsql/data -l /dev/null -w -s -m fast status"><pre class="notranslate"><code class="notranslate">rmartin 1258   0.0  0.1 17068  2484  0  Is+   3:14PM  0:00.01 /bin/sh -c LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/local/bin/python2.7 /home/rmartin/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931/service; rm -rf /home/rmartin/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931/ &gt;/dev/null 2&gt;&amp;1
rmartin 1259   0.0  0.3 81724 13236  0  S+    3:14PM  0:00.16 /usr/local/bin/python2.7 /home/rmartin/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931/service
rmartin 1261   0.0  0.1 17068  2852  0  I+    3:14PM  0:00.03 /bin/sh /usr/local/etc/rc.d/postgresql onestatus
root    1268   0.0  0.1 49768  2652  0  I&lt;+   3:14PM  0:00.00 su -l pgsql -c exec /usr/local/bin/pg_ctl -D /usr/local/pgsql/data -l /dev/null -w -s -m fast status
</code></pre></div>
<p dir="auto">I have tried both with and without the fix suggested in the old ticket <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="27221082" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible/issues/5923" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible/issues/5923/hovercard" href="https://github.com/ansible/ansible/issues/5923">#5923</a>:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="postgresql_flags=&quot;-l /dev/null -w -s -m fast&quot;"><pre class="notranslate"><code class="notranslate">postgresql_flags="-l /dev/null -w -s -m fast"
</code></pre></div>
<p dir="auto">It has not made a difference.</p>
<p dir="auto">Note that copying the ansible command</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/local/bin/python2.7 /home/rmartin/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931/service; rm -rf /home/rmartin/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931/ &gt;/dev/null 2&gt;&amp;1"><pre class="notranslate"><code class="notranslate">LANG=en_US.UTF-8 LC_CTYPE=en_US.UTF-8 /usr/local/bin/python2.7 /home/rmartin/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931/service; rm -rf /home/rmartin/.ansible/tmp/ansible-tmp-1447359262.53-79308781944931/ &gt;/dev/null 2&gt;&amp;1
</code></pre></div>
<p dir="auto">from the hung SSH command above, and pasting it into a bash prompt running on that server over interactive SSH works fine.</p>
<p dir="auto">Any ideas why this is misbehaving, or how to work around it?</p>
<p dir="auto">Copied from original issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="116632370" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible-modules-core/issues/2459" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible-modules-core/issues/2459/hovercard" href="https://github.com/ansible/ansible-modules-core/issues/2459">ansible/ansible-modules-core#2459</a></p>