<p dir="auto">The following command fails with a syntax error because of</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- command: &quot;{{ venv_dir }}/bin/gunicorn --config=gunicorn.conf&quot;"><pre class="notranslate"><code class="notranslate">- command: "{{ venv_dir }}/bin/gunicorn --config=gunicorn.conf"
</code></pre></div>
<p dir="auto">But the following succeeds:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="- action: command &quot;{{ venv_dir }}/bin/gunicorn&quot; --config=gunicorn.conf"><pre class="notranslate"><code class="notranslate">- action: command "{{ venv_dir }}/bin/gunicorn" --config=gunicorn.conf
</code></pre></div>
<p dir="auto">It should be possible to use variables directly in a command.</p>
<h5 dir="auto">ISSUE TYPE</h5>

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

<p dir="auto">lib/ansible/modules/network/eos/eos_config.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.1.0 (detached HEAD 5a3f52d988) last updated 2017/05/19 12:01:08 (GMT -600)
  config file =
  configured module search path = Default w/o overrides
  python version = 2.7.12 (default, Oct 14 2016, 09:24:15) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]"><pre class="notranslate"><code class="notranslate">ansible 2.3.1.0 (detached HEAD 5a3f52d988) last updated 2017/05/19 12:01:08 (GMT -600)
  config file =
  configured module search path = Default w/o overrides
  python version = 2.7.12 (default, Oct 14 2016, 09:24:15) [GCC 4.2.1 Compatible Apple LLVM 7.0.2 (clang-700.1.81)]
</code></pre></div>
<h5 dir="auto">CONFIGURATION</h5>

<p dir="auto">N/A</p>
<h5 dir="auto">OS / ENVIRONMENT</h5>

<p dir="auto">Using Ansible to configure an Arista EOS switch</p>
<h5 dir="auto">SUMMARY</h5>

<p dir="auto">Configuration request always reports 'changed', even on subsequent<br>
runs of the same playbook.</p>
<h5 dir="auto">STEPS TO REPRODUCE</h5>

<p dir="auto">Ethernet2 is used as an example.</p>
<p dir="auto">Set the switchport mode of Ethernet2 to trunk by issuing the commands</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="dut(config)#interface Ethernet2
dut(config-if-Et2)#switchport mode trunk
dut(config-if-Et2)#exit"><pre class="notranslate"><code class="notranslate">dut(config)#interface Ethernet2
dut(config-if-Et2)#switchport mode trunk
dut(config-if-Et2)#exit
</code></pre></div>
<p dir="auto">Verify the switchport mode is trunk on the switch:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="dut(config)#show running-config all section interface Ethernet2
interface Ethernet2
   no description
   no shutdown
   ...
   no switchport asym vlan
   switchport mode trunk
   switchport dot1q ethertype 0x8100
   ..."><pre class="notranslate"><code class="notranslate">dut(config)#show running-config all section interface Ethernet2
interface Ethernet2
   no description
   no shutdown
   ...
   no switchport asym vlan
   switchport mode trunk
   switchport dot1q ethertype 0x8100
   ...
</code></pre></div>
<p dir="auto">Run a playbook with a task to call eos_config that changes the<br>
switchport mode to access, e.g.<br>
<code class="notranslate">ansible-playbook issue.yml -i hosts -e '{"lines": ["switchport mode access"], "parents": ["interface Ethernet2"], "match": "line", "description": "Update Ethernet2"}' -vvv</code></p>
<p dir="auto">Verify the switchport mode was changed to access on the switch:</p>
<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="dut(config)#show running-config all section interface Ethernet2
interface Ethernet2
   no description
   no shutdown
   ...
   no switchport asym vlan
   switchport mode access
   switchport dot1q ethertype 0x8100
   ..."><pre class="notranslate"><code class="notranslate">dut(config)#show running-config all section interface Ethernet2
interface Ethernet2
   no description
   no shutdown
   ...
   no switchport asym vlan
   switchport mode access
   switchport dot1q ethertype 0x8100
   ...
