Failed to get information on remote file
While I execute ansible playbook copy module, I am getting intermittent SSH issue.
specific task that is having intermittent ssh connection issue
- name: find all maven dep files
find:
paths: "{{ tmp_dir }}/target/lib"
file_type: file
recurse: yes
register: mvn_dep_file_list
delegate_to: "{{ delegate_to_local }}"
- name: Copying files from a local machine to the remote server
copy:
src: "{{ item.path }}"
dest: "{{ batch_deployment_base_dir }}/{{ current_batch_name.target_base_dir_name }}/{{ current_batch_name.target_lib_dir_name }}/"
owner: "{{ batch_files_owner }}"
group: "{{ batch_files_group }}"
mode: "{{ batch_file_mode }}"
with_items: "{{ mvn_dep_file_list.files }}"
Ansible config
[defaults]
host_key_checking = False
callback_enable = timer, profile_tasks
ansible_python_interpreter=/usr/bin/python3
[ssh_connection]
ssh_args = -o ControlMaster=auto -o ControlPersist=1500s -o ConnectTimeout=1500
timeout = 500
retries = 3
pipelining = true
Exception from ansible playbook (verbose):
fatal: [x.x.x.x]: FAILED! => {
“msg”: “Failed to get information on remote file (/my/folder/hello.jar): MODULE FAILURE\nSee stdout/stderr for the exact error”
Exception from system log
hostname sudo[2554096]: my_user : command not allowed ; TTY=unknown ; PWD=/home/my_user@test.com ; USER=root ; COMMAND=/bin/sh -c echo BECOME-SUCCESS-dfsdfsfdfdsfsdfsfdsfsdsd; /usr/bin/python3
Note: This issue is not coming for the next run and it is coming intermittently. I am wondering why ssh connection is closed in middle. Please help to advice on this error.
The file size are less than 1 MB and the copy task copies minimum 50 file recursively to the folder form local to remote machine. Ansible master and the target server resides in same zone so there is no network connectivity issue.
On the target machine it has best sshd_config setting where keepalive is enabled.
Appreciate your help on this.