author | Luke Hoersten <luke@hoersten.org> |
Sun, 09 Feb 2020 12:05:37 -0600 | |
changeset 2 | 2556522a2a45 |
parent 0 | roles/aws-s3-backup/tasks/main.yaml@df042396074e |
child 7 | dc3fca0131a7 |
permissions | -rw-r--r-- |
0
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
1 |
--- |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
2 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
3 |
- name: apt install pip |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
4 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
5 |
apt: name="python-pip" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
6 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
7 |
- name: pip install aws cli packages |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
8 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
9 |
pip: name="{{aws_s3_backup_pip_packages}}" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
10 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
11 |
- name: create aws config dir for root |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
12 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
13 |
file: path="/root/.aws/" state="directory" mode="0755" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
14 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
15 |
- name: configure aws credentials for root |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
16 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
17 |
template: src="aws-{{item}}.j2" dest="/root/.aws/{{item}}" mode="0600" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
18 |
with_items: |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
19 |
- "credentials" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
20 |
- "config" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
21 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
22 |
- name: create systemd target |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
23 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
24 |
copy: |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
25 |
src: "aws-s3-backup.target" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
26 |
dest: "/lib/systemd/system/aws-s3-backup.target" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
27 |
notify: reload target |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
28 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
29 |
- name: create systemd timer |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
30 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
31 |
copy: |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
32 |
src: "aws-s3-backup.timer" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
33 |
dest: "/lib/systemd/system/aws-s3-backup.timer" |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
34 |
notify: reload timer |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
35 |
|
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
36 |
- name: ensure timer is started |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
37 |
become: yes |
df042396074e
Opensourcing raspberry pi roles.
Luke Hoersten <luke@hoersten.org>
parents:
diff
changeset
|
38 |
systemd: name="aws-s3-backup.timer" enabled="yes" state="started" |