Hi, all.
I want to use the output of debug as the source to then create backups of that source (eek, I understand that; hope everyone else does). Here's the playbook relevant parts:
---
- hosts: host1,host2
#- hosts: busdev-web-dev,busdev-web-qa,busdev-web-prod,bed-deploy1,bed-deploy2,uoj,uojclone2,uojdev,bed-crm-web-qa
gather_facts: false
become: yes
# vars:
# script_path: <script>
tasks:
- name: Find known hosts
shell: find /root /home -type f -name known_hosts
register: known
tags:
- known
- name: Debug known_hosts paths
debug:
msg: "{{ known.stdout }}"
tags:
- known
- name: Set fact with known_hosts paths
set_fact:
known_hosts_paths: "{{ known.stdout_lines }}"
tags:
- known
- name: Back up known_host files
copy:
src: "{{ known.stdout }}"
dest: /tmp
remote_src: true
backup: yes
#delegate_to: localhost
tags:
- known
I hope the idea is clear. I want to make backups of users' know_host files, which I've gleaned with the first play. My attempt not only doesn't work, but seems messy, regardless. As always, help much appreciated.