Backup a remote file. Update it back.
--- /dev/null
+#! /bin/sh
+
+start_dir="`pwd`" &&
+fetch_push_dir="`dirname \"$0\"`" &&
+exec "$HOME"/.virtualenvs/ansible/bin/ansible-playbook -v "$fetch_push_dir"/fetch.yml -e start_dir="$start_dir" "$@"
--- /dev/null
+- name: "Fetch {{ file }}"
+ hosts: "{{ hosts | default('all') }}"
+ gather_facts: false
+ tasks:
+ - name: Fetch files
+ fetch:
+ src: "{{ file }}"
+ dest: "{{ start_dir }}/{{ inventory_hostname }}/"
+ flat: yes
--- /dev/null
+#! /bin/sh
+
+start_dir="`pwd`" &&
+fetch_push_dir="`dirname \"$0\"`" &&
+exec "$HOME"/.virtualenvs/ansible/bin/ansible-playbook -v "$fetch_push_dir"/push.yml -e start_dir="$start_dir" "$@"
--- /dev/null
+- name: "Push {{ file }}"
+ hosts: "{{ hosts | default('all') }}"
+ become: yes
+ gather_facts: false
+ tasks:
+ - name: Copy files
+ copy:
+ src: "{{ start_dir }}/{{ inventory_hostname }}/{{ file }}"
+ dest: "{{ dest_dir }}"
+ owner: "{{ owner | default('root') }}"
+ group: "{{ group | default('root') }}"
+ mode: "{{ mode | default('0644') }}"