reading from files

Hi,

Trying to read the values from flat files and to use it as a variables in the ansible playbook , for example

the flatfile is
#cat output

example.com/development/testcaseone:v99

I want to use above values as a variables in the playbook , just like

just to add the flatfile is on a remote machine…

i am trying to use the shell: cat testfile |sed ‘s///\n/g’ and got the values in column wise ,could you please help as how i can get this values individually using register.

Not tested but something like this might work.

  - fetch:
      src: /path/to/file
    register: r

  - set_fact:
      rt1: '{{ (r.content | b64decode).split('/')[0] }}'
      stage_name: '{{ (r.content | b64decode).split('/')[1] }}'
      job_name: '{{ (r.content | b64decode).split('/')[2].split(':')[0] }}'
      version_number: '{{ (r.content | b64decode).split('/')[2].split(':')[1] }}'

Thanks Kai for the help always…will check on this …