- name: backup | system setup | create backup config directory ansible.builtin.file: path: "{{ item }}" state: directory loop: - "/opt/backup" - "/opt/backup/bin" - "/opt/backup/config" - name: backup | system setup | create a link to backup script ansible.builtin.file: path: "/opt/backup/bin/backup_remote.bash" state: link src: "{{ ansible_user_dir }}/bin/backup_remote.bash" - name: backup | system setup | copy backup config files ansible.builtin.copy: dest: "/opt/backup/config/" src: "config/" - name: backup | system setup | copy backup config files 2 ansible.builtin.template: src: "backup_remote.j2" dest: "/opt/backup/config/backup_remote.conf" force: Yes - name: backup | system setup | add entries to ssh_config ansible.builtin.blockinfile: dest: "{{ ansible_user_dir }}/.ssh/config" block: "{{ lookup('template', 'ssh_config.j2') }}" marker: "## {mark} ANSIBLE MANAGED BLOCK FOR backup" # template: # src: "ssh_config.j2" # dest: "{{ ansible_user_id }}/.ssh/config" # backup: true # mode: "0644"