Problem copying a file to remote host with Ansible

Latest response

Good evening,

i have a problem when i try to copy a file to a remote host using Ansible (v.2.7.7).

System Description:
RHEL Server (7.6) with GUI and Ansible installed and RHEL Server (7.6) as the remote host to be configured.

Problem:
Ansible is interrupted with the following error:

TASK [suricata-update single rules file upload] ********************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: If you are using a module and expect the file to exist on the remote, see the remote_src option
fatal: [remote1]: FAILED! => {"changed": false, "msg": "Could not find or access '/var/lib/suricata/suricata.rules' on the Ansible Controller.\nIf you are using a module and expect the file to exist on the remote, see the remote_src option"}

Ansible Task

- name: Suricata installation
  hosts: detection
  become: true
  become_user: root

tasks:
###using suricata-update single rules file
  - name: suricata-update single rules file upload
    copy: src=/var/lib/suricata/suricata.rules
               dest=/etc/suricata/rules/suricata.rules
               remote_src=no
               mode=preserve
    notify: restart suricata

I have tried an alternative way with command and cp but again, it didn't work.

The suricata.files exists under /var/lib/suricata/ folder (root user) and has 744 permissions.

Any help would be appreciated.

Thanks

Responses