Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
infra
ansible-shared
samba
Commits
92f6e967
Commit
92f6e967
authored
Jun 12, 2017
by
Robin Sonnabend
Browse files
Role for lvm-snapshots
parent
a1fb07a1
Changes
5
Hide whitespace changes
Inline
Side-by-side
lvm-snapshots/defaults/main.yml
0 → 100644
View file @
92f6e967
---
# file: roles/lvm-snapshots/defaults/main.yml
program_dir
:
/opt/lvm-snapshots
snapshot_cron_minutes
:
15
snapshot_volumes
:
-
volume_group
:
exports
name
:
pub
path
:
.snapshots
keep
:
-
number
:
4
interval
:
15M
-
number
:
24
interval
:
1H
-
number
:
31
interval
:
1d
-
number
:
6
interval
:
1m
lvm-snapshots/files/ssh-config.lvm-snapshots
0 → 100644
View file @
92f6e967
Host git.fsmpi.rwth-aachen.de
HostName git.fsmpi.rwth-aachen.de
User git
IdentityFile lvm-snapshots.key
lvm-snapshots/tasks/main.yml
0 → 100644
View file @
92f6e967
---
# file: roles/lvm-snapshots/tasks/main.yml
-
name
:
ensure we have the target folder
file
:
path="{{program_dir}}" state=directory owner=root group=root mode=0755
tags
:
-
lvm-snapshots
-
directory
-
name
:
ensure we know our deploy key
local_action
:
pass name="deploy-key/lvm-snapshots" state=present store=FSMPI_PASSWORD_STORE_DIR limit=no
register
:
deploy_key
no_log
:
True
tags
:
-
lvm-snapshots
-
password
-
name
:
ensure we know our public deploy key
local_action
:
pass name="deploy-key/lvm-snapshots-public" state=present store=FSMPI_PASSWORD_STORE_DIR limit=no
register
:
deploy_key_public
no_log
:
True
tags
:
-
lvm-snapshots
-
password
-
name
:
ensure our deploy key is present
copy
:
content
:
"
{{deploy_key.password}}
\n
"
dest
:
/root/.ssh/lvm-snapshots.key
owner
:
root
group
:
root
mode
:
0600
no_log
:
True
tags
:
-
lvm-snapshots
-
ssh
-
name
:
ensure our public deploy key is present
copy
:
content
:
"
{{deploy_key_public.password}}
\n
"
dest
:
/root/.ssh/lvm-snapshots.pub
owner
:
root
group
:
root
mode
:
0644
no_log
:
True
tags
:
-
lvm-snapshots
-
ssh
-
name
:
ensure we have our lvm-snapshots ssh config
copy
:
src
:
ssh-config.lvm-snapshots
dest
:
/root/.ssh/config.lvm-snapshots
owner
:
root
group
:
root
mode
:
0644
tags
:
-
lvm-snapshots
-
ssh
-
config
-
name
:
ensure our lvm-snapshots ssh config is included
lineinfile
:
dest
:
/root/.ssh/config
line
:
"
Include
config.lvm-snapshots"
create
:
yes
owner
:
root
group
:
root
mode
:
0644
tags
:
-
lvm-snapshots
-
ssh
-
config
-
name
:
ensure we have the program
git
:
repo
:
git@git.fsmpi.rwth-aachen.de:infra/lvm-snapshots.git
dest
:
"
{{program_dir}}"
tags
:
-
git
-
lvm-snapshots
-
name
:
ensure the necessary programs are installed
apt
:
name="{{item}}" state=present
with_items
:
-
python3
-
virtualenv
tags
:
-
packages
-
lvm-snapshots
-
name
:
ensure we have a virtualenv
pip
:
requirements
:
"
{{program_dir}}/requirements.txt"
virtualenv
:
"
{{program_dir}}"
virtualenv_python
:
python3
tags
:
-
pip
-
python
-
lvm-snapshots
-
name
:
ensure we have a frontend script
template
:
src
:
script.sh
dest
:
/usr/local/sbin/lvm-snapshots
owner
:
root
group
:
root
mode
:
0755
tags
:
-
lvm-snapshots
-
config
-
name
:
ensure we have our config
template
:
src
:
config.toml
dest
:
/etc/lvm-snapshots.toml
owner
:
root
group
:
root
mode
:
0644
tags
:
-
lvm-snapshots
-
config
-
name
:
ensure we have a cron job
cron
:
name
:
"
lvm-snapshots"
minute
:
"
*/{{snapshot_cron_minutes}}"
job
:
"
/usr/local/sbin/lvm-snapshots
update"
tags
:
-
lvm-snapshots
-
cron
lvm-snapshots/templates/config.toml
0 → 100644
View file @
92f6e967
{%
for
volume
in
snapshot_volumes
%}
[[volume]]
volume_group
=
"{{volume.volume_group}}"
name
=
"{{volume.name}}"
path
=
"{{volume.path}}"
{%
for
keep
in
volume.keep
%}
[[volume.keep]]
number
=
{
{keep.number
}
}
interval
=
"{{keep.interval}}"
{%
endfor
%}
{%
endfor
%}
lvm-snapshots/templates/script.sh
0 → 100644
View file @
92f6e967
#!/bin/bash
{{
program_dir
}}
/bin/python
{{
program_dir
}}
/lvmsnapshot.py
"
$@
"
exit
$?
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment