I am trying to   create a log  file   with hostname with  it by using the 
shell  variable and not from {{  ansible_hostname }} , as I have my 
playbooks have gather_facts  disabled.

Unable to fetch the source file as ansible is  unable to get the exact file 
in src.?

what need to be changed for the line  "src: /var/tmp/patchreport_$(hostname 
-s)_$(date +%F) "


- name: myplay
  hosts: myhost5
  remote_user: root
  gather_facts: no
  tasks:
    - name: Collecting  the patch result
      ignore_errors: yes
      shell: grep "`date '+%b.%d'`" /var/log/yum.log > /var/tmp/
patchreport_$(hostname -s)_$(date +%F)
      register: patchlog


    - name: Fetch  the  Patch  result for the server
      fetch:
        src: /var/tmp/patchreport_$(hostname -s)_$(date +%F)
        dest: /home/devops/patch_reports
      when:  patchlog.changed

-- 
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 [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/ed35f884-b9b4-4ab9-bef1-8c14591fa940%40googlegroups.com.

Reply via email to