<h5 dir="auto">Issue Type:</h5>
<p dir="auto">Bug Report</p>
<h5 dir="auto">Ansible Version:</h5>
<p dir="auto">ansible 1.6.3</p>
<h5 dir="auto">Environment:</h5>
<p dir="auto">Ubuntu 14.04</p>
<h5 dir="auto">Summary:</h5>
<p dir="auto">When using apache2_module for mpm_prefork a change occurs every playbook run, even though the module is already enabled.</p>
<h5 dir="auto">Steps To Reproduce:</h5>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- name: Ensure mpm_prefork is enabled
  apache2_module: name=mpm_prefork"><pre class="notranslate">- <span class="pl-ent">name</span>: <span class="pl-s">Ensure mpm_prefork is enabled</span>
  <span class="pl-ent">apache2_module</span>: <span class="pl-s">name=mpm_prefork</span></pre></div>
<h5 dir="auto">Expected Results:</h5>
<p dir="auto">No change during playbook run.</p>
<h5 dir="auto">Actual Results:</h5>
<p dir="auto">A change occurs every run, even though mpm_prefork is already enabled:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="# a2enmod mpm_prefork
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Considering conflict mpm_itk for mpm_prefork:
Module mpm_prefork already enabled"><pre class="notranslate"><code class="notranslate"># a2enmod mpm_prefork
Considering conflict mpm_event for mpm_prefork:
Considering conflict mpm_worker for mpm_prefork:
Considering conflict mpm_itk for mpm_prefork:
Module mpm_prefork already enabled
</code></pre></div>
<p dir="auto">In Ansible Version 1.6.2 the module 'apache2_module', which was added in 1.6, always lists apache modules when being enabled as 'changed' if they have some dependencies.</p>
<p dir="auto">Tested with the modules headers, deflate, rewrite, ssl.<br>
Here's the output from Ansible:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="TASK: [apache | Enable standard mods] ***************************************** 
&lt;ansibleCrawler&gt; REMOTE_MODULE apache2_module name=headers state=present
ok: [ansibleCrawler] =&gt; (item=headers) =&gt; {&quot;changed&quot;: false, &quot;item&quot;: &quot;headers&quot;, &quot;result&quot;: &quot;Success&quot;}
&lt;ansibleCrawler&gt; REMOTE_MODULE apache2_module name=deflate state=present
changed: [ansibleCrawler] =&gt; (item=deflate) =&gt; {&quot;changed&quot;: true, &quot;item&quot;: &quot;deflate&quot;, &quot;result&quot;: &quot;Enabled&quot;}
&lt;ansibleCrawler&gt; REMOTE_MODULE apache2_module name=rewrite state=present
ok: [ansibleCrawler] =&gt; (item=rewrite) =&gt; {&quot;changed&quot;: false, &quot;item&quot;: &quot;rewrite&quot;, &quot;result&quot;: &quot;Success&quot;}
&lt;ansibleCrawler&gt; REMOTE_MODULE apache2_module name=ssl state=present
changed: [ansibleCrawler] =&gt; (item=ssl) =&gt; {&quot;changed&quot;: true, &quot;item&quot;: &quot;ssl&quot;, &quot;result&quot;: &quot;Enabled&quot;}"><pre class="notranslate"><code class="notranslate">TASK: [apache | Enable standard mods] ***************************************** 
&lt;ansibleCrawler&gt; REMOTE_MODULE apache2_module name=headers state=present
ok: [ansibleCrawler] =&gt; (item=headers) =&gt; {"changed": false, "item": "headers", "result": "Success"}
&lt;ansibleCrawler&gt; REMOTE_MODULE apache2_module name=deflate state=present
changed: [ansibleCrawler] =&gt; (item=deflate) =&gt; {"changed": true, "item": "deflate", "result": "Enabled"}
&lt;ansibleCrawler&gt; REMOTE_MODULE apache2_module name=rewrite state=present
ok: [ansibleCrawler] =&gt; (item=rewrite) =&gt; {"changed": false, "item": "rewrite", "result": "Success"}
&lt;ansibleCrawler&gt; REMOTE_MODULE apache2_module name=ssl state=present
changed: [ansibleCrawler] =&gt; (item=ssl) =&gt; {"changed": true, "item": "ssl", "result": "Enabled"}
</code></pre></div>
<p dir="auto">And here's what manual execution of a2enmod on the target machine prints out:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="root@targetMachine ~ # a2enmod headers
Module headers already enabled
root@targetMachine ~ # a2enmod deflate
Considering dependency filter for deflate:
Module filter already enabled
Module deflate already enabled
root@targetMachine ~ # a2enmod rewrite
Module rewrite already enabled
root@targetMachine ~ # a2enmod ssl
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Module socache_shmcb already enabled
Module ssl already enabled"><pre class="notranslate"><code class="notranslate">root@targetMachine ~ # a2enmod headers
Module headers already enabled
root@targetMachine ~ # a2enmod deflate
Considering dependency filter for deflate:
Module filter already enabled
Module deflate already enabled
root@targetMachine ~ # a2enmod rewrite
Module rewrite already enabled
root@targetMachine ~ # a2enmod ssl
Considering dependency setenvif for ssl:
Module setenvif already enabled
Considering dependency mime for ssl:
Module mime already enabled
Considering dependency socache_shmcb for ssl:
Module socache_shmcb already enabled
Module ssl already enabled
</code></pre></div>
<p dir="auto">As you can see, this only involves modules which depend on others.<br>
If using apache2_module with the notify directive, it would cause to always trigger the notification, e.g. restarting Apache.</p>