src.nth.io/

summaryrefslogtreecommitdiff
path: root/aws-s3-backup/tasks/main.yaml
diff options
context:
space:
mode:
Diffstat (limited to 'aws-s3-backup/tasks/main.yaml')
-rw-r--r--aws-s3-backup/tasks/main.yaml38
1 files changed, 38 insertions, 0 deletions
diff --git a/aws-s3-backup/tasks/main.yaml b/aws-s3-backup/tasks/main.yaml
new file mode 100644
index 0000000..cc95210
--- /dev/null
+++ b/aws-s3-backup/tasks/main.yaml
@@ -0,0 +1,38 @@
+---
+
+- name: apt install pip
+ become: yes
+ apt: name="python-pip"
+
+- name: pip install aws cli packages
+ become: yes
+ pip: name="{{aws_s3_backup_pip_packages}}"
+
+- name: create aws config dir for root
+ become: yes
+ file: path="/root/.aws/" state="directory" mode="0755"
+
+- name: configure aws credentials for root
+ become: yes
+ template: src="aws-{{item}}.j2" dest="/root/.aws/{{item}}" mode="0600"
+ with_items:
+ - "credentials"
+ - "config"
+
+- name: create systemd target
+ become: yes
+ copy:
+ src: "aws-s3-backup.target"
+ dest: "/lib/systemd/system/aws-s3-backup.target"
+ notify: reload target
+
+- name: create systemd timer
+ become: yes
+ copy:
+ src: "aws-s3-backup.timer"
+ dest: "/lib/systemd/system/aws-s3-backup.timer"
+ notify: reload timer
+
+- name: ensure timer is started
+ become: yes
+ systemd: name="aws-s3-backup.timer" enabled="yes" state="started"