</code></pre></div>
<p dir="auto">Run the same ansible-playbook command again and check the status of the run.</p>
<p dir="auto">Transport was cli when this issue was discovered. May also affect eapi.</p>
<p dir="auto">Same issue was seen when removing the ip address for Ethernet2 with<br>
"lines" set to ["no ip address"] on the ansible-playbook command.</p>

<div class="highlight highlight-source-yaml notranslate position-relative overflow-auto" dir="auto" data-snippet-clipboard-copy-content="- hosts: test_hosts
  gather_facts: no
  connection: local

  tasks:
    - name: &quot;{{ description | default('config playbook task') }}&quot;
      eos_config:
        lines: &quot;{{ lines | default(['']) }}&quot;
        parents: &quot;{{ parents | default(omit) }}&quot;
        before: &quot;{{ before | default(omit) }}&quot;
        after: &quot;{{ after | default(omit) }}&quot;
        match: &quot;{{ match | default('none')}}&quot;
        auth_pass: &quot;{{ auth_pass | default(omit) }}&quot;
        authorize: &quot;{{ authorize | default(omit) }}&quot;
        host: &quot;{{ host | default(omit) }}&quot;
        password: &quot;{{ password | default(omit) }}&quot;
        port: &quot;{{ port | default(omit) }}&quot;
        provider: &quot;{{ provider | default(omit) }}&quot;
        transport: &quot;cli&quot;
        use_ssl: &quot;{{ use_ssl | default(omit) }}&quot;
        username: &quot;{{ username | default(omit) }}&quot;
"><pre class="notranslate">- <span class="pl-ent">hosts</span>: <span class="pl-s">test_hosts</span>
  <span class="pl-ent">gather_facts</span>: <span class="pl-s">no</span>
  <span class="pl-ent">connection</span>: <span class="pl-s">local</span>

  <span class="pl-ent">tasks</span>:
    - <span class="pl-ent">name</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ description | default('config playbook task') }}<span class="pl-pds">"</span></span>
      <span class="pl-ent">eos_config</span>:
        <span class="pl-ent">lines</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ lines | default(['']) }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">parents</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ parents | default(omit) }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">before</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ before | default(omit) }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">after</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ after | default(omit) }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">match</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ match | default('none')}}<span class="pl-pds">"</span></span>
        <span class="pl-ent">auth_pass</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ auth_pass | default(omit) }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">authorize</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ authorize | default(omit) }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">host</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ host | default(omit) }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">password</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ password | default(omit) }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">port</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ port | default(omit) }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">provider</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ provider | default(omit) }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">transport</span>: <span class="pl-s"><span class="pl-pds">"</span>cli<span class="pl-pds">"</span></span>
        <span class="pl-ent">use_ssl</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ use_ssl | default(omit) }}<span class="pl-pds">"</span></span>
        <span class="pl-ent">username</span>: <span class="pl-s"><span class="pl-pds">"</span>{{ username | default(omit) }}<span class="pl-pds">"</span></span>
</pre></div>

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

<p dir="auto">After initial run, interface Ethernet2 switchport mode is access, and the<br>
results show 1 change.</p>
<p dir="auto">After second and subsequent runs, the results should show no changes<br>
since Ethernet2 switchport mode is currently set to access.</p>
<h5 dir="auto">ACTUAL RESULTS</h5>

<p dir="auto">After second and subsequent runs, the results still show 1 change taking<br>
place. Second run output below.</p>

<div class="snippet-clipboard-content notranslate position-relative overflow-auto" data-snippet-clipboard-copy-content="No config file found; using defaults

PLAYBOOK: issue.yml **********************************************************************
1 plays in issue.yml

PLAY [test_hosts] ************************************************************************
META: ran handlers

