Skip to content

Commit

Permalink
Added s3fs fuse and backblaze backups folder
Browse files Browse the repository at this point in the history
Added s3fs fuse and backblaze backups folder

Added s3fs fuse and backblaze backups folder
  • Loading branch information
Jon Clayton committed Mar 8, 2021
1 parent c7f6121 commit 9d7f2a1
Show file tree
Hide file tree
Showing 7 changed files with 73 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,4 @@ terraform/proxmox/terraform.tfstate*
terraform/proxmox/terraform-pluging*
terraform/proxmox/terraform-plugin-proxmox.log
terraform/proxmox/terraform.tfstate

group_vars/all/backblaze.yml
2 changes: 2 additions & 0 deletions roles/storage_configuration/tasks/glusterfs.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
- name: Re-gather facts
setup: ~
#- install GlusterFS server

- name: Add Gluster Key
Expand Down
1 change: 1 addition & 0 deletions roles/storage_configuration/tasks/main.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
- include_tasks: glusterfs.yml
- include_tasks: glusterfs_client.yml
- include_tasks: samba.yml
- include_tasks: s3fsfuse.yml



Expand Down
55 changes: 55 additions & 0 deletions roles/storage_configuration/tasks/s3fsfuse.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
- name: Install packages for s3fs fuse
apt:
pkg:
- libfuse-dev
- fuse
- build-essential
- libcurl4-openssl-dev
- libxml2-dev
- pkg-config
- libssl-dev
- automake
- git

- name: Create directory for mounting blackblaze s3fs fuse to
file:
path: /backups/backblaze
state: directory
owner: root

- name: clone repo
ansible.builtin.git:
repo: https://github.com/s3fs-fuse/s3fs-fuse
clone: yes
dest: /tmp/s3fs-fuse

- name: install s3fs
shell: |
cd /tmp/s3fs-fuse
./autogen.sh
./configure
make
make install
- name: symlink binary
ansible.builtin.file:
src: /usr/local/bin/s3fs
dest: /usr/bin
state: link
force: no
ignore_errors: true

- name: Create s3fs backblaze password file
ansible.builtin.template:
src: passwd-s3fs.j2
dest: /etc/passwd-s3fs
mode: 0600
owner: root

# clever bit to add a line/block to fstab file but use a template as a basis and add a marker.
- name: Manage fstab file
blockinfile:
path: /etc/fstab
block: "{{ lookup('template', 'baremetal_fstab_s3fs.j2') }}"
marker: "# {mark} ANSIBLE MANAGED BLOCK for s3fs Mount"
when: "'baremetal_hosts' in group_names"
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
s3fs#{{ backblaze.backblaze_bucket }} {{ backblaze.backblaze_dir }} fuse _netdev,use_xattr,umask=022,parallel_count=10,retries=100,dbglevel=debug,allow_other,use_path_request_style,url=https://s3.us-west-000.backblazeb2.com,nomixupload,nonempty 0 0
11 changes: 11 additions & 0 deletions roles/storage_configuration/templates/baremetal_smb.conf.j2
Original file line number Diff line number Diff line change
Expand Up @@ -259,3 +259,14 @@ force user = root
force group = root
admin users = root, jon

[backblaze]
comment = Backblaze Backups
path = "{{ backblaze.backblaze_dir }}"
writeable = yes
guest ok = no
create mask = 0644
directory mask = 0755
valid users = root, jon
force user = root
force group = root
admin users = root, jon
2 changes: 2 additions & 0 deletions roles/storage_configuration/templates/passwd-s3fs.j2
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
{{ backblaze.backblaze_creds.key_id }}:{{ backblaze.backblaze_creds.app_key }}

0 comments on commit 9d7f2a1

Please sign in to comment.