<h5 dir="auto">ISSUE TYPE</h5>
<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">ANSIBLE VERSION</h5>
<p dir="auto">2.0.2.0</p>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">N/A</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">In 2.0.2.0, using <code class="notranslate">get_url</code> with <code class="notranslate">file://</code> urls fails because it is<br>
looking for an http respond code.  This worked correctly in 2.0.1.0.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto"><code class="notranslate">touch /tmp/srcfile</code> and run the following playbook:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- hosts: localhost
  gather_facts: false
  vars:
    url: file:///tmp/srcfile
  tasks:

    - get_url:
        url: &quot;{{url}}&quot;
        dest: &quot;./destfile&quot;
        force: true"><pre class="notranslate"><code class="notranslate">- hosts: localhost
  gather_facts: false
  vars:
    url: file:///tmp/srcfile
  tasks:

    - get_url:
        url: "{{url}}"
        dest: "./destfile"
        force: true
</code></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PLAY ***************************************************************************

TASK [get_url] *****************************************************************
ok: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0   "><pre class="notranslate"><code class="notranslate">PLAY ***************************************************************************

TASK [get_url] *****************************************************************
ok: [localhost]

PLAY RECAP *********************************************************************
localhost                  : ok=1    changed=0    unreachable=0    failed=0   
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="PLAY [localhost] ***************************************************************

TASK [get_url] *****************************************************************
fatal: [localhost]: FAILED! =&gt; {&quot;changed&quot;: false, &quot;dest&quot;: &quot;./destfile&quot;, &quot;failed&quot;: true, &quot;gid&quot;: 1000, &quot;group&quot;: &quot;lars&quot;, &quot;mode&quot;: &quot;0664&quot;, &quot;msg&quot;: &quot;Request failed&quot;, &quot;owner&quot;: &quot;lars&quot;, &quot;response&quot;: &quot;OK (12 bytes)&quot;, &quot;size&quot;: 12, &quot;state&quot;: &quot;file&quot;, &quot;status_code&quot;: null, &quot;uid&quot;: 1000, &quot;url&quot;: &quot;file:///tmp/srcfile&quot;}

NO MORE HOSTS LEFT *************************************************************
  to retry, use: --limit @file_urls.retry

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

TASK [get_url] *****************************************************************
fatal: [localhost]: FAILED! =&gt; {"changed": false, "dest": "./destfile", "failed": true, "gid": 1000, "group": "lars", "mode": "0664", "msg": "Request failed", "owner": "lars", "response": "OK (12 bytes)", "size": 12, "state": "file", "status_code": null, "uid": 1000, "url": "file:///tmp/srcfile"}

NO MORE HOSTS LEFT *************************************************************
  to retry, use: --limit @file_urls.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>Feature Idea</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>
<p dir="auto">firewalld</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.1.0
  config file = &lt;REDACTED&gt;/ansible.cfg
  configured module search path = [u'/&lt;REDACTED&gt;/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.4.1.0/libexec/lib/python2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.14 (default, Sep 25 2017, 09:53:22) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]"><pre class="notranslate"><code class="notranslate">ansible 2.4.1.0
  config file = &lt;REDACTED&gt;/ansible.cfg
  configured module search path = [u'/&lt;REDACTED&gt;/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
  ansible python module location = /usr/local/Cellar/ansible/2.4.1.0/libexec/lib/python2.7/site-packages/ansible
  executable location = /usr/local/bin/ansible
  python version = 2.7.14 (default, Sep 25 2017, 09:53:22) [GCC 4.2.1 Compatible Apple LLVM 9.0.0 (clang-900.0.37)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>
<p dir="auto">No changed settings</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>
<p dir="auto">I'm trying to manage CentOS 7 / RHEL 7 systems with firewalld enabled.</p>
<h5 dir="auto">SUMMARY</h5>
<p dir="auto">I use FirewallD to manage my system firewalls for various services. Some services should only be reachable by specific IP subnets. The current <code class="notranslate">firewalld</code> module allows me to specify a source IP range, but I have to choose an existing zone. The problem with this, is that most of these zones have "side effects" of existing rules and it limits the number of unique source ranges to ports I would give access to.</p>
<p dir="auto">I'd like to be able to do the equivalent of the following using Ansible.</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="sudo firewall-cmd --new-zone=kafka_consumers --permanent
sudo firewall-cmd --zone=kafka_consumers --add-source=192.0.2.0/24 --permanent
sudo firewall-cmd --zone=kafka_consumers --add-port=9092/tcp --permanent
sudo firewall-cmd --reload"><pre class="notranslate"><code class="notranslate">sudo firewall-cmd --new-zone=kafka_consumers --permanent
sudo firewall-cmd --zone=kafka_consumers --add-source=192.0.2.0/24 --permanent
sudo firewall-cmd --zone=kafka_consumers --add-port=9092/tcp --permanent
sudo firewall-cmd --reload
</code></pre></div>
<h5 dir="auto">STEPS TO REPRODUCE</h5>
<p dir="auto">I think using the module and only specifying the zone with a state of <code class="notranslate">present</code> makes sense as an atomic change. Then the rules could be applied.</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- name: Ensure kafka_consumers zone exists
  firewalld:
    zone: kafka_consumers
    state: present
    permanent: yes
    immediate: yes
- name: Add TEST-NET-1 to zone
  firewalld:
    zone: kafka_consumers
    source: 192.0.2.0/24
    permanent: yes
    immediate: yes
    state: present
- name: Add kafka port to zone
  firewalld:
    zone: kafka_consumers
    port: 9092/tcp
    permanent: yes
    immediate: yes
    state: present"><pre class="notranslate">- <span class="pl-ent">name</span>: <span class="pl-s">Ensure kafka_consumers zone exists</span>
  <span class="pl-ent">firewalld</span>:
    <span class="pl-ent">zone</span>: <span class="pl-s">kafka_consumers</span>
    <span class="pl-ent">state</span>: <span class="pl-s">present</span>
    <span class="pl-ent">permanent</span>: <span class="pl-s">yes</span>
    <span class="pl-ent">immediate</span>: <span class="pl-s">yes</span>
- <span class="pl-ent">name</span>: <span class="pl-s">Add TEST-NET-1 to zone</span>
  <span class="pl-ent">firewalld</span>:
    <span class="pl-ent">zone</span>: <span class="pl-s">kafka_consumers</span>
    <span class="pl-ent">source</span>: <span class="pl-s">192.0.2.0/24</span>
    <span class="pl-ent">permanent</span>: <span class="pl-s">yes</span>
    <span class="pl-ent">immediate</span>: <span class="pl-s">yes</span>
    <span class="pl-ent">state</span>: <span class="pl-s">present</span>
- <span class="pl-ent">name</span>: <span class="pl-s">Add kafka port to zone</span>
  <span class="pl-ent">firewalld</span>:
    <span class="pl-ent">zone</span>: <span class="pl-s">kafka_consumers</span>
    <span class="pl-ent">port</span>: <span class="pl-s">9092/tcp</span>
    <span class="pl-ent">permanent</span>: <span class="pl-s">yes</span>
    <span class="pl-ent">immediate</span>: <span class="pl-s">yes</span>
    <span class="pl-ent">state</span>: <span class="pl-s">present</span></pre></div>
<h5 dir="auto">EXPECTED RESULTS</h5>
<p dir="auto">The zone would be created, then the rules would be applied</p>
<h5 dir="auto">ACTUAL RESULTS</h5>
<p dir="auto">The <code class="notranslate">firewalld</code> module execution fails due to zone not existing.</p>