If it's indicated above, I missed it: Is it the "sros_config" task (i.e.
"community.network.sroc_config") that's generating the traceback?
The first error appears to come from
.../netcommon/plugins/plugin_utils/connection_base.py, but I don't see any
connection configuration in what you've shown us. Perhaps there's a missing
connection definition required to configure your device?
Does the generated
"files/interfaces/PE/{{inventory_hostname}}_out-deploy-interfaces_nk_sr"
file appear to contain the correct contents? Can you share it with us?
You might get your playbook and roles to pass ansible-lint cleanly. It's
highly opinionated about stylistic issues, but it makes you think about
non-obvious issues. Highly recommended. (I don't expect it to "fix" the
problem, but the process will eliminate a lot of potential issues.)
Otherwise, I'm having a hard time coming up with suggestions.
On Sunday, April 9, 2023 at 9:26:46 AM UTC-4 Youssef Elahmadi wrote:
> Dear [Group Members],
>
> I hope this email finds you well. I am reaching out to ask for your
> assistance with an issue I am facing in my project involving Ansible for a
> Nokia equipment.
>
> I have encountered some difficulties in configuring the equipment using
> Ansible and I am in need of some guidance and support
>
> I would greatly appreciate it if any of you who have experience working
> with this technology could lend me a hand
> this is the output :
>
> The full traceback is:
> Traceback (most recent call last):
> File
> "/home/srv_22/.ansible/collections/ansible_collections/ansible/netcommon/plugins/plugin_utils/connection_base.py",
>
> line 42, in __getattr__
> return self.__dict__[name]
> KeyError: '_nonetype'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File
> "/home/srv_22/.local/lib/python3.10/site-packages/ansible/executor/task_executor.py",
>
> line 1005, in _set_plugin_options
> plugin = getattr(self._connection, '_%s' % plugin_type)
> File
> "/home/srv_22/.ansible/collections/ansible_collections/ansible/netcommon/plugins/plugin_utils/connection_base.py",
>
> line 50, in __getattr__
> raise AttributeError(
> AttributeError: 'Connection' object has no attribute '_nonetype'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File
> "/home/srv_22/.ansible/collections/ansible_collections/ansible/netcommon/plugins/plugin_utils/connection_base.py",
>
> line 42, in __getattr__
> return self.__dict__[name]
> KeyError: 'nonetype'
>
> During handling of the above exception, another exception occurred:
>
> Traceback (most recent call last):
> File
> "/home/srv_22/.local/lib/python3.10/site-packages/ansible/executor/task_executor.py",
>
> line 158, in run
> res = self._execute()
> File
> "/home/srv_22/.local/lib/python3.10/site-packages/ansible/executor/task_executor.py",
>
> line 560, in _execute
> plugin_vars = self._set_connection_options(cvars, templar)
> File
> "/home/srv_22/.local/lib/python3.10/site-packages/ansible/executor/task_executor.py",
>
> line 1087, in _set_connection_options
> varnames.extend(self._set_plugin_options(plugin_type, variables,
> templar, task_keys))
> File
> "/home/srv_22/.local/lib/python3.10/site-packages/ansible/executor/task_executor.py",
>
> line 1008, in _set_plugin_options
> plugin = getattr(self._connection, plugin_type)
> File
> "/home/srv_22/.ansible/collections/ansible_collections/ansible/netcommon/plugins/plugin_utils/connection_base.py",
>
> line 50, in __getattr__
> raise AttributeError(
> AttributeError: 'Connection' object has no attribute 'nonetype'
> fatal: [PE1]: FAILED! => {
> "msg": "Unexpected failure during module execution: 'Connection'
> object has no attribute 'nonetype'",
> "stdout": ""
> }
>
> PLAY RECAP
> *************************************************************************************************************************************
> PE1 : ok=2 changed=0 unreachable=0
> failed=1 skipped=2 rescued=0 ignored=0
>
>
>
>
> Ansible task :
> ############################# nokia
> ##############################################
>
>
> - name: configuration des interfaces nk_sr
> template:
> src: templates/interface_conf_nk_sr.j2
> dest:
> files/interfaces/PE/{{inventory_hostname}}_out-deploy-interfaces_nk_sr
> delegate_to: localhost
> when: inventory_hostname in groups['nokia_sr_PE']
> ##################################################################
>
> - name: push configuration
> sros_config:
> src:
> files/interfaces/PE/{{inventory_hostname}}_out-deploy-interfaces_nk_sr
>
> when: inventory_hostname in groups['nokia_sr_PE']
> tags:
> - push
>
>
>
>
>
>
>
> playbook
> ---
> - name: configuration min
> hosts: nokia_sr_PE
> connection: local
> become: false
> become_method : sudo
> gather_facts: no
>
> vars_prompt:
> - name: "ansible_user"
> prompt: "Username ? "
> private: no
> - name: "ansible_ssh_pass"
> prompt: "Password ? "
> private: yes
>
> roles:
> - variables
> - deploy-interf
> ansible version :
>
> ansible [core 2.14.4]
> config file = /etc/ansible/ansible.cfg
> configured module search path =
> ['/home/srv_22/.ansible/plugins/modules',
> '/usr/share/ansible/plugins/modules']
> ansible python module location =
> /home/srv_22/.local/lib/python3.10/site-packages/ansible
> ansible collection location =
> /home/srv_22/.ansible/collections:/usr/share/ansible/collections
> executable location = /home/srv_22/.local/bin/ansible
> python version = 3.10.6 (main, Mar 10 2023, 10:55:28) [GCC 11.3.0]
> (/usr/bin/python3)
> jinja version = 3.0.3
> libyaml = True
>
> I used the xls_to_fact to read the variable in the XLs file:
> - name: Mise en variables du fichier XLSX (Classique)
> xls_to_facts:
> src: "Template/data.xlsx"
> delegate_to: localhost
> register : output
>
>
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/16f73547-6e8f-48ef-a532-78e9b913c65fn%40googlegroups.com.