TASK [Update Ethernet2] ******************************************************************
task path: /Users/grybak/working/virtualenvs/roletest2.2/ansible-eos-ipv4/issue.yml:6
&lt;dut&gt; using connection plugin network_cli
Using module file /Users/grybak/working/virtualenvs/roletest2.2/ansible/lib/ansible/modules/network/eos/eos_config.py
&lt;dut&gt; ESTABLISH LOCAL CONNECTION FOR USER: grybak
&lt;dut&gt; EXEC /bin/sh -c 'echo ~ &amp;&amp; sleep 0'
&lt;dut&gt; EXEC /bin/sh -c '( umask 77 &amp;&amp; mkdir -p &quot;` echo /Users/grybak/.ansible/tmp/ansible-tmp-1495237579.37-206099913710316 `&quot; &amp;&amp; echo ansible-tmp-1495237579.37-206099913710316=&quot;` echo /Users/grybak/.ansible/tmp/ansible-tmp-1495237579.37-206099913710316 `&quot; ) &amp;&amp; sleep 0'
&lt;dut&gt; PUT /var/folders/b7/n3q7cy3x35q5nyd13s82g4340000gp/T/tmpP4529P TO /Users/grybak/.ansible/tmp/ansible-tmp-1495237579.37-206099913710316/eos_config.py
&lt;dut&gt; EXEC /bin/sh -c 'chmod u+x /Users/grybak/.ansible/tmp/ansible-tmp-1495237579.37-206099913710316/ /Users/grybak/.ansible/tmp/ansible-tmp-1495237579.37-206099913710316/eos_config.py &amp;&amp; sleep 0'
&lt;dut&gt; EXEC /bin/sh -c '/usr/bin/python /Users/grybak/.ansible/tmp/ansible-tmp-1495237579.37-206099913710316/eos_config.py; rm -rf &quot;/Users/grybak/.ansible/tmp/ansible-tmp-1495237579.37-206099913710316/&quot; &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'
changed: [dut] =&gt; {
    &quot;changed&quot;: true,
    &quot;commands&quot;: [
        &quot;interface Ethernet2&quot;,
        &quot;switchport mode access&quot;
    ],
    &quot;invocation&quot;: {
        &quot;module_args&quot;: {
            &quot;after&quot;: null,
            &quot;auth_pass&quot;: null,
            &quot;authorize&quot;: true,
            &quot;backup&quot;: false,
            &quot;before&quot;: null,
            &quot;config&quot;: null,
            &quot;defaults&quot;: false,
            &quot;force&quot;: false,
            &quot;host&quot;: &quot;dut&quot;,
            &quot;lines&quot;: [
                &quot;switchport mode access&quot;
            ],
            &quot;match&quot;: &quot;line&quot;,
            &quot;parents&quot;: [
                &quot;interface Ethernet2&quot;
            ],
            &quot;password&quot;: &quot;VALUE_SPECIFIED_IN_NO_LOG_PARAMETER&quot;,
            &quot;port&quot;: 443,
            &quot;provider&quot;: {
                &quot;auth_pass&quot;: null,
                &quot;authorize&quot;: true,
                &quot;host&quot;: &quot;dut&quot;,
                &quot;password&quot;: &quot;VALUE_SPECIFIED_IN_NO_LOG_PARAMETER&quot;,
                &quot;port&quot;: null,
                &quot;ssh_keyfile&quot;: null,
                &quot;timeout&quot;: null,
                &quot;transport&quot;: &quot;cli&quot;,
                &quot;use_ssl&quot;: false,
                &quot;username&quot;: &quot;VALUE_SPECIFIED_IN_NO_LOG_PARAMETER&quot;,
                &quot;validate_certs&quot;: null
            },
            &quot;replace&quot;: &quot;line&quot;,
            &quot;save&quot;: false,
            &quot;src&quot;: null,
            &quot;ssh_keyfile&quot;: null,
            &quot;timeout&quot;: null,
            &quot;transport&quot;: &quot;cli&quot;,
            &quot;use_ssl&quot;: true,
            &quot;username&quot;: &quot;VALUE_SPECIFIED_IN_NO_LOG_PARAMETER&quot;,
            &quot;validate_certs&quot;: true
        }
    },
    &quot;session&quot;: &quot;ansible_1495237579&quot;,
    &quot;updates&quot;: [
        &quot;interface Ethernet2&quot;,
        &quot;switchport mode access&quot;
    ]
}
META: ran handlers
META: ran handlers

