<p dir="auto">From <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/michaelgaribaldi/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/michaelgaribaldi">@michaelgaribaldi</a> on 2016-10-28T22:32:33Z</p>

<h5 dir="auto">ISSUE TYPE</h5>

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

<p dir="auto">eos_config</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
  config file = /home/vagrant/iostest/ansible.cfg
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">ansible 2.3.0
  config file = /home/vagrant/iostest/ansible.cfg
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<p dir="auto">Using default config</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">Ubuntu managing Arista</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">In this special case when multiple VLANS are created without a name (or the same name) associated to them, the "show run" of an Arista config puts them in one line such as "vlan 10-11". This breaks the idempotency since it will attempt to add the VLAN again. It will attempt to add VLAN 10 or 11 again, for example. It appears as though during the running config check, the module is parsing for an individual VLAN line with that particualr VLAN.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>

<ol dir="auto">
<li>
<p dir="auto">Create a task that adds a NEW vlan to an arista switch. Do not add a name to this vlan at this time.</p>
</li>
<li>
<p dir="auto">Run the task again but change make vlan 11 instead of vlan 10</p>
</li>
<li>
<p dir="auto">Run the exact task in step 1...adding vlan 10 to the switch again</p>
</li>
</ol>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#eos.yaml
- name: role add vlan using eos_config module
  connection: local
  eos_config:
    lines:
     - vlan 10
    provider: &quot;{{ cli }}&quot;
  register: vlan_created_out

#arista-vlan.yaml

---
- name: playbook - vlan add using eos_config
  hosts: eos
  gather_facts: no
  connection: local

  vars_files:
    - creds.yaml

  roles:
    - { role: vlan_add }
"><pre class="notranslate"><code class="notranslate">#eos.yaml
- name: role add vlan using eos_config module
  connection: local
  eos_config:
    lines:
     - vlan 10
    provider: "{{ cli }}"
  register: vlan_created_out

#arista-vlan.yaml

---
- name: playbook - vlan add using eos_config
  hosts: eos
  gather_facts: no
  connection: local

  vars_files:
    - creds.yaml

  roles:
    - { role: vlan_add }

</code></pre></div>

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

<p dir="auto">Step 1) Expected output, changed=1 and new vlan 10 created<br>
Step 2) Expected output, changed=1 and new vlan 11 created<br>
Step 3) Expected output, changed=0 and vlan 10 not attempted to be created</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">Step 1) Expected output, changed=1 and new vlan 10 created<br>
Step 2) Expected output, changed=1 and new vlan 11 created<br>
Step 3) Expected output, changed=1 and vlan 10 attempted to be created again...you can see when logging AAA commands that the vlan is attempting to be created every time.</p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate">
</code></pre></div>
<p dir="auto">Copied from original issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="186036486" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible-modules-core/issues/5430" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible-modules-core/issues/5430/hovercard" href="https://github.com/ansible/ansible-modules-core/issues/5430">ansible/ansible-modules-core#5430</a></p>
<p dir="auto">From <a class="user-mention notranslate" data-hovercard-type="user" data-hovercard-url="/users/michaelgaribaldi/hovercard" data-octo-click="hovercard-link-click" data-octo-dimensions="link_type:self" href="https://github.com/michaelgaribaldi">@michaelgaribaldi</a> on 2016-10-28T22:32:33Z</p>

<h5 dir="auto">ISSUE TYPE</h5>

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

<p dir="auto">eos_config</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
  config file = /home/vagrant/iostest/ansible.cfg
  configured module search path = Default w/o overrides"><pre class="notranslate"><code class="notranslate">ansible 2.3.0
  config file = /home/vagrant/iostest/ansible.cfg
  configured module search path = Default w/o overrides
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<p dir="auto">Using default config</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">Ubuntu managing Arista</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">In this special case when multiple VLANS are created without a name (or the same name) associated to them, the "show run" of an Arista config puts them in one line such as "vlan 10-11". This breaks the idempotency since it will attempt to add the VLAN again. It will attempt to add VLAN 10 or 11 again, for example. It appears as though during the running config check, the module is parsing for an individual VLAN line with that particualr VLAN.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>

<ol dir="auto">
<li>
<p dir="auto">Create a task that adds a NEW vlan to an arista switch. Do not add a name to this vlan at this time.</p>
</li>
<li>
<p dir="auto">Run the task again but change make vlan 11 instead of vlan 10</p>
</li>
<li>
<p dir="auto">Run the exact task in step 1...adding vlan 10 to the switch again</p>
</li>
</ol>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="#eos.yaml
- name: role add vlan using eos_config module
  connection: local
  eos_config:
    lines:
     - vlan 10
    provider: &quot;{{ cli }}&quot;
  register: vlan_created_out

#arista-vlan.yaml

---
- name: playbook - vlan add using eos_config
  hosts: eos
  gather_facts: no
  connection: local

  vars_files:
    - creds.yaml

  roles:
    - { role: vlan_add }
"><pre class="notranslate"><code class="notranslate">#eos.yaml
- name: role add vlan using eos_config module
  connection: local
  eos_config:
    lines:
     - vlan 10
    provider: "{{ cli }}"
  register: vlan_created_out

#arista-vlan.yaml

---
- name: playbook - vlan add using eos_config
  hosts: eos
  gather_facts: no
  connection: local

  vars_files:
    - creds.yaml

  roles:
    - { role: vlan_add }

</code></pre></div>

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

<p dir="auto">Step 1) Expected output, changed=1 and new vlan 10 created<br>
Step 2) Expected output, changed=1 and new vlan 11 created<br>
Step 3) Expected output, changed=0 and vlan 10 not attempted to be created</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">Step 1) Expected output, changed=1 and new vlan 10 created<br>
Step 2) Expected output, changed=1 and new vlan 11 created<br>
Step 3) Expected output, changed=1 and vlan 10 attempted to be created again...you can see when logging AAA commands that the vlan is attempting to be created every time.</p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content=""><pre class="notranslate"><code class="notranslate">
</code></pre></div>
<p dir="auto">Copied from original issue: <a class="issue-link js-issue-link" data-error-text="Failed to load title" data-id="186036486" data-permission-text="Title is private" data-url="https://github.com/ansible/ansible-modules-core/issues/5430" data-hovercard-type="issue" data-hovercard-url="/ansible/ansible-modules-core/issues/5430/hovercard" href="https://github.com/ansible/ansible-modules-core/issues/5430">ansible/ansible-modules-core#5430</a></p>