Skip to content

Commit

Permalink
initial commit after personal refactoring
Browse files Browse the repository at this point in the history
  • Loading branch information
bmillemathias committed Dec 22, 2020
1 parent 29e8158 commit bcae52f
Show file tree
Hide file tree
Showing 12 changed files with 276 additions and 308 deletions.
190 changes: 34 additions & 156 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,161 +1,39 @@
egeneralov.seaweedfs
====================

Provision installation for [seaweedfs](https://github.com/chrislusf/seaweedfs)

Requirements
------------

Debian.

Role Variables
--------------

- **domain**: `weed.domain.tld`
- **weed**:
- **version**: `0.76`
- **bind**: `127.0.0.1`
- **ip**: `127.0.0.1`
- **destination**: `/usr/local/sbin`
- **master**:
- **dir**: `/opt/seaweedfs/{{ domain }}/master`
- **volume**:
- **dir**: `/opt/seaweedfs/{{ domain }}/volume`
- **dataCenter**: `DefaultDataCenter`
- **rack**: `DefaultRack`
- **download_url**: `https://github.com/chrislusf/seaweedfs/releases/download/{{ weed.version }}/{{ ansible_system|lower }}_{{ arch[ansible_architecture] }}.tar.gz`
- **manage_iptables**: `false`

Example Playbook
----------------

---

- hosts: weed.domain.tld
gather_facts: no
# no_log: true
vars:
domains:
- weed.domain.tld
- master-weed.domain.tld
tasks:

- sysctl:
name: "{{ item }}"
value: 1
sysctl_set: yes
state: present
reload: yes
with_items:
- net.ipv6.conf.lo.disable_ipv6
- net.ipv6.conf.all.disable_ipv6
- net.ipv6.conf.default.disable_ipv6

- file:
path: /etc/nginx/ssl/
state: directory

- apt:
name:
- python-pip
- python-setuptools
- openssl
update_cache: yes
cache_valid_time: 3600

- pip:
name:
- setuptools
- pyopenssl

- openssl_privatekey:
path: "/etc/nginx/ssl/{{ item }}.key"
with_items: "{{ domains }}"

- openssl_csr:
path: "/etc/nginx/ssl/{{ item }}.csr"
privatekey_path: "/etc/nginx/ssl/{{ item }}.key"
common_name: "{{ item }}"
with_items: "{{ domains }}"

- openssl_certificate:
path: "/etc/nginx/ssl/{{ item }}.crt"
privatekey_path: "/etc/nginx/ssl/{{ item }}.key"
csr_path: "/etc/nginx/ssl/{{ item }}.csr"
provider: selfsigned
with_items: "{{ domains }}"

- file:
path: /usr/local/share/ca-certificates/extra
state: directory

- copy:
remote_src: yes
src: "/etc/nginx/ssl/{{ item }}.crt"
dest: "/usr/local/share/ca-certificates/extra/{{ item }}.crt"
with_items: "{{ domains }}"
register: copy

- shell: update-ca-certificates
changed_when: copy is changed



- hosts: weed.domain.tld
# no_log: true
vars:
manage_iptables: yes
vhosts:
- domain: "weed.domain.tld"
ssl: true
rewrite_ssl: true
rewrite_www: false
ssl_certificate: /etc/nginx/ssl/weed.domain.tld.crt
ssl_certificate_key: /etc/nginx/ssl/weed.domain.tld.key
root: /opt/seaweedfs/weed.ccbh.tf
client_max_body_size: 100m
locations:
- path: /
type: proxy
schema: "http://"
proxy_to:
- "127.0.0.1:8080"
- domain: "master-weed.domain.tld"
ssl: true
rewrite_ssl: true
rewrite_www: false
ssl_certificate: /etc/nginx/ssl/master-weed.domain.tld.crt
ssl_certificate_key: /etc/nginx/ssl/master-weed.domain.tld.key
root: /opt/seaweedfs/weed.ccbh.tf
client_max_body_size: 100m
locations:
- path: /
type: proxy
schema: "http://"
proxy_to:
- "127.0.0.1:9333"
domain: weed.domain.tld
weed:
version: 0.76
destination: /usr/local/sbin
master:
dir: "/opt/seaweedfs/{{ domain }}/master"
volume:
dir: "/opt/seaweedfs/{{ domain }}/volume"
dataCenter: "fra1"
rack: "rack1"
roles:
- egeneralov.sshd_config
- egeneralov.iptables
- egeneralov.seaweedfs
- egeneralov.nginx

License
-------
# Ansible Role: seaweedfs

Provision installation for [seaweedfs](https://github.com/chrislusf/seaweedfs) a distributed object storage.
It installs the components master, volume and filer.
This role was based on the work of egeneralov.seaweedfs

## Requirements

None

## Role Defaults Variables

weed.version: '2.10'
weed.bind: 0.0.0.0
weed.ip: "{{ ansible_default_ipv4.address }}"
weed.location: /usr/local/sbin # where the binary weed is installed
weed.user.name: seaweed
weed.user.uid:
weed.user.gid:
weed.defaultReplication: "002"
weed.master.port: 9333
weed.master.dir: "/opt/seaweedfs/{{ domain }}/master"
weed.volume.port: 8080
weed.volume.dir: "/opt/seaweedfs/{{ domain }}/volume"
weed.volume.dataCenter: DefaultDataCenter
weed.volume.rack: DefaultRack
weed.volume.max_volumes: 16
weed.filer.port: 8889
weed.filer.dir: "/opt/seaweedfs/{{ domain }}/filer"
weed.filer.encryptData: false

## License

MIT

Author Information
------------------
## Author Information

Eduard Generalov <eduard@generalov.net>
Baptiste Mille-Mathias <baptiste.millemathias@gmail.com>
30 changes: 22 additions & 8 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,38 @@
---
# defaults file for egeneralov.seaweedfs
# defaults file for bmillemathias.seaweedfs

arch:
x86_64: amd64
x86: i386

domain: weed.domain.tld

weed:
version: 0.76
bind: 127.0.0.1
ip: 127.0.0.1
destination: /usr/local/sbin
default_weed:
# version has to be quoted, else the the value will be treated as float and
# trailing zeros may be trimmed.
version: '2.10'
bind: 0.0.0.0
ip: "{{ ansible_default_ipv4.address }}"
location: /usr/local/sbin
user:
name: seaweed
uid:
gid:
# defaultReplication is set by a triplet
# 002 => 2 replicas in the same rack
defaultReplication: "002"
master:
port: 9333
dir: "/opt/seaweedfs/{{ domain }}/master"
volume:
port: 8080
dir: "/opt/seaweedfs/{{ domain }}/volume"
dataCenter: DefaultDataCenter
rack: DefaultRack
max_volumes: 16
filer:
port: 8889
dir: "/opt/seaweedfs/{{ domain }}/filer"
encryptData: false

download_url: "https://github.com/chrislusf/seaweedfs/releases/download/{{ weed.version }}/{{ ansible_system|lower }}_{{ arch[ansible_architecture] }}.tar.gz"

manage_iptables: false
20 changes: 19 additions & 1 deletion handlers/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,20 @@
---
# handlers file for egeneralov.seaweedfs
# handlers file for bmillemathias.seaweedfs

- name: restart seaweedfs-master.service
systemd:
name: seaweedfs-master.service
state: "{% if weed_download.changed or weed_master_service_file.changed %}restarted{% else %}started{% endif %}"
daemon_reload: "{% if weed_master_service_file.changed %}yes{% else %}no{% endif %}"

- name: restart seaweedfs-volume.service
systemd:
name: seaweedfs-volume.service
state: "{% if weed_download.changed or weed_volume_service_file.changed %}restarted{% else %}started{% endif %}"
daemon_reload: "{% if weed_volume_service_file.changed %}yes{% else %}no{% endif %}"

- name: restart seaweedfs-filer.service
systemd:
name: seaweedfs-filer.service
state: "{% if weed_download.changed or weed_filer_service_file.changed %}restarted{% else %}started{% endif %}"
daemon_reload: "{% if weed_filer_service_file.changed %}yes{% else %}no{% endif %}"
33 changes: 23 additions & 10 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,30 @@
---
dependencies: []

galaxy_info:
author: Eduard Generalov <eduard@generalov.net>
description: Provision installation for seaweedfs
role_name: seaweedfs
author: Baptiste Mille-Mathias <baptiste.millemathias@gmail.com>
description: Provision installation for seaweedfs initially created by Eduard Generalov
license: MIT
min_ansible_version: 2.4
min_ansible_version: 2.6
github_branch: master
issue_tracker_url: https://github.com/egeneralov/seaweedfs
issue_tracker_url: https://github.com/bmillemathias/ansible-role-seaweedfs/issues
platforms:
- name: Debian
versions:
- stretch
- name: EL
versions:
- all
- name: Fedora
versions:
- all
- name: Debian
versions:
- all
- name: Ubuntu
versions:
- all

galaxy_tags:
- seaweedfs
- weed

dependencies: []
- cloud
- storage
...
23 changes: 0 additions & 23 deletions tasks/iptables.yml

This file was deleted.

Loading

0 comments on commit bcae52f

Please sign in to comment.