PLAY RECAP *******************************************************************************
dut                        : ok=1    changed=1    unreachable=0    failed=0
"><pre class="notranslate"><code class="notranslate">No config file found; using defaults

PLAYBOOK: issue.yml **********************************************************************
1 plays in issue.yml

PLAY [test_hosts] ************************************************************************
META: ran handlers

TASK [Update Ethernet2] ******************************************************************
task path: /Users/grybak/working/virtualenvs/roletest2.2/ansible-eos-ipv4/issue.yml:6
&lt;dut&gt; using connection plugin network_cli
Using module file /Users/grybak/working/virtualenvs/roletest2.2/ansible/lib/ansible/modules/network/eos/eos_config.py
&lt;dut&gt; ESTABLISH LOCAL CONNECTION FOR USER: grybak
&lt;dut&gt; EXEC /bin/sh -c 'echo ~ &amp;&amp; sleep 0'
&lt;dut&gt; EXEC /bin/sh -c '( umask 77 &amp;&amp; mkdir -p "` echo /Users/grybak/.ansible/tmp/ansible-tmp-1495237579.37-206099913710316 `" &amp;&amp; echo ansible-tmp-1495237579.37-206099913710316="` echo /Users/grybak/.ansible/tmp/ansible-tmp-1495237579.37-206099913710316 `" ) &amp;&amp; sleep 0'
&lt;dut&gt; PUT /var/folders/b7/n3q7cy3x35q5nyd13s82g4340000gp/T/tmpP4529P TO /Users/grybak/.ansible/tmp/ansible-tmp-1495237579.37-206099913710316/eos_config.py
&lt;dut&gt; EXEC /bin/sh -c 'chmod u+x /Users/grybak/.ansible/tmp/ansible-tmp-1495237579.37-206099913710316/ /Users/grybak/.ansible/tmp/ansible-tmp-1495237579.37-206099913710316/eos_config.py &amp;&amp; sleep 0'
&lt;dut&gt; EXEC /bin/sh -c '/usr/bin/python /Users/grybak/.ansible/tmp/ansible-tmp-1495237579.37-206099913710316/eos_config.py; rm -rf "/Users/grybak/.ansible/tmp/ansible-tmp-1495237579.37-206099913710316/" &gt; /dev/null 2&gt;&amp;1 &amp;&amp; sleep 0'
changed: [dut] =&gt; {
    "changed": true,
    "commands": [
        "interface Ethernet2",
        "switchport mode access"
    ],
    "invocation": {
        "module_args": {
            "after": null,
            "auth_pass": null,
            "authorize": true,
            "backup": false,
            "before": null,
            "config": null,
            "defaults": false,
            "force": false,
            "host": "dut",
            "lines": [
                "switchport mode access"
            ],
            "match": "line",
            "parents": [
                "interface Ethernet2"
            ],
            "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "port": 443,
            "provider": {
                "auth_pass": null,
                "authorize": true,
                "host": "dut",
                "password": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "port": null,
                "ssh_keyfile": null,
                "timeout": null,
                "transport": "cli",
                "use_ssl": false,
                "username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
                "validate_certs": null
            },
            "replace": "line",
            "save": false,
            "src": null,
            "ssh_keyfile": null,
            "timeout": null,
            "transport": "cli",
            "use_ssl": true,
            "username": "VALUE_SPECIFIED_IN_NO_LOG_PARAMETER",
            "validate_certs": true
        }
    },
    "session": "ansible_1495237579",
    "updates": [
        "interface Ethernet2",
        "switchport mode access"
    ]
}
META: ran handlers
META: ran handlers

PLAY RECAP *******************************************************************************
dut                        : ok=1    changed=1    unreachable=0    failed=0

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