Repository: ansible/ansible

Issue:
nxos_config intended should be intended_config
##### ISSUE TYPE
 - Documentation Report

##### COMPONENT NAME
nxos_config module
http://docs.ansible.com/ansible/latest/nxos_config_module.html

##### ANSIBLE VERSION
N/A

##### CONFIGURATION
N/A

##### OS / ENVIRONMENT
N/A

##### SUMMARY
The example shown in the documentation is wrong, it won't actually work (intended versus intended_config).  The intended_config is even shown in the parameters above (which are right).

##### STEPS TO REPRODUCE
```yaml
- name: diff the running-config against a provided config
  nxos_config:
    diff_against: intended
    intended: "{{ lookup('file', 'master.cfg') }}"
```


##### EXPECTED RESULTS
Playbook can run without failing on 
```"msg": "Unsupported parameters for (nxos_config) module: intended Supported parameters include: after,backup,before,defaults,diff_against,diff_ignore_lines,force,host,intended_config,lines,match,parents,password,port,provider,replace,running_config,save,save_when,src,ssh_keyfile,timeout,transport,use_ssl,username,validate_certs"
```
##### ACTUAL RESULTS

```
[root@localhost ~]# ansible-playbook --diff prompt_example.yml

PLAY [cisco] ****************************************************************************************************************************************************************************************************************************

TASK [diff the running-config against a provided config] ********************************************************************************************************************************************************************************
[DEPRECATION WARNING]: Param 'transport' is deprecated. See the module docs for more information. This feature will be removed in version 2.9. Deprecation warnings can be disabled by setting deprecation_warnings=False in
ansible.cfg.
fatal: [n9k]: FAILED! => {"changed": false, "failed": true, "msg": "Unsupported parameters for (nxos_config) module: intended Supported parameters include: after,backup,before,defaults,diff_against,diff_ignore_lines,force,host,intended_config,lines,match,parents,password,port,provider,replace,running_config,save,save_when,src,ssh_keyfile,timeout,transport,use_ssl,username,validate_certs"}
	to retry, use: --limit @/root/prompt_example.retry

PLAY RECAP ******************************************************************************************************************************************************************************************************************************
n9k                        : ok=0    changed=0    unreachable=0    failed=1

[root@localhost ~]# ansible-playbook --diff prompt_example.yml -vvvv
ansible-playbook 2.5.0
  config file = /root/ansible.cfg
  configured module search path = [u'/usr/lib/python2.7/site-packages/napalm_ansible']
  ansible python module location = /usr/lib/python2.7/site-packages/ansible
  executable location = /usr/bin/ansible-playbook
  python version = 2.7.5 (default, Aug  4 2017, 00:39:18) [GCC 4.8.5 20150623 (Red Hat 4.8.5-16)]
Using /root/ansible.cfg as config file
setting up inventory plugins
Set default localhost to localhost
Parsed /root/hosts inventory source with ini plugin
Loading callback plugin default of type stdout, v2.0 from /usr/lib/python2.7/site-packages/ansible/plugins/callback/__init__.pyc

PLAYBOOK: prompt_example.yml ************************************************************************************************************************************************************************************************************
1 plays in prompt_example.yml

PLAY [cisco] ****************************************************************************************************************************************************************************************************************************
META: ran handlers

TASK [diff the running-config against a provided config] ********************************************************************************************************************************************************************************
task path: /root/prompt_example.yml:5
File lookup using /root/nxos_base.cfg as file
<192.168.2.3> connection transport is cli
<192.168.2.3> using connection plugin network_cli
<192.168.2.3> socket_path: /root/.ansible/pc/f7aec45378
Using module file /usr/lib/python2.7/site-packages/ansible/modules/network/nxos/nxos_config.py
<192.168.2.3> ESTABLISH LOCAL CONNECTION FOR USER: root
<192.168.2.3> EXEC /bin/sh -c 'echo ~ && sleep 0'
<192.168.2.3> EXEC /bin/sh -c '( umask 77 && mkdir -p "` echo /root/.ansible/tmp/ansible-tmp-1506529319.72-174572742773875 `" && echo ansible-tmp-1506529319.72-174572742773875="` echo /root/.ansible/tmp/ansible-tmp-1506529319.72-174572742773875 `" ) && sleep 0'
<192.168.2.3> PUT /tmp/tmpVp9oMN TO /root/.ansible/tmp/ansible-tmp-1506529319.72-174572742773875/nxos_config.py
<192.168.2.3> EXEC /bin/sh -c 'chmod u+x /root/.ansible/tmp/ansible-tmp-1506529319.72-174572742773875/ /root/.ansible/tmp/ansible-tmp-1506529319.72-174572742773875/nxos_config.py && sleep 0'
<192.168.2.3> EXEC /bin/sh -c '/usr/bin/python /root/.ansible/tmp/ansible-tmp-1506529319.72-174572742773875/nxos_config.py; rm -rf "/root/.ansible/tmp/ansible-tmp-1506529319.72-174572742773875/" > /dev/null 2>&1 && sleep 0'
[DEPRECATION WARNING]: Param 'transport' is deprecated. See the module docs for more information. This feature will be removed in version 2.9. Deprecation warnings can be disabled by setting deprecation_warnings=False in
ansible.cfg.
fatal: [n9k]: FAILED! => {
    "changed": false,
    "failed": true,
    "invocation": {
        "module_args": {
            "diff_against": "intended",
            "intended": "!Command: show running-config\n!Time: Tue Sep 19 22:45:38 2017\n\nversion 7.0(3)I7(1)\nvdc switch id 1\n  limit-resource vlan minimum 16 maximum 4094\n  limit-resource vrf minimum 2 maximum 4096\n  limit-resource port-channel minimum 0 maximum 511\n  limit-resource u4route-mem minimum 248 maximum 248\n  limit-resource u6route-mem minimum 96 maximum 96\n  limit-resource m4route-mem minimum 58 maximum 58\n  limit-resource m6route-mem minimum 8 maximum 8\nfeature nxapi\nfeature scp-server\n\nusername admin password 5 $5$2RzjXhgx$xZRU9GHh6fdN2koy1r6pJMIXpTIo2tP.ZZ6YI7Z11Y3  role network-admin\nusername exampleuser password 5 $5$itSlZrxc$gixqzCwyQjO4SBjrMsu2k2qkWD1H7fygx7qYuzhgFp8  role network-admin\n\nbanner motd @\nthis is a fake banner\n@\n\nip domain-lookup\nsnmp-server user admin network-admin auth md5 0xc1ddb036df145c775510428fe3c6b553 priv 0xc1ddb036df145c775510428fe3c6b553 localizedkey\nsnmp-server user exampleuser network-admin auth sha 0x7071c014b53743ca568dd2c3fd70005c5e21db5e localizedkey\nrmon event 1 description FATAL(1) owner PMON@FATAL\nrmon event 2 description CRITICAL(2) owner PMON@CRITICAL\nrmon event 3 description ERROR(3) owner PMON@ERROR\nrmon event 4 description WARNING(4) owner PMON@WARNING\nrmon event 5 description INFORMATION(5) owner PMON@INFO\n\nvlan 1,10\nvlan 10\n  name STORAGE\n\nvrf context management\n\ninterface Ethernet1/1\n\ninterface Ethernet1/2\n\ninterface Ethernet1/3\n\ninterface Ethernet1/4\n\ninterface Ethernet1/5\n\ninterface Ethernet1/6\n\ninterface Ethernet1/7\n\ninterface Ethernet1/8\n\ninterface Ethernet1/9\n\ninterface Ethernet1/10\n\ninterface Ethernet1/11\n\ninterface Ethernet1/12\n\ninterface Ethernet1/13\n\ninterface Ethernet1/14\n\ninterface Ethernet1/15\n\ninterface Ethernet1/16\n\ninterface Ethernet1/17\n\ninterface Ethernet1/18\n\ninterface Ethernet1/19\n\ninterface Ethernet1/20\n  no switchport\n  ip address 172.16.1.1/24\n\ninterface Ethernet1/21\n\ninterface Ethernet1/22\n\ninterface Ethernet1/23\n\ninterface Ethernet1/24\n\ninterface Ethernet1/25\n\ninterface Ethernet1/26\n\ninterface Ethernet1/27\n\ninterface Ethernet1/28\n\ninterface Ethernet1/29\n\ninterface Ethernet1/30\n\ninterface Ethernet1/31\n\ninterface Ethernet1/32\n\ninterface Ethernet1/33\n\ninterface Ethernet1/34\n\ninterface Ethernet1/35\n\ninterface Ethernet1/36\n\ninterface Ethernet1/37\n\ninterface Ethernet1/38\n\ninterface Ethernet1/39\n\ninterface Ethernet1/40\n\ninterface Ethernet1/41\n\ninterface Ethernet1/42\n\ninterface Ethernet1/43\n\ninterface Ethernet1/44\n\ninterface Ethernet1/45\n\ninterface Ethernet1/46\n\ninterface Ethernet1/47\n\ninterface Ethernet1/48\n\ninterface Ethernet1/49\n\ninterface Ethernet1/50\n\ninterface Ethernet1/51\n\ninterface Ethernet1/52\n\ninterface Ethernet1/53\n\ninterface Ethernet1/54\n\ninterface Ethernet1/55\n\ninterface Ethernet1/56\n\ninterface Ethernet1/57\n\ninterface Ethernet1/58\n\ninterface Ethernet1/59\n\ninterface Ethernet1/60\n\ninterface Ethernet1/61\n\ninterface Ethernet1/62\n\ninterface Ethernet1/63\n\ninterface Ethernet1/64\n  description this is a port change\n\ninterface mgmt0\n  description this is the mgmt0 port\n  vrf member management\n  ip address 192.168.2.3/24\nline console\nline vty\nboot nxos bootflash:/nxos.7.0.3.I7.1.bin \nip route 0.0.0.0/0 192.168.2.1",
            "provider": {
                "host": null,
                "password": "Bullf00d",
                "port": null,
                "ssh_keyfile": null,
                "timeout": null,
                "transport": "cli",
                "use_ssl": null,
                "username": "admin",
                "validate_certs": null
            },
            "transport": "cli"
        }
    },
    "msg": "Unsupported parameters for (nxos_config) module: intended Supported parameters include: after,backup,before,defaults,diff_against,diff_ignore_lines,force,host,intended_config,lines,match,parents,password,port,provider,replace,running_config,save,save_when,src,ssh_keyfile,timeout,transport,use_ssl,username,validate_certs"
}
	to retry, use: --limit @/root/prompt_example.retry

PLAY RECAP ******************************************************************************************************************************************************************************************************************************
n9k                        : ok=0    changed=0    unreachable=0    failed=1
```



Discussion:
cc @GGabriele @Qalthos @ganeshrn @gundalow @jedelman8 @mikewiebe @privateip @rahushen @rcarrillocruz @trishnaguha
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->
The correct argument is `intended_config`. The given example in Doc uses `intended` which is wrong. 
The play should look like: 
```
- name: diff the running-config against a provided config
  nxos_config:
    diff_against: intended
    intended_config: "{{ lookup('file', 'master.cfg') }}"
```

Resolving patch:
diff --git a/lib/ansible/modules/network/nxos/nxos_config.py b/lib/ansible/modules/network/nxos/nxos_config.py
--- a/lib/ansible/modules/network/nxos/nxos_config.py
+++ b/lib/ansible/modules/network/nxos/nxos_config.py
@@ -227,7 +227,7 @@
 - name: diff the running-config against a provided config
   nxos_config:
     diff_against: intended
-    intended: "{{ lookup('file', 'master.cfg') }}"
+    intended_config: "{{ lookup('file', 'master.cfg') }}"
 
 - nxos_config:
     lines:


Test patch: