HI All,

I am developing below play for patching but stuck with local action copy 
content module. Please let me know what I am missing here

Code:-
---
- hosts: "{{ host }}"
  become: yes
  become_method: sudo
  tasks:
    - name: Running prepatch info commands
      shell: |
        echo -e "\nuname -a"
        echo "========"
        uname -a
        echo -e "\nrunlevel"
        echo "========"
        runlevel
    register: prepatch
      ignore_errors: True
      no_log: True
    - name: Removing old prepatch info file
      local_action: file path=/ansible_work/outputfolder/patch/{{ 
inventory_hostname }}-prepatch.txt state=absent
    - name: Storing prepatch info to directory outputfolder
      local_action: copy content={{ prepatch.stdout }} 
dest=/ansible_work/outputfolder/patch/{{ inventory_hostname }}-prepatch.txt

Error:

fatal: [Server]: FAILED! => {"msg": "The task includes an option with an 
undefined variable. The error was: 'dict object' has no attribute 
'stdout'\n\nThe error appears to have been in 
'/home/patrol_svc/patching.yml': line 115, column 7, but may\nbe elsewhere 
in the file depending on the exact syntax problem.\n\nThe offending line 
appears to be:\n\n      local_action: file path=/home/patrol_svc/{{ 
inventory_hostname }}-prepatch.txt state=absent\n    - name: Storing 
prepatch info to directory outputfolder\n      ^ here\n"}
fatal: [IP]: FAILED! => {"msg": "The task includes an option with an 
undefined variable. The error was: 'dict object' has no attribute 
'stdout'\n\nThe error appears to have been in 
'/home/patrol_svc/patching.yml': line 115, column 7, but may\nbe elsewhere 
in the file depending on the exact syntax problem.\n\nThe offending line 
appears to be:\n\n      local_action: file path=/home/patrol_svc/{{ 
inventory_hostname }}-prepatch.txt state=absent\n    - name: Storing 
prepatch info to directory outputfolder\n      ^ here\n"}

Best Regards
Vamsi

-- 
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 post to this group, send email to [email protected].
To view this discussion on the web visit 
https://groups.google.com/d/msgid/ansible-project/bcf0684f-376d-448c-9afc-1693f25582c2%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to