Issue 1:
The following command fails with a syntax error because of

- command: "{{ venv_dir }}/bin/gunicorn --config=gunicorn.conf"

But the following succeeds:

- action: command "{{ venv_dir }}/bin/gunicorn" --config=gunicorn.conf

It should be possible to use variables directly in a command.

Issue 2:
ISSUE TYPE

Bug Report

COMPONENT NAME

lib/ansible/modules/network/eos/eos_config.py

ANSIBLE VERSION

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)]

CONFIGURATION

N/A

OS / ENVIRONMENT

Using Ansible to configure an Arista EOS switch

SUMMARY

Configuration request always reports 'changed', even on subsequent

runs of the same playbook.

STEPS TO REPRODUCE

Ethernet2 is used as an example.

Set the switchport mode of Ethernet2 to trunk by issuing the commands

dut(config)#interface Ethernet2
dut(config-if-Et2)#switchport mode trunk
dut(config-if-Et2)#exit

Verify the switchport mode is trunk on the switch:

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
...

Run a playbook with a task to call eos_config that changes the

switchport mode to access, e.g.

ansible-playbook issue.yml -i hosts -e '{"lines": ["switchport mode access"], "parents": ["interface Ethernet2"], "match": "line", "description": "Update Ethernet2"}' -vvv

Verify the switchport mode was changed to access on the switch:

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
...

Run the same ansible-playbook command again and check the status of the run.

Transport was cli when this issue was discovered. May also affect eapi.

Same issue was seen when removing the ip address for Ethernet2 with

"lines" set to ["no ip address"] on the ansible-playbook command.

- hosts: test_hosts
gather_facts: no
connection: local

tasks:
- name: "{{ description | default('config playbook task') }}"
eos_config:
lines: "{{ lines | default(['']) }}"
parents: "{{ parents | default(omit) }}"
before: "{{ before | default(omit) }}"
after: "{{ after | default(omit) }}"
match: "{{ match | default('none')}}"
auth_pass: "{{ auth_pass | default(omit) }}"
authorize: "{{ authorize | default(omit) }}"
host: "{{ host | default(omit) }}"
password: "{{ password | default(omit) }}"
port: "{{ port | default(omit) }}"
provider: "{{ provider | default(omit) }}"
transport: "cli"
use_ssl: "{{ use_ssl | default(omit) }}"
username: "{{ username | default(omit) }}"

EXPECTED RESULTS

After initial run, interface Ethernet2 switchport mode is access, and the

results show 1 change.

After second and subsequent runs, the results should show no changes

since Ethernet2 switchport mode is currently set to access.

ACTUAL RESULTS

After second and subsequent runs, the results still show 1 change taking

place. Second run output below.

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
<dut> using connection plugin network_cli
Using module file /Users/grybak/working/virtualenvs/roletest2.2/ansible/lib/ansible/modules/network/eos/eos_config.py
<dut> ESTABLISH LOCAL CONNECTION FOR USER: grybak
<dut> EXEC /bin/sh -c 'echo ~ && sleep 0'
<dut> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /Users/grybak/.ansible/tmp/ansible-tmp-1495237579.37-206099913710316 `" && echo ansible-tmp-1495237579.37-206099913710316="` echo /Users/grybak/.ansible/tmp/ansible-tmp-1495237579.37-206099913710316 `" ) && sleep 0'
<dut> PUT /var/folders/b7/n3q7cy3x35q5nyd13s82g4340000gp/T/tmpP4529P TO /Users/grybak/.ansible/tmp/ansible-tmp-1495237579.37-206099913710316/eos_config.py
<dut> 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 && sleep 0'
<dut> 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/" > /dev/null 2>&1 && sleep 0'
changed: [dut] => {
"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