<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">linode cloud module - modules/cloud/linode/linode.py</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.3.0.0
  config file = 
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, Apr  4 2017, 08:46:44) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]"><pre class="notranslate"><code class="notranslate">ansible 2.3.0.0
  config file = 
  configured module search path = Default w/o overrides
  python version = 2.7.13 (default, Apr  4 2017, 08:46:44) [GCC 4.2.1 Compatible Apple LLVM 8.0.0 (clang-800.0.42.1)]
</code></pre></div>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Master: Mac OS X El Capitan v10.11.6<br>
Managing: Ubuntu 16.04 on Linode<br>
Python: 2.7.13</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">When trying to provision a linode with the linode module (using a playbook very similar to <a href="https://github.com/marji/ansible-playbook-linode/blob/master/provision.yml">this one</a>), I get an error:</p>
<p dir="auto"><code class="notranslate">Alert_cpu_threshold must be between 0 and 2000</code></p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<ul dir="auto">
<li>Installed pycurl and linode-python via pip</li>
<li>Updated hosts file to set ansible_python_interpreter</li>
<li>Export LINODE_API_KEY</li>
<li>Attempt to provision linode with the following settings:</li>
</ul>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="tasks:
  - name: Linode | Create linode server via Linode API
    linode:
       name: test
       plan: 1
       datacenter: 7
       distribution: 146
       displaygroup: test
       swap: 512
       wait: yes
       wait_timeout: 600
       state: present
     register: linode"><pre class="notranslate"><span class="pl-ent">tasks</span>:
  - <span class="pl-ent">name</span>: <span class="pl-s">Linode | Create linode server via Linode API</span>
    <span class="pl-ent">linode</span>:
       <span class="pl-ent">name</span>: <span class="pl-s">test</span>
       <span class="pl-ent">plan</span>: <span class="pl-c1">1</span>
       <span class="pl-ent">datacenter</span>: <span class="pl-c1">7</span>
       <span class="pl-ent">distribution</span>: <span class="pl-c1">146</span>
       <span class="pl-ent">displaygroup</span>: <span class="pl-s">test</span>
       <span class="pl-ent">swap</span>: <span class="pl-c1">512</span>
       <span class="pl-ent">wait</span>: <span class="pl-s">yes</span>
       <span class="pl-ent">wait_timeout</span>: <span class="pl-c1">600</span>
       <span class="pl-ent">state</span>: <span class="pl-s">present</span>
     <span class="pl-ent">register</span>: <span class="pl-s">linode</span></pre></div>
<p dir="auto">Full example, including hosts file is available <a href="https://gist.github.com/ErisDS/b8a78f7e86a2b21b466714332a3e059c">in this gist</a></p>
<p dir="auto">Executed using <code class="notranslate">ansible-playbook provision.yml -i hosts</code></p>
<p dir="auto">If I update my task to include <code class="notranslate">alert_cpu_threshold: 1000</code>, I then get another error:</p>
<p dir="auto"><code class="notranslate">Alert_diskio_threshold must be between 0 and 100000</code></p>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">Expected result is that the task should return OK and continue on to the next task. Instead the error prevents the task &amp; all subsequent tasks from running.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">Not: a linode is created, but not fully provisioned as there is no disk.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PLAY [Provision new linode] **********************************************************************************************************************************************************************

TASK [Linode | Create linode server via Linode API] **********************************************************************************************************************************************
fatal: [localhost]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;failed&quot;: true, &quot;msg&quot;: &quot;Alert_cpu_threshold must be between 0 and 2000.&quot;}
	to retry, use: --limit @.../ansible/provision.retry

PLAY RECAP ***************************************************************************************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1 "><pre class="notranslate"><code class="notranslate">PLAY [Provision new linode] **********************************************************************************************************************************************************************

TASK [Linode | Create linode server via Linode API] **********************************************************************************************************************************************
fatal: [localhost]: FAILED! =&gt; {"changed": false, "failed": true, "msg": "Alert_cpu_threshold must be between 0 and 2000."}
	to retry, use: --limit @.../ansible/provision.retry

PLAY RECAP ***************************************************************************************************************************************************************************************
localhost                  : ok=0    changed=0    unreachable=0    failed=1 
</code></pre></div>
<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto"><code class="notranslate">script</code> inventory plugin</p>
<h5 dir="auto">ANSIBLE VERSION</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="ansible 2.4.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/florian/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118]"><pre class="notranslate"><code class="notranslate">ansible 2.4.0.0
  config file = /etc/ansible/ansible.cfg
  configured module search path = [u'/home/florian/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/lib/python2.7/dist-packages/ansible
  executable location = /usr/bin/ansible
  python version = 2.7.13 (default, Jan 19 2017, 14:48:08) [GCC 6.3.0 20170118]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto"><code class="notranslate">ansible-config dump --only-changed</code> comes back empty.</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">Ubuntu 17.04</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">If I run <code class="notranslate">ansible-playbook</code> with a static inventory (<code class="notranslate">-i /path/to/hosts</code>), and I use <code class="notranslate">group_vars</code> and <code class="notranslate">host_vars</code> directories relative to that inventory file (as opposed to relative to the playbook file, as documented <a href="http://docs.ansible.com/ansible/latest/playbooks_variables.html#variable-precedence-where-should-i-put-a-variable" rel="nofollow">here</a>), then those variables get parsed correctly.</p>
<p dir="auto">In Ansible 2.3, if I did the same with a <em>dynamic</em> inventory script (<code class="notranslate">-i /path/to/some-script.py</code>), the behavior would be identical.</p>
<p dir="auto">In Ansible 2.4, that is no longer the case, and static and dynamic inventory behaves quite differently:</p>
<ul dir="auto">
<li>with <code class="notranslate">-i /path/to/hosts</code>, variables in <code class="notranslate">/path/to/group_vars</code> and <code class="notranslate">/path/to/host_vars</code> are correctly added to the inventory.</li>
<li>with <code class="notranslate">-i /path/to/some-script.py</code>, variables in <code class="notranslate">/path/to/group_vars</code> and <code class="notranslate">/path/to/host_vars</code> are ignored, and I need to symlink those directories into the playbook directory to be picked up.</li>
</ul>
<hr>
<p dir="auto">I'm not sure what the correct behavior is, for Ansible 2.4, considering the move from inventory scripts to inventory plugins. But it would seem like static and dynamic inventory ought to behave identically with regard to variable parsing, as it was the case pre-2.4.</p>