--
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 post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/460f28a4-dcca-448e-9036-a550ccae46c9%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Hi Ajay,
test@TESTVM:/etc$ sudo chmod 700 /etc/ansible
sudo: /etc/sudoers is world writable
sudo: no valid sudoers sources found, quitting
sudo: unable to initialize policy plugin
Thanks,
Michael
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/36f66005-7bf2-432b-afc1-1f643202c6aa%40googlegroups.com.
I was able to fix the permission on Ubuntu, now back to the original error:
ansible all -i <switch_ip>, -c network_cli -u <username>-m ios_command_1.yml
[WARNING] Ansible is in a world writable directory (/etc/ansible), ignoring it as an ansible.cfg source.
10.11.32.100 | FAILED! => {
"msg": " [WARNING] Ansible is in a world writable directory (/etc/ansible), ignoring it as an ansible.cfg source.\n{\"socket_path\": \"/home/test/.ansible/pc/c5b7c67eba\", \"exception\": \"Traceback (most recent call last):\\n File \\\"/usr/bin/ansible-connection\\\", line 87, in start\\n self.connection._connect()\\n File \\\"/usr/lib/python2.7/dist-packages/ansible/plugins/connection/network_cli.py\\\", line 302, in _connect\\n self._ssh_shell = ssh.ssh.invoke_shell()\\nNameError: global name 'ssh' is not defined\\n\", \"messages\": [\"local domain socket does not exist, starting it\", \"control socket path is /home/test/.ansible/pc/c5b7c67eba\", \"\"], \"error\": \"global name 'ssh' is not defined\"}"
}
Do you know any straight forward fix?
Thanks,
Michael
--
You received this message because you are subscribed to a topic in the Google Groups "Ansible Project" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ansible-project/QaZFGSaMNpk/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ansible-proje...@googlegroups.com.
To post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5b6bb990.1c69fb81.eaa12.efee%40mx.google.com.
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 post to this group, send email to ansible...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAOr1PY-%2BWvzwpsTVgS%2BoAh8bA%3DOereARQmddC9C10WEpVX1dvg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAFYW21%3D2x4bDn%2B919zzPp8grf9BDyMMZwwgMzUBhdFC1e2fB0w%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAOr1PY8drHRUJ_FK8MXxjWnxtu%2B1XZ%3DfF0BtuNu2o01kWr3vNA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAFYW21kxHsEsUx-tqH79JJZTdwRbTcXUNRUoJzu7BGQcz3ZFCw%40mail.gmail.com.
Hi Ajay,
I tried with -k, it does not work:
netadmin@netadmin-Virtual-Machine:/etc/ansible$ ansible-playbook ios.yml -k
SSH password:
PLAY [10.11.32.100] ********************************************************************************************************************************************************************************
TASK [Gathering Facts] *****************************************************************************************************************************************************************************
[WARNING]: sftp transfer mechanism failed on [10.11.32.100]. Use ANSIBLE_DEBUG=1 to see detailed information
[WARNING]: scp transfer mechanism failed on [10.11.32.100]. Use ANSIBLE_DEBUG=1 to see detailed information
fatal: [10.11.32.100]: UNREACHABLE! => {"changed": false, "msg": "SSH Error: data could not be sent to remote host \"10.11.32.100\". Make sure this host can be reached over ssh", "unreachable": true}
[WARNING]: Could not create retry file '/etc/ansible/ios.retry'. [Errno 13] Permission denied: u'/etc/ansible/ios.retry'
PLAY RECAP *****************************************************************************************************************************************************************************************
10.11.32.100 : ok=0 changed=0 unreachable=1 failed=0
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAOr1PY-%2BsyQiqnDRWHzN3V%2BK-3McYWoO1WiL6Nwp4N_XVNi5SQ%40mail.gmail.com.
Hi Ajay,
I tried with -k, it does not work
netadmin@netadmin-Virtual-Machine:/etc/ansible$ ansible-playbook ios.yml -k
SSH password:
PLAY [10.11.32.100] ********************************************************************************************************************************************************************************
TASK [Gathering Facts] *****************************************************************************************************************************************************************************
[WARNING]: sftp transfer mechanism failed on [10.11.32.100]. Use ANSIBLE_DEBUG=1 to see detailed information
[WARNING]: scp transfer mechanism failed on [10.11.32.100]. Use ANSIBLE_DEBUG=1 to see detailed information
fatal: [10.11.32.100]: UNREACHABLE! => {"changed": false, "msg": "SSH Error: data could not be sent to remote host \"10.11.32.100\". Make sure this host can be reached over ssh", "unreachable": true}
[WARNING]: Could not create retry file '/etc/ansible/ios.retry'. [Errno 13] Permission denied: u'/etc/ansible/ios.retry'
PLAY RECAP *****************************************************************************************************************************************************************************************
10.11.32.100 : ok=0 changed=0 unreachable=1 failed=0
Here is the output of -vvv
netadmin@netadmin-Virtual-Machine:/etc/ansible$ ansible-playbook ios.yml -vvv
ansible-playbook 2.5.7
config file = /etc/ansible/ansible.cfg
configured module search path = [u'/home/netadmin/.ansible/plugins/modules', u'/usr/share/ansible/plugins/modules']
ansible python module location = /usr/lib/python2.7/dist-packages/ansible
executable location = /usr/bin/ansible-playbook
python version = 2.7.15rc1 (default, Apr 15 2018, 21:51:34) [GCC 7.3.0]
Using /etc/ansible/ansible.cfg as config file
Parsed /etc/ansible/hosts inventory source with ini plugin
PLAYBOOK: ios.yml **********************************************************************************************************************************************************************************
1 plays in ios.yml
PLAY [10.11.32.100] ********************************************************************************************************************************************************************************
TASK [Gathering Facts] *****************************************************************************************************************************************************************************
task path: /etc/ansible/ios.yml:2
Using module file /usr/lib/python2.7/dist-packages/ansible/modules/system/setup.py
<10.11.32.100> ESTABLISH SSH CONNECTION FOR USER: 60081064
<10.11.32.100> SSH: EXEC ssh -C -o ControlMaster=auto -o ControlPersist=60s -o KbdInteractiveAuthentication=no -o PreferredAuthentications=gssapi-with-mic,gssapi-keyex,hostbased,publickey -o PasswordAuthentication=no -o User=60081064 -o ConnectTimeout=10 -o ControlPath=/home/netadmin/.ansible/cp/e0e6fa081f 10.11.32.100 '/bin/sh -c '"'"'echo ~60081064 && sleep 0'"'"''
<10.11.32.100> (255, '', '6008...@10.11.32.100: Permission denied (publickey,keyboard-interactive,password).\r\n')
fatal: [10.11.32.100]: UNREACHABLE! => {
"changed": false,
"msg": "Failed to connect to the host via ssh: 6008...@10.11.32.100: Permission denied (publickey,keyboard-interactive,password).\r\n",
"unreachable": true
}
[WARNING]: Could not create retry file '/etc/ansible/ios.retry'. [Errno 13] Permission denied: u'/etc/ansible/ios.retry'
PLAY RECAP *****************************************************************************************************************************************************************************************
10.11.32.100 : ok=0 changed=0 unreachable=1 failed=0
netadmin@netadmin-Virtual-Machine:/etc/ansible$
From: Ajay Kumar Manukonda
Sent: Friday, 10 August 2018 9:59 AM
To: ansible...@googlegroups.com
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAOr1PY-%2BsyQiqnDRWHzN3V%2BK-3McYWoO1WiL6Nwp4N_XVNi5SQ%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5b6cd689.1c69fb81.ee703.e269%40mx.google.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAOr1PY-y51CQ3E2hX-5hte7pCZXqX7pBa3EFyZjd-eOdu3vTsA%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
Hi Ajay,
I managed to fix my script as below:
---
- name: show version
hosts: "switches"
gather_facts: false
connection: local
vars:
backup_root: /etc/ansible/backups
cli:
host: "{{ inventory_hostname }}"
username: msawires
password: Irukandji.=
tasks:
- name: GATHERING INFO
ios_command:
commands:
- command: sh run | i hostname
- command: sh ip int brief | i 10.11.64
- command: sh ver | i Model Number|System Serial
provider: "{{ cli }}"
register: config
- copy:
content: "{{ config.stdout[0] }}"
dest: "{{ backup_root }}/{{ inventory_hostname }}/running-config_{{ timestamp.stdout }}"
...
My problem now is I can save only first command, cannot save the other two in file, do you have any suggestion how to save all commands output in one file?
Thank you,
Michael
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/CAOr1PY-y51CQ3E2hX-5hte7pCZXqX7pBa3EFyZjd-eOdu3vTsA%40mail.gmail.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/ansible-project/5b738c2f.1c69fb81.8cf15.b701%40mx.google.com.