Select Page
---

- name: run some scripts on remote host
hosts: myremotehost
become: yes
become_method: sudo

vars:
homefolder: "/home/{{ansible_user}}/"

tasks:
- name: copy files for ftp setup to new shlomi
synchronize:
src: "{{item}}"
dest: "{{homefolder}}"
mode: push
with_items:
- ...list of files....

- name: set file as executable
file:
path: "{{homefolder}}{{item}}"
mode: 0755
with_items:
- ...list of files....

- name: run main script
command: "{{homefolder}}main_script.sh"
register: script_output

- debug: var=script_output.stdout_lines

- name: delete all files
file:
path: "{{homefolder}}{{item}}"
state: absent
with_items:
- ...list of files to delete...