[awx-project] Copy file from src and dest (remote server) fails

228 views
Skip to first unread message

saravanan jothilingam

unread,
Feb 8, 2023, 12:47:52 PM2/8/23
to awx-p...@googlegroups.com, ansible...@googlegroups.com
Hi,
I have installed AWX 17.0.1 on Ubuntu OS. I am trying to run a simple playbook which would copy a zip file from the controller machine (source machine) to a remote SUSE linux host (/tmp/) location. When i launch the job from AWX UI, i get this error whereas when i run the ansible playbook via CLI it works fine.

What could be wrong here?



Error msg seen:

{
  "msg": "Source /tmp/crowdStrike.zip not found",
  "invocation": {
    "module_args": {
      "directory_mode": null,
      "force": true,
      "remote_src": true,
      "_original_basename": null,
      "owner": "root",
      "follow": false,
      "local_follow": null,
      "group": "root",
      "unsafe_writes": null,
      "setype": null,
      "content": null,
      "serole": null,
      "dest": "/tmp/crowdStrike.zip",
      "selevel": null,
      "regexp": null,
      "validate": null,
      "src": "/tmp/crowdStrike.zip",
      "checksum": null,
      "seuser": null,
      "delimiter": null,
      "mode": "0755",
      "attributes": null,
      "backup": false
    }
  },
  "_ansible_no_log": false,
  "changed": false



 cat main.yml
---
# tasks file for crowdstrike
- name: Create a directory if it does not exist
  ansible.builtin.file:
    path: /tmp/crowdstrike
    state: directory
    mode: '0755'

- name: Check if source installation script exists or not
  stat:
    path: "{{ installer_zip }}"
  register: file_data1

- name: validate the source file existence
  debug:
    msg: "The file {{ installer_zip }} exist"
  when: file_data1.stat.exists

- name: Copy crowdStrike.zip with owner and permissions to remote node - "{{inventory_hostname}}"
  ansible.builtin.copy:
    src: "{{installer_zip}}"
    #src: /tmp/crowdStrike.zip
    dest: /tmp/crowdStrike.zip
    remote_src: true
    owner: root
    group: root
    mode: '0755'
  #become: true

- name: Unarchive a file that is already on the remote machine - {{inventory_hostname}}
  ansible.builtin.unarchive:
    src: /tmp/crowdStrike.zip
    dest: /tmp/crowdstrike/.
    remote_src: yes

- name: Check if installation script exists or not
  stat:
    path: /tmp/crowdstrike/install.sh
  register: file_data

- name: print the status
  debug:
    msg: "The file exist"
  when: file_data.stat.exists

- name: provide full permission to crowdstrike directory
  file:
    path: /tmp/crowdstrike
    owner: root
    group: root
    mode: '0777'


- name: run install sh from '/tmp/crowdstrike' directory
  command: sh install.sh
  args:
    chdir: /tmp/crowdstrike
  ignore_errors: false

- name: check for service status
  command: sudo systemctl status falcon-sensor
  register: output_data


- name: validate the service status
  debug:
    msg: "Service Started - {{output_data.stdout}}"
  when: output_data.stdout | regex_search('active')

Dick Visser

unread,
Feb 8, 2023, 1:19:57 PM2/8/23
to ansible...@googlegroups.com, awx-p...@googlegroups.com
On Wed, 8 Feb 2023 at 18:47, saravanan jothilingam <saravan....@gmail.com> wrote:
Hi,
I have installed AWX 17.0.1 on Ubuntu OS. I am trying to run a simple playbook which would copy a zip file from the controller machine (source machine) to a remote SUSE linux host (/tmp/) location. When i launch the job from AWX UI, i get this error whereas when i run the ansible playbook via CLI it works fine.

What could be wrong here?



Error msg seen:

{
  "msg": "Source /tmp/crowdStrike.zip not found",

👆Pretty obvious 👆




--
Sent from Gmail Mobile
Reply all
Reply to author
Forward
0 new messages