Re: [ansible-project] AnsibleConnectionFailure: Name or service not known

164 views
Skip to first unread message
Message has been deleted

Dick Visser

unread,
Mar 4, 2020, 10:14:06 AM3/4/20
to ansible...@googlegroups.com
On Wed, 4 Mar 2020 at 14:45, Meyna88 <meyn...@gmail.com> wrote:


> fatal: [cisco]: FAILED! => {
> "msg": "[Errno -2] Name or service not known"

You are trying to connect to a host called 'cisco' but that does not
resolve to something.

So, you should fix your inventory (which you didn't post BTW, so we
can't tell what's exactly wrong with that).


--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT
Message has been deleted

Dick Visser

unread,
Mar 4, 2020, 11:00:57 AM3/4/20
to ansible...@googlegroups.com
Could you please state clearly ALL of the below:

- What goal you are trying to achieve.
- How you are doing this.
- What problems you encounter.
- Which command did you run, and what actual output did you get from
that (copied as plain text - not as images, attachments, or
screenshots).
- What the relevant tasks/playbooks/code/variables look like.

thx


On Wed, 4 Mar 2020 at 16:52, Meyna88 <meyn...@gmail.com> wrote:
>
> inventory:
>
> [local]
> localhost
>
> [switch:children]
> hosts
>
> [hosts]
> sw host=xx.xx.xx.xx
>
>
> [switch:vars]
> username = xxx
> password = xxx
> password_enable = xxx
> ansible_connection = network_cli
> ansible_network_os = ios
> ansible_user = xxx
> ansible_password = xxx
> ansible_become = yes
> ansible_become_method = enable
>
>
>
> Le mercredi 4 mars 2020 14:45:18 UTC+1, Meyna88 a écrit :
>>
>> Bonjour;
>>
>> Lorsque j'essaie d'exécuter playbook via une connexion network_cli, je reçois toujours les erreurs suivantes: AnsibleConnectionFail ure [Errno -2] Nom ou service inconnu
>> J'ai besoin de vos suggestions.
>>
>> Rapport d'erreur
>>
>> Nom du composant:
>>
>> connexion: network_cli
>>
>>
>>
>> Version:
>> ansible 2.7.6
>> config file = /etc/ansible/cisco/test/paramiko/ansible.cfg
>> chemin de recherche du module configuré = [u '/ etc / ansible / ntc-ansible / ntc-ansible / library']
>> emplacement du module python ansible = /usr/lib/python2.7/site- packages / ansible
>> emplacement exécutable = / bin / ansible
>> version python = 2.7.5 (par défaut, 7 août 2019, 00:51:29) [GCC 4.8.5 20150623 (Red Hat 4.8.5-39)]
>>
>> Environnement:
>>
>> Système d'exploitation Ansible: système d'
>> exploitation géré Red Hat Linux : Cisco IOS
>>
>>
>>
>> Utilisation de la connexion: network_cli déclenche AnsibleConnectionFailure [ Errno -2] Nom ou service inconnu
>>
>>
>>
>> Définition de ansible.conf
>>
>> [paramiko_connection]
>> look_for_keys=False
>>
>>
>> Playbook :
>>
>> - name: Cisco Catalyse
>> hôtes: hôtes
>> recueillir_facts: non
>>
>> dans lesquels:
>> compliant_ios_version: xxx
>> ansible_python_interpreter: /usr/bin/python3.6
>>
>> Tâches:
>> - nom: faits cisco
>> ios_facts:
>>
>> - nom: copie de l'image au flash
>> ios_command:
>> commander:
>> - "copie sftp: //XXX/XXX.bin bootflash:"
>> dans lesquels:
>> ansible_command_timeout: 18000
>> delay_factor: 12
>>
>>
>> group_vars: hosts.yml
>>
>> ansible_network_os: ios
>> ansible_user: utilisateur
>> ansible_pass: mot de passe
>> ansible_connection: network_cli
>> ansible_become_method: activer
>> ansible_become: oui
>>
>>
>> Résultats actuels:
>>
>>
>> Le retraçage complet est:
>> Traceback (dernier appel le plus récent):
>> Fichier "/ bin / ansible-connection", ligne 106, au début
>> self.connection._connect ()
>> Fichier "/usr/lib/python2.7/site- packages / ansible / plugins / connection / network_cli.py", ligne 307, dans _connect
>> ssh = self.paramiko_conn._connect ()
>> Fichier "/usr/lib/python2.7/site- packages / ansible / plugins / connection / paramiko_ssh.py", ligne 250, dans _connect
>> self.ssh = SSH_CONNECTION_CACHE [cache_ key] = self._connect_uncached ()
>> Fichier "/usr/lib/python2.7/site- packages / ansible / plugins / connection / paramiko_ssh.py", ligne 370, dans _connect_uncached
>> augmenter AnsibleConnectionFailure (msg)
>> AnsibleConnectionFailure: [Errno -2] Nom ou service inconnu
>>
>> fatal: [cisco]: ÉCHEC! => {
>> "msg": "[Errno -2] Nom ou service inconnu"
>>
> --
> 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 ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/b9897d94-e6d9-46e7-896a-88e7629ee7e8%40googlegroups.com.
Message has been deleted

Dick Visser

unread,
Mar 4, 2020, 11:36:49 AM3/4/20
to ansible...@googlegroups.com
Hi


You didn't say what command you ran. How did you invoke ansible-playbook?

On Wed, 4 Mar 2020 at 17:16, Meyna88 <meyn...@gmail.com> wrote:
>
> Hi;
>
> my goal is to update the cisco switch image. I wanted to use the network_cli module not the local connection.
> All variables are well defined in hots.yml in group_vars the command is to copy the image of cisco (playbook)
>
>
> error output:
>
>
> The full traceback is: Traceback (most recent call last): File "/bin/ansible-connection", line 106, in start self.connection._connect() File "/usr/lib/python2.7/site-packages/ansible/plugins/connection/network_cli.py", line 307, in _connect ssh = self.paramiko_conn._connect() File "/usr/lib/python2.7/site-packages/ansible/plugins/connection/paramiko_ssh.py", line 250, in _connect self.ssh = SSH_CONNECTION_CACHE[cache_key] = self._connect_uncached() File "/usr/lib/python2.7/site-packages/ansible/plugins/connection/paramiko_ssh.py", line 370, in _connect_uncached raise AnsibleConnectionFailure(msg) AnsibleConnectionFailure: [Errno -2] Name or service not known fatal: [switch-test]: FAILED! => { "msg": "[Errno -2] Name or service not known" }
>
> Le mercredi 4 mars 2020 17:00:57 UTC+1, Dick Visser a écrit :
>>
>> Pourriez-vous s'il vous plaît indiquer clairement TOUT ce qui suit:
>>
>> - Quel objectif vous essayez d'atteindre.
>> - Comment tu fais ça.
>> - Quels problèmes vous rencontrez.
>> - Quelle commande avez-vous exécutée et quelle sortie réelle en avez-vous tirée
>> (copiée sous forme de texte brut - pas sous forme d'images, de pièces jointes ou de
>> captures d'écran).
>> - À quoi ressemblent les tâches / manuels / codes / variables pertinents.
>>
>> thx
>>
>>
>> Le Mer 4 Mar 2020 au 16:52, Meyna88 < Meyn ... @ gmail.com > a écrit:
>> >
>> > inventaire:
>> >
>> > [local]
>> > localhost
>> >
>> > [commutateur: enfants]
>> > hôtes
>> >
>> > [hôtes]
>> > sw host = xx.xx.xx.xx
>> >> dans ceux qui:
>> >> ansible_command_timeout: 18000
>> >> delay_factor: 12
>> >>
>> >>
>> >> group_vars: hosts.yml
>> >>
>> >> ansible_network_os: ios
>> >> ansible_user: utilisateur
>> >> ansible_pass: mot de passe
>> >> ansible_connection: network_cli
>> >> ansible_become_method: activer
>> >> ansible_become: oui
>> >>
>> >>
>> >> Résultats actuels:
>> >>
>> >>
>> >> Le retraçage complet est:
>> >> Traceback (dernier appel le plus récent):
>> >> Fichier "/ bin / ansible-connection", ligne 106, au début
>> >> self.connection._connect ()
>> >> Fichier "/usr/lib/python2.7/ site- packages / ansible / plugins / connection / network_cli.py ", ligne 307, dans _connect
>> >> ssh = self.paramiko_conn._connect ()
>> >> Fichier" /usr/lib/python2.7/site- packages / ansible / plugins / connection / paramiko_ssh.py ", ligne 250, dans _connect
>> >> self.ssh = SSH_CONNECTION_CACHE [cache_ key] = self._connect_uncached ()
>> >> Fichier" /usr/lib/python2.7/site- packages / ansible / plugins / connection / paramiko_ssh.py ", ligne 370, dans _connect_uncached
>> >> augmenter AnsibleConnectionFailure (msg)
>> >> AnsibleConnectionFailure: [Errno -2] Nom ou service inconnu
>> >>
>> >> fatal: [cisco]: ÉCHEC! => {
>> >> "msg": "[Errno -2] Nom du service de la Nécrites"
>> >>
>> >>
>> Vous avez reçu ce message parce que vous êtes abonné au groupe Google Groupes "Projet Ansible".
>> > Pour résilier votre abonnement de ce groupe et ne plus en recevoir d'e-mails, envoyez un e-mail à ansible ... @ googlegroups.com .
>> > Pour afficher cette discussion sur le Web, visitez https://groups.google.com/d/ msgid / ansible-project / b9897d94-e6d9-46e7-896a- 88e7629ee7e8% 40googlegroups. com .
>>
>>
>>
>> -
>> Dick Visser
>> Trust &
>> GÉANT
>
> --
> 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 ansible-proje...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0aff1a95-502c-473c-8603-6dd2ac0afe06%40googlegroups.com.
Message has been deleted
Message has been deleted

Dick Visser

unread,
Mar 4, 2020, 1:08:16 PM3/4/20
to ansible...@googlegroups.com
You don’t understand. 

HOW do you execute the playbook?



On Wed, 4 Mar 2020 at 17:46, Meyna88 <meyn...@gmail.com> wrote:
Hi;

As i already indicated above, the playbook executes the gats_facts module of switch to add all the fact keys of the basic network.
then I used " copy sftp://XXX/XXX.bin  bootflash:" to copy the ios image in flash disk of switch. 

Playbook:

- name:  Cisco Catalyse
  hosts: hosts
  gather_facts: no

  vars:
    compliant_ios_version: xxx
    ansible_python_interpreter: /usr/bin/python3.6

  tasks:
    - name:  cisco facts
      ios_facts:

    - name: Copying image to flash
      ios_command:
        command:
          - "copy sftp://XXX/XXX.bin  bootflash:"
      vars:
        ansible_command_timeout: 18000
        delay_factor: 12 
> To unsubscribe from this group and stop receiving emails from it, send an email to ansible...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/0aff1a95-502c-473c-8603-6dd2ac0afe06%40googlegroups.com.



--
Dick Visser
Trust & Identity Service Operations Manager
GÉANT

--
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 ansible-proje...@googlegroups.com.
--
Sent from a mobile device - please excuse the brevity, spelling and punctuation.
Reply all
Reply to author
Forward
0 new messages