Repository: ansible/ansible

Issue:
asa_config save: yes AttributeError:
##### ISSUE TYPE
 - Bug Report

##### COMPONENT NAME
asa_config 

##### ANSIBLE VERSION
<!--- Paste verbatim output from "ansible --version" between quotes below -->
```
asa_config 
```

##### CONFIGURATION
```
federico@federico:~/git/ansible_cisco $ ansible-config dump --only-changed
DEFAULT_HOST_LIST(/home/federico/git/ansible_cisco/ansible.cfg) = [u'/home/federico/git/ansible_cisco/hosts']
DEFAULT_ROLES_PATH(/home/federico/git/ansible_cisco/ansible.cfg) = [u'/home/federico/git/ansible_cisco/roles']
RETRY_FILES_ENABLED(/home/federico/git/ansible_cisco/ansible.cfg) = False
federico@federico:~/git/ansible_cisco $ 
```

##### OS / ENVIRONMENT
Ubuntu

##### SUMMARY
asa_cong save:yes doesn t save config and output an error

##### STEPS TO REPRODUCE

```
---
- hosts: cisco_test
  connection: local
  gather_facts: false

  vars:
    cisco_asa:
      host: "{{ ansible_host }}"
      username: "{{ username }}"
      password: "{{ password }}"
      authorize: "yes"
      auth_pass: "{{ auth_pass }}"
      transport: cli
      timeout: 30

  tasks:
    - name: add new snmp and remove the old one
      asa_config:
        lines:
          - snmp-server host transit 10.42.9.61 poll community SaNu9eSu
          - snmp-server host transit 10.42.9.62 poll community SaNu9eSu
#         - no snmp-server host transit 10.40.9.35 poll community
        provider: "{{ cisco_asa }}"
      register: result

    - name: save running to startup when modified
      asa_config:
        save: "yes"
        provider: "{{ cisco_asa }}"
      register: result

    - debug:
        var: result


```

<!--- You can also paste gist.github.com links for larger files -->

##### EXPECTED RESULTS
<!--- What did you expect to happen when running the steps above? -->

##### ACTUAL RESULTS
<!--- What actually happened? If possible run with extra verbosity (-vvvv) -->

<!--- Paste verbatim command output between quotes below -->
```
federico@federico:~/git/ansible_cisco $ ansible-playbook playbooks/update_snmp_test.yml 

PLAY [cisco_test] **********************************************************************************************************************************************************************

TASK [add new snmp and remove the old one] *********************************************************************************************************************************************
changed: [IE23PVPNFW01]

TASK [save running to startup when modified] *******************************************************************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: AttributeError: 'AnsibleModule' object has no attribute 'config'
fatal: [IE23PVPNFW01]: FAILED! => {"changed": false, "failed": true, "module_stderr": "Traceback (most recent call last):\n  File \"/tmp/ansible_Xm2VC4/ansible_module_asa_config.py\", line 328, in <module>\n    main()\n  File \"/tmp/ansible_Xm2VC4/ansible_module_asa_config.py\", line 322, in main\n    run(module, result)\n  File \"/tmp/ansible_Xm2VC4/ansible_module_asa_config.py\", line 273, in run\n    module.config.save_config()\nAttributeError: 'AnsibleModule' object has no attribute 'config'\n", "module_stdout": "", "msg": "MODULE FAILURE", "rc": 0}

PLAY RECAP *****************************************************************************************************************************************************************************
IE23PVPNFW01               : ok=1    changed=1    unreachable=0    failed=1   

```



Discussion:
cc @ogenstad @privateip
[click here for bot help](https://github.com/ansible/ansibullbot/blob/master/ISSUE_HELP.md)
<!--- boilerplate: notify --->

Resolving patch:
diff --git a/lib/ansible/modules/network/asa/asa_config.py b/lib/ansible/modules/network/asa/asa_config.py
--- a/lib/ansible/modules/network/asa/asa_config.py
+++ b/lib/ansible/modules/network/asa/asa_config.py
@@ -248,7 +248,7 @@ def run(module, result):
 
     if module.params['save']:
         if not module.check_mode:
-            module.config.save_config()
+            run_commands(module, 'write mem')
         result['changed'] = True
 
 def main():


Test patch: