-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
9 changed files
with
195 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
# seaweedfs | ||
|
||
Ansible role to install and configure [SeaweedFS](https://github.com/seaweedfs/seaweedfs). | ||
|
||
## Requirements | ||
|
||
None. | ||
|
||
## Dependencies | ||
|
||
None. | ||
|
||
## Role Variables | ||
|
||
Refer to [defaults/main.yml](defaults/main.yml) for a list of variables along with documentation. | ||
|
||
## Example Playbook | ||
|
||
```yaml | ||
- hosts: all | ||
roles: | ||
- role: hostinger.common.seaweedfs | ||
``` | ||
## License | ||
See [LICENSE](../../LICENSE) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
--- | ||
seaweedfs_version: 3.67 | ||
seaweedfs_url: https://github.com/seaweedfs/seaweedfs/releases/download/{{ seaweedfs_version }}/{{ seaweedfs_os }}_{{ seaweedfs_arch }}.tar.gz | ||
seaweedfs_arch: amd64 | ||
seaweedfs_os: linux | ||
seaweedfs_install_dir: /opt/seaweedfs/{{ seaweedfs_version }} | ||
seaweedfs_owner: root | ||
seaweedfs_group: root | ||
seaweedfs_config_dir: /etc/seaweedfs | ||
seaweedfs_service_state: started | ||
seaweedfs_command: server | ||
seaweedfs_args: | ||
- -ip=127.0.0.1 | ||
- -volume.max=0 | ||
- -volume.fileSizeLimitMB=2048 | ||
seaweedfs_s3_config: {} | ||
# identities: | ||
# - name: default | ||
# credentials: | ||
# - accessKey: "example" | ||
# secretKey: "example" | ||
# actions: | ||
# - Admin | ||
# - Read | ||
# - List | ||
# - Tagging | ||
# - Write |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
--- | ||
- name: Reload systemd | ||
ansible.builtin.systemd: | ||
daemon_reload: true | ||
|
||
- name: Restart seaweedfs | ||
ansible.builtin.systemd: | ||
name: seaweedfs | ||
state: restarted |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
galaxy_info: | ||
role_name: seaweedfs | ||
author: hostinger | ||
description: Ansible role to install and configure SeaweedFS | ||
license: license (MIT) | ||
min_ansible_version: "2.10" | ||
platforms: | ||
- name: Fedora | ||
versions: | ||
- all | ||
- name: Debian | ||
versions: | ||
- all | ||
- name: Ubuntu | ||
versions: | ||
- all | ||
galaxy_tags: | ||
- seaweedfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
--- | ||
- name: Converge | ||
hosts: | ||
- all | ||
|
||
roles: | ||
- seaweedfs |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
dependency: | ||
name: galaxy | ||
driver: | ||
name: docker | ||
platforms: | ||
- name: default | ||
image: geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest | ||
volumes: | ||
- /sys/fs/cgroup:/sys/fs/cgroup:rw | ||
command: ${MOLECULE_DOCKER_COMMAND:-""} | ||
cgroupns_mode: host | ||
pre_build_image: true | ||
privileged: true | ||
platform: amd64 | ||
provisioner: | ||
name: ansible | ||
playbooks: | ||
converge: ${MOLECULE_PLAYBOOK:-converge.yml} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
--- | ||
- name: Fail when unsupported architecture | ||
ansible.builtin.fail: | ||
msg: "Unsupported architecture" | ||
when: | ||
- seaweedfs_arch not in ['amd64', 'arm64'] | ||
|
||
- name: Create directories | ||
ansible.builtin.file: | ||
path: "{{ item }}" | ||
state: directory | ||
owner: "{{ seaweedfs_owner }}" | ||
group: "{{ seaweedfs_group }}" | ||
mode: 0755 | ||
with_items: | ||
- "{{ seaweedfs_install_dir }}" | ||
- "{{ seaweedfs_config_dir }}" | ||
|
||
- name: Download tarball | ||
ansible.builtin.get_url: | ||
url: "{{ seaweedfs_url }}" | ||
dest: "{{ seaweedfs_install_dir }}/seaweedfs.tar.gz" | ||
mode: 0644 | ||
owner: "{{ seaweedfs_owner }}" | ||
group: "{{ seaweedfs_group }}" | ||
timeout: 30 | ||
|
||
- name: Unarchive tarball | ||
ansible.builtin.unarchive: | ||
src: "{{ seaweedfs_install_dir }}/seaweedfs.tar.gz" | ||
dest: "{{ seaweedfs_install_dir }}" | ||
mode: 0755 | ||
creates: "{{ seaweedfs_install_dir }}/weed" | ||
owner: "{{ seaweedfs_owner }}" | ||
group: "{{ seaweedfs_group }}" | ||
remote_src: true | ||
|
||
- name: Create symlink to binaries | ||
ansible.builtin.file: | ||
src: "{{ seaweedfs_install_dir }}/{{ item }}" | ||
dest: /usr/bin/{{ item }} | ||
state: link | ||
force: true | ||
owner: "{{ seaweedfs_owner }}" | ||
group: "{{ seaweedfs_group }}" | ||
mode: 0755 | ||
with_items: | ||
- weed | ||
|
||
- name: Template service file | ||
ansible.builtin.template: | ||
src: seaweedfs.service.j2 | ||
dest: /etc/systemd/system/seaweedfs.service | ||
mode: 0644 | ||
owner: root | ||
group: root | ||
notify: | ||
- Restart seaweedfs | ||
|
||
- name: Template S3 config file | ||
ansible.builtin.template: | ||
src: s3.conf.j2 | ||
dest: "{{ seaweedfs_config_dir }}/s3.conf" | ||
mode: 0644 | ||
owner: "{{ seaweedfs_owner }}" | ||
group: "{{ seaweedfs_group }}" | ||
notify: | ||
- Restart seaweedfs | ||
|
||
- name: Enable and start service | ||
ansible.builtin.service: | ||
name: seaweedfs | ||
enabled: true | ||
state: "{{ seaweedfs_service_state }}" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
{{ seaweedfs_s3_config | default({}) | to_nice_json }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
[Unit] | ||
Description=SeaweedFS | ||
Documentation=https://github.com/seaweedfs/seaweedfs | ||
After=network.target | ||
|
||
[Service] | ||
User={{ seaweedfs_owner }} | ||
ExecStart=/usr/bin/weed {{ seaweedfs_command }} {% for arg in seaweedfs_args %}{{ arg }} {% endfor +%} | ||
Restart=on-failure | ||
|
||
[Install] | ||
WantedBy=multi-user.target |