Commit 547be89a authored by Jürgen Haas's avatar Jürgen Haas

ansible-playbooks/general#85 Linting [skip-ci]

parent a5f9f4e6
......@@ -3,8 +3,8 @@
- name: Copy Auth File
copy:
src='{{ inventory_dir }}/files/gcloud/{{ gcloud[item].authfile }}'
dest='/tmp/{{ gcloud[item].authfile }}'
src: '{{ inventory_dir }}/files/gcloud/{{ gcloud[item].authfile }}'
dest: /tmp/{{ gcloud[item].authfile }}
- name: Configure authenticatron
command: gcloud auth activate-service-account --key-file=/tmp/{{ gcloud[item].authfile }}
......
......@@ -3,16 +3,16 @@
- name: Import the Google Cloud public key
apt_key:
url='https://packages.cloud.google.com/apt/doc/apt-key.gpg'
state=present
url: https://packages.cloud.google.com/apt/doc/apt-key.gpg
state: present
- name: Add the Cloud SDK distribution URI as a package source
apt_repository:
repo='deb http://packages.cloud.google.com/apt cloud-sdk-{{ ansible_distribution_release }} main'
state='present'
mode='644'
repo: deb http://packages.cloud.google.com/apt cloud-sdk-{{ ansible_distribution_release }} main
state: present
mode: 0644
- name: Update and install the Cloud SDK
apt:
pkg='google-cloud-sdk'
update_cache=yes
pkg: google-cloud-sdk
update_cache: yes
......@@ -13,68 +13,68 @@
- block:
- import_tasks: install.yml
- import_tasks: install.yml
- name: Check available accounts
command: gcloud auth list
register: gcloud_available_accounts
changed_when: false
- name: Check available accounts
command: gcloud auth list
register: gcloud_available_accounts
changed_when: no
- include_tasks: config.yml
with_items: '{{ gcloud|default([]) }}'
when: gcloud[item].account not in gcloud_available_accounts.stdout
- include_tasks: config.yml
with_items: '{{ gcloud|default([]) }}'
when: gcloud[item].account not in gcloud_available_accounts.stdout
- name: Ensure log directory
file:
path='/var/log/gcloud'
state='directory'
- name: Ensure log directory
file:
path: /var/log/gcloud
state: directory
- name: Copy Sync Scripts
template:
src='{{ item }}'
dest='/usr/local/bin/{{ item }}'
owner='root'
group='root'
mode='755'
with_items:
- gcloud-sync.sh
- gcloud-sync-path.sh
- name: Copy Sync Scripts
template:
src: '{{ item }}'
dest: /usr/local/bin/{{ item }}
owner: root
group: root
mode: 0755
with_items:
- gcloud-sync.sh
- gcloud-sync-path.sh
- name: Crontabs for Google Cloud Sync
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.sh {{ gcloud[item.account]["account"] }} {{ gcloud[item.account]["projectid"] }} "{{ item.source }}" "{{ item.bucket }}" >>/var/log/gcloud/rsync.log 2>&1'
disabled='{{ item.disabled|default(false) }}'
with_items: '{{ gcloud_sync|default([]) }}'
tags:
- cron
- name: Crontabs for Google Cloud Sync
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.sh {{ gcloud[item.account]["account"] }} {{ gcloud[item.account]["projectid"] }} "{{ item.source }}" "{{ item.bucket }}" >>/var/log/gcloud/rsync.log 2>&1
disabled: '{{ item.disabled|default(false) }}'
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: 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
dest=/etc/logrotate.d/gcloud
owner=root
group=root
mode='644'
tags:
- logrotate
- name: Install logrotate script
template:
src: etc-logrotate-gcloud
dest: /etc/logrotate.d/gcloud
owner: root
group: root
mode: 0644
tags:
- logrotate
when: gcloud_enabled and (not excluded_roles or "gcloud" not in excluded_roles) and gcloud_sync is defined
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