<p dir="auto">When adding a node to a load balance with state=present, it throws an error on subsequent ansible runs with:</p>
<p dir="auto">"Duplicate nodes detected. One or more nodes already configured on load balancer."</p>
<p dir="auto">I would assume "present" should just be a changed=False noop if it's already in the LB.</p>
<h5 dir="auto">ISSUE TYPE</h5>

<ul dir="auto">
<li>Bug Report</li>
</ul>
<h5 dir="auto">COMPONENT NAME</h5>

<p dir="auto">ios_config, iosxr_config, nxos_config<br>
Any config module with before and after</p>
<h5 dir="auto">ANSIBLE VERSION</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="$ ansible --version
ansible 2.2.1.0
  config file = /home/jmighion/git/blank-ansible-repo/ansible.cfg
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">$ ansible --version
ansible 2.2.1.0
  config file = /home/jmighion/git/blank-ansible-repo/ansible.cfg
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<p dir="auto">inventory      = inventory<br>
forks          = 1400<br>
roles_path    = roles<br>
retry_files_enabled = False</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">N/A</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">Any commands in <code class="notranslate">before:</code> or <code class="notranslate">after:</code> in any network config module that has those params will not be added to the command stack if you're using a template. Not sure why the before or after commands cannot be added after the template is rendered or added into the template before rendering so the commands.</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: Configure NTP
  ios_config:
    before: default ntp
    src: ios.j2
    save: yes
    provider: &quot;{{ cli }}&quot;"><pre class="notranslate">- <span class="pl-ent">name</span>: <span class="pl-s">Configure NTP</span>
  <span class="pl-ent">ios_config</span>:
    <span class="pl-ent">before</span>: <span class="pl-s">default ntp</span>
    <span class="pl-ent">src</span>: <span class="pl-s">ios.j2</span>
    <span class="pl-ent">save</span>: <span class="pl-s">yes</span>
    <span class="pl-ent">provider</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ cli }}<span class="pl-pds">"</span></span></pre></div>
<p dir="auto">ios.j2:</p>
<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="ntp authentication-key 1 md5 {{ ntp_peering_key }}
ntp authenticate
ntp trusted-key 1
ntp source {{ ntp_source }}
ntp server {{ npt_service_ipv4 }} key 1"><pre class="notranslate"><span class="pl-s">ntp authentication-key 1 md5 {{ ntp_peering_key }}</span>
<span class="pl-s">ntp authenticate</span>
<span class="pl-s">ntp trusted-key 1</span>
<span class="pl-s">ntp source {{ ntp_source }}</span>
<span class="pl-s">ntp server {{ npt_service_ipv4 }} key 1</span></pre></div>

<h5 dir="auto">EXPECTED RESULTS</h5>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="default ntp
ntp authentication-key 1 md5 {{ ntp_peering_key }}
ntp authenticate
ntp trusted-key 1
ntp source {{ ntp_source }}
ntp server {{ npt_service_ipv4 }} key 1"><pre class="notranslate"><code class="notranslate">default ntp
ntp authentication-key 1 md5 {{ ntp_peering_key }}
ntp authenticate
ntp trusted-key 1
ntp source {{ ntp_source }}
ntp server {{ npt_service_ipv4 }} key 1
</code></pre></div>
<h5 dir="auto">ACTUAL RESULTS</h5>


<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="&quot;backup_path&quot;: &quot;/home/jmighion/git/blank-ansible-repo/roles/config_ntp/backup/host_config.2017-03-16@17:35:09&quot;,
    &quot;changed&quot;: true,
    &quot;invocation&quot;: {
        &quot;module_args&quot;: {
            &quot;after&quot;: null,
            &quot;auth_pass&quot;: null,
            &quot;authorize&quot;: false,
            &quot;backup&quot;: true,
            &quot;before&quot;: [
                &quot;default ntp&quot;
            ],
            &quot;config&quot;: null,
            &quot;defaults&quot;: false,
            &quot;force&quot;: false,
            &quot;host&quot;: &quot;test_host&quot;,
            &quot;lines&quot;: null,
            &quot;match&quot;: &quot;line&quot;,
            &quot;parents&quot;: null,
            &quot;password&quot;: &quot;VALUE_SPECIFIED_IN_NO_LOG_PARAMETER&quot;,
            &quot;port&quot;: null,
            &quot;provider&quot;: {
                &quot;host&quot;: &quot;test_host&quot;,
                &quot;password&quot;: &quot;VALUE_SPECIFIED_IN_NO_LOG_PARAMETER&quot;,
                &quot;username&quot;: &quot;test_user&quot;
            },
            &quot;replace&quot;: &quot;line&quot;,
            &quot;save&quot;: true,
            &quot;src&quot;: &quot;ntp authentication-key 1 md5 stuff!\nntp authenticate\nntp trusted-key 1\nntp source Vlan0\nntp server ip.ip.ip.ip key 1\n&quot;,
            &quot;ssh_keyfile&quot;: null,
            &quot;timeout&quot;: 10,
            &quot;transport&quot;: null,
            &quot;use_ssl&quot;: true,
            &quot;username&quot;: &quot;test_user&quot;,
            &quot;validate_certs&quot;: true
        }
    },
    &quot;warnings&quot;: []"><pre class="notranslate"><code class="notranslate">"backup_path": "/home/jmighion/git/blank-ansible-repo/roles/config_ntp/backup/host_config.2017-03-16@17:35:09",
    "changed": true,
    "invocation": {
        "module_args": {
            "after": null,
            "auth_pass": null,
            "authorize": false,
            "backup": true,
            "before": [
                "default ntp"
            ],
            "config": null,
            "defaults": false,
            "force": false,
            "host": "test_host",
            "lines": null,
            "match": "line",
            "parents": null,
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": null,
            "provider": {
                "host": "test_host",
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "username": "test_user"
            },
            "replace": "line",
            "save": true,
            "src": "ntp authentication-key 1 md5 stuff!\nntp authenticate\nntp trusted-key 1\nntp source Vlan0\nntp server ip.ip.ip.ip key 1\n",
            "ssh_keyfile": null,
            "timeout": 10,
            "transport": null,
            "use_ssl": true,
            "username": "test_user",
            "validate_certs": true
        }
    },
    "warnings": []
</code></pre></div>