Here is another way:

- hosts: localhost
  gather_facts: no

  tasks:
    - name: register file contents
      shell: cat /path/to/file/that/contains/text
      register: file_contents

    - name: show file contents
      debug:
         msg: '{{ file_contents.stdout }}'


or you can use a lookup

- hosts: localhost
  gather_facts: no
  tasks:
    - name: register file contents
      set_fact:
        file_contents: "{{ lookup('file', 
'/path/to/file/that/contains/text' )}}"

    - name: show file contents
      debug:
         msg: "{{ file_contents }}"



Hope this helps

Jon

-- 
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/fc13fcf5-2386-434b-af67-3eb9029c87ba%40googlegroups.com.

Reply via email to