Commit cf56dba6 authored by Jürgen Haas's avatar Jürgen Haas

ansible-inventories/paragon#4095 New option for gcloud rsync to perform action...

ansible-inventories/paragon#4095 New option for gcloud rsync to perform action per directory and ignore certain patterns from bing synced
parent 8c38d089
......@@ -27,13 +27,16 @@
path='/var/log/gcloud'
state='directory'
- name: "Copy Sync Script"
- name: "Copy Sync Scripts"
template:
src='gcloud-sync.sh'
dest='/usr/local/bin/gcloud-sync.sh'
src='{{ item }}'
dest='/usr/local/bin/{{ item }}'
owner='root'
group='root'
mode='755'
with_items:
- 'gcloud-sync.sh'
- 'gcloud-sync-path.sh'
- name: "Crontabs for Google Cloud Sync"
cron:
......@@ -48,6 +51,18 @@
with_items: '{{ gcloud_sync|default([]) }}'
tags: 'cron'
- name: "Crontabs for Google Cloud Sync Path"
cron:
name='GCloud sync {{ item.source }}'
month={{ item.month|default(omit) }}
day={{ item.day|default(omit) }}
weekday={{ item.weekday|default(omit) }}
hour={{ item.hour|default('1') }}
minute={{ item.minute|default('0') }}
job='/usr/local/bin/gcloud-sync-path.sh {{ gcloud[item.account]["account"] }} {{ gcloud[item.account]["projectid"] }} "{{ item.source }}" "{{ item.bucket }}" >>/var/log/gcloud/rsync.log 2>&1'
with_items: '{{ gcloud_sync_path|default([]) }}'
tags: 'cron'
- name: "Install logrotate script"
template:
src=etc-logrotate-gcloud
......
#!/usr/bin/env bash
gcloud config set account $1
gcloud config set core/project $2
cd $3
for D in *; do
if [ -d "${D}" ]; then
echo "${D}"
gsutil -m rsync -x "(.*/)?\.notifier.*|(.*/)?vendor/.*|(.*/)?node_modules/.*|(.*/)?\.git/.*" -e -r $3/${D} gs://$4/${D}/ >>/var/log/gcloud/rsync.log
fi
done
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment