wip glusterfs
This commit is contained in:
2
ansible-5/roles/geerlingguy.glusterfs/.ansible-lint
Normal file
2
ansible-5/roles/geerlingguy.glusterfs/.ansible-lint
Normal file
@@ -0,0 +1,2 @@
|
||||
skip_list:
|
||||
- '106'
|
||||
4
ansible-5/roles/geerlingguy.glusterfs/.github/FUNDING.yml
vendored
Normal file
4
ansible-5/roles/geerlingguy.glusterfs/.github/FUNDING.yml
vendored
Normal file
@@ -0,0 +1,4 @@
|
||||
# These are supported funding model platforms
|
||||
---
|
||||
github: geerlingguy
|
||||
patreon: geerlingguy
|
||||
56
ansible-5/roles/geerlingguy.glusterfs/.github/stale.yml
vendored
Normal file
56
ansible-5/roles/geerlingguy.glusterfs/.github/stale.yml
vendored
Normal file
@@ -0,0 +1,56 @@
|
||||
# Configuration for probot-stale - https://github.com/probot/stale
|
||||
|
||||
# Number of days of inactivity before an Issue or Pull Request becomes stale
|
||||
daysUntilStale: 90
|
||||
|
||||
# Number of days of inactivity before an Issue or Pull Request with the stale label is closed.
|
||||
# Set to false to disable. If disabled, issues still need to be closed manually, but will remain marked as stale.
|
||||
daysUntilClose: 30
|
||||
|
||||
# Only issues or pull requests with all of these labels are check if stale. Defaults to `[]` (disabled)
|
||||
onlyLabels: []
|
||||
|
||||
# Issues or Pull Requests with these labels will never be considered stale. Set to `[]` to disable
|
||||
exemptLabels:
|
||||
- pinned
|
||||
- security
|
||||
- planned
|
||||
|
||||
# Set to true to ignore issues in a project (defaults to false)
|
||||
exemptProjects: false
|
||||
|
||||
# Set to true to ignore issues in a milestone (defaults to false)
|
||||
exemptMilestones: false
|
||||
|
||||
# Set to true to ignore issues with an assignee (defaults to false)
|
||||
exemptAssignees: false
|
||||
|
||||
# Label to use when marking as stale
|
||||
staleLabel: stale
|
||||
|
||||
# Limit the number of actions per hour, from 1-30. Default is 30
|
||||
limitPerRun: 30
|
||||
|
||||
pulls:
|
||||
markComment: |-
|
||||
This pull request has been marked 'stale' due to lack of recent activity. If there is no further activity, the PR will be closed in another 30 days. Thank you for your contribution!
|
||||
|
||||
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark pull requests as stale.
|
||||
|
||||
unmarkComment: >-
|
||||
This pull request is no longer marked for closure.
|
||||
|
||||
closeComment: >-
|
||||
This pull request has been closed due to inactivity. If you feel this is in error, please reopen the pull request or file a new PR with the relevant details.
|
||||
|
||||
issues:
|
||||
markComment: |-
|
||||
This issue has been marked 'stale' due to lack of recent activity. If there is no further activity, the issue will be closed in another 30 days. Thank you for your contribution!
|
||||
|
||||
Please read [this blog post](https://www.jeffgeerling.com/blog/2020/enabling-stale-issue-bot-on-my-github-repositories) to see the reasons why I mark issues as stale.
|
||||
|
||||
unmarkComment: >-
|
||||
This issue is no longer marked for closure.
|
||||
|
||||
closeComment: >-
|
||||
This issue has been closed due to inactivity. If you feel this is in error, please reopen the issue or file a new issue with the relevant details.
|
||||
3
ansible-5/roles/geerlingguy.glusterfs/.gitignore
vendored
Normal file
3
ansible-5/roles/geerlingguy.glusterfs/.gitignore
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
*.retry
|
||||
*/__pycache__
|
||||
*.pyc
|
||||
33
ansible-5/roles/geerlingguy.glusterfs/.travis.yml
Normal file
33
ansible-5/roles/geerlingguy.glusterfs/.travis.yml
Normal file
@@ -0,0 +1,33 @@
|
||||
---
|
||||
language: python
|
||||
services: docker
|
||||
|
||||
env:
|
||||
global:
|
||||
- ROLE_NAME: glusterfs
|
||||
matrix:
|
||||
- MOLECULE_DISTRO: centos7
|
||||
- MOLECULE_DISTRO: ubuntu1804
|
||||
- MOLECULE_DISTRO: ubuntu1604
|
||||
- MOLECULE_DISTRO: debian10
|
||||
|
||||
before_install:
|
||||
# Upgrade Docker to work with docker-py.
|
||||
- curl https://gist.githubusercontent.com/geerlingguy/ce883ad4aec6a5f1187ef93bd338511e/raw/36612d28981d92863f839c5aefe5b7dd7193d6c6/travis-ci-docker-upgrade.sh | sudo bash
|
||||
|
||||
install:
|
||||
# Install test dependencies.
|
||||
- pip install molecule[docker] yamllint ansible-lint docker
|
||||
|
||||
before_script:
|
||||
# Use actual Ansible Galaxy role name for the project directory.
|
||||
- cd ../
|
||||
- mv ansible-role-$ROLE_NAME geerlingguy.$ROLE_NAME
|
||||
- cd geerlingguy.$ROLE_NAME
|
||||
|
||||
script:
|
||||
# Run tests.
|
||||
- molecule test
|
||||
|
||||
notifications:
|
||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
||||
10
ansible-5/roles/geerlingguy.glusterfs/.yamllint
Normal file
10
ansible-5/roles/geerlingguy.glusterfs/.yamllint
Normal file
@@ -0,0 +1,10 @@
|
||||
---
|
||||
extends: default
|
||||
|
||||
rules:
|
||||
line-length:
|
||||
max: 120
|
||||
level: warning
|
||||
|
||||
ignore: |
|
||||
.github/stale.yml
|
||||
20
ansible-5/roles/geerlingguy.glusterfs/LICENSE
Normal file
20
ansible-5/roles/geerlingguy.glusterfs/LICENSE
Normal file
@@ -0,0 +1,20 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2017 Jeff Geerling
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of
|
||||
this software and associated documentation files (the "Software"), to deal in
|
||||
the Software without restriction, including without limitation the rights to
|
||||
use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of
|
||||
the Software, and to permit persons to whom the Software is furnished to do so,
|
||||
subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all
|
||||
copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS
|
||||
FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR
|
||||
COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER
|
||||
IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN
|
||||
CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
49
ansible-5/roles/geerlingguy.glusterfs/README.md
Normal file
49
ansible-5/roles/geerlingguy.glusterfs/README.md
Normal file
@@ -0,0 +1,49 @@
|
||||
# Ansible Role: GlusterFS
|
||||
|
||||
[](https://travis-ci.org/geerlingguy/ansible-role-glusterfs)
|
||||
|
||||
Installs and configures GlusterFS on Linux.
|
||||
|
||||
## Requirements
|
||||
|
||||
For GlusterFS to connect between servers, TCP ports `24007`, `24008`, and `24009`/`49152`+ (that port, plus an additional incremented port for each additional server in the cluster; the latter if GlusterFS is version 3.4+), and TCP/UDP port `111` must be open. You can open these using whatever firewall you wish (this can easily be configured using the `geerlingguy.firewall` role).
|
||||
|
||||
This role performs basic installation and setup of Gluster, but it does not configure or mount bricks (volumes), since that step is easier to do in a series of plays in your own playbook. Ansible 1.9+ includes the [`gluster_volume`](https://docs.ansible.com/gluster_volume_module.html) module to ease the management of Gluster volumes.
|
||||
|
||||
## Role Variables
|
||||
|
||||
Available variables are listed below, along with default values (see `defaults/main.yml`):
|
||||
|
||||
glusterfs_default_release: ""
|
||||
|
||||
You can specify a `default_release` for apt on Debian/Ubuntu by overriding this variable. This is helpful if you need a different package or version for the main GlusterFS packages (e.g. GlusterFS 3.5.x instead of 3.2.x with the `wheezy-backports` default release on Debian Wheezy).
|
||||
|
||||
glusterfs_ppa_use: true
|
||||
glusterfs_ppa_version: "LATEST"
|
||||
|
||||
For Ubuntu, specify whether to use the official Gluster PPA, and which version of the PPA to use. See Gluster's [Getting Started Guide](https://docs.gluster.org/en/latest/Install-Guide/Install/) for more info.
|
||||
|
||||
glusterfs_gpg_key_version: "7"
|
||||
glusterfs_deb_version: "LATEST"
|
||||
|
||||
For Debian, specify the version of the GPG key and apt package repository to use. See Gluster's [Getting Started Guide](https://docs.gluster.org/en/latest/Install-Guide/Install/) for more info.
|
||||
|
||||
## Dependencies
|
||||
|
||||
None.
|
||||
|
||||
## Example Playbook
|
||||
|
||||
- hosts: server
|
||||
roles:
|
||||
- geerlingguy.glusterfs
|
||||
|
||||
For a real-world use example, read through [Simple GlusterFS Setup with Ansible](https://www.jeffgeerling.com/blog/simple-glusterfs-setup-ansible), a blog post by this role's author, which is included in Chapter 8 of [Ansible for DevOps](https://www.ansiblefordevops.com/).
|
||||
|
||||
## License
|
||||
|
||||
MIT / BSD
|
||||
|
||||
## Author Information
|
||||
|
||||
This role was created in 2015 by [Jeff Geerling](https://www.jeffgeerling.com/), author of [Ansible for DevOps](https://www.ansiblefordevops.com/).
|
||||
11
ansible-5/roles/geerlingguy.glusterfs/defaults/main.yml
Normal file
11
ansible-5/roles/geerlingguy.glusterfs/defaults/main.yml
Normal file
@@ -0,0 +1,11 @@
|
||||
---
|
||||
glusterfs_daemon: glusterd
|
||||
|
||||
# For Ubuntu.
|
||||
glusterfs_default_release: ""
|
||||
glusterfs_ppa_use: true
|
||||
glusterfs_ppa_version: "7"
|
||||
|
||||
# For Debian.
|
||||
glusterfs_gpg_key_version: "7"
|
||||
glusterfs_deb_version: "LATEST"
|
||||
@@ -0,0 +1,2 @@
|
||||
install_date: Fri 24 Dec 2021 01:28:19 AM
|
||||
version: 3.1.2
|
||||
34
ansible-5/roles/geerlingguy.glusterfs/meta/main.yml
Normal file
34
ansible-5/roles/geerlingguy.glusterfs/meta/main.yml
Normal file
@@ -0,0 +1,34 @@
|
||||
---
|
||||
dependencies: []
|
||||
|
||||
galaxy_info:
|
||||
role_name: glusterfs
|
||||
author: geerlingguy
|
||||
description: GlusterFS installation for Linux.
|
||||
company: "Midwestern Mac, LLC"
|
||||
license: "license (BSD, MIT)"
|
||||
min_ansible_version: 2.0
|
||||
platforms:
|
||||
- name: EL
|
||||
versions:
|
||||
- 6
|
||||
- 7
|
||||
- name: Ubuntu
|
||||
versions:
|
||||
- trusty
|
||||
- xenial
|
||||
- bionic
|
||||
- name: Debian
|
||||
versions:
|
||||
- wheezy
|
||||
- jessie
|
||||
- stretch
|
||||
galaxy_tags:
|
||||
- system
|
||||
- networking
|
||||
- cloud
|
||||
- clustering
|
||||
- files
|
||||
- sharing
|
||||
- gluster
|
||||
- glusterfs
|
||||
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
become: true
|
||||
|
||||
pre_tasks:
|
||||
- name: Update apt cache.
|
||||
apt: update_cache=yes cache_valid_time=600
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
roles:
|
||||
- role: geerlingguy.glusterfs
|
||||
@@ -0,0 +1,21 @@
|
||||
---
|
||||
dependency:
|
||||
name: galaxy
|
||||
driver:
|
||||
name: docker
|
||||
lint: |
|
||||
set -e
|
||||
yamllint .
|
||||
ansible-lint
|
||||
platforms:
|
||||
- name: instance
|
||||
image: "geerlingguy/docker-${MOLECULE_DISTRO:-centos7}-ansible:latest"
|
||||
command: ${MOLECULE_DOCKER_COMMAND:-""}
|
||||
volumes:
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||
privileged: true
|
||||
pre_build_image: true
|
||||
provisioner:
|
||||
name: ansible
|
||||
playbooks:
|
||||
converge: ${MOLECULE_PLAYBOOK:-converge.yml}
|
||||
17
ansible-5/roles/geerlingguy.glusterfs/tasks/main.yml
Normal file
17
ansible-5/roles/geerlingguy.glusterfs/tasks/main.yml
Normal file
@@ -0,0 +1,17 @@
|
||||
---
|
||||
- name: Override glusterfs_daemon for Ubuntu 14.04.
|
||||
set_fact:
|
||||
glusterfs_daemon: glusterfs-server
|
||||
when:
|
||||
- ansible_distribution == 'Ubuntu'
|
||||
- ansible_distribution_version == "14.04"
|
||||
|
||||
# Setup/install tasks.
|
||||
- include: setup-RedHat.yml
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- include: setup-{{ ansible_distribution }}.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Ensure GlusterFS is started and enabled at boot.
|
||||
service: "name={{ glusterfs_daemon }} state=started enabled=yes"
|
||||
45
ansible-5/roles/geerlingguy.glusterfs/tasks/setup-Debian.yml
Normal file
45
ansible-5/roles/geerlingguy.glusterfs/tasks/setup-Debian.yml
Normal file
@@ -0,0 +1,45 @@
|
||||
---
|
||||
- name: Ensure dependencies are installed.
|
||||
apt:
|
||||
name:
|
||||
- gnupg2
|
||||
- apt-transport-https
|
||||
- ca-certificates
|
||||
state: present
|
||||
|
||||
- name: Ensure repository pubkey for GlusterFS is present.
|
||||
apt_key:
|
||||
url: 'https://download.gluster.org/pub/gluster/glusterfs/{{ glusterfs_gpg_key_version }}/rsa.pub'
|
||||
state: present
|
||||
register: glusterfs_pub_key_added
|
||||
|
||||
- name: Get the DEB architecture.
|
||||
command: dpkg --print-architecture
|
||||
changed_when: false
|
||||
register: deb_architecture
|
||||
|
||||
- name: Ensure debian repo is present.
|
||||
apt_repository:
|
||||
repo: "deb https://download.gluster.org/pub/gluster/glusterfs/{{ glusterfs_deb_version }}/Debian/\
|
||||
{{ ansible_distribution_release }}/{{ deb_architecture.stdout }}/apt {{ ansible_distribution_release }} \
|
||||
main"
|
||||
state: present
|
||||
filename: gluster
|
||||
register: glusterfs_deb_source_added
|
||||
|
||||
- name: Ensure GlusterFS will reinstall if the DEB source was just added.
|
||||
apt:
|
||||
name:
|
||||
- glusterfs-server
|
||||
- glusterfs-client
|
||||
state: absent
|
||||
when: glusterfs_deb_source_added.changed
|
||||
tags: ['skip_ansible_lint']
|
||||
|
||||
- name: Ensure GlusterFS is installed.
|
||||
apt:
|
||||
name:
|
||||
- glusterfs-server
|
||||
- glusterfs-client
|
||||
state: present
|
||||
default_release: "{{ glusterfs_default_release }}"
|
||||
12
ansible-5/roles/geerlingguy.glusterfs/tasks/setup-RedHat.yml
Normal file
12
ansible-5/roles/geerlingguy.glusterfs/tasks/setup-RedHat.yml
Normal file
@@ -0,0 +1,12 @@
|
||||
---
|
||||
- name: Ensure dependencies are installed.
|
||||
yum:
|
||||
name: "centos-release-gluster{{ glusterfs_default_release }}"
|
||||
state: present
|
||||
|
||||
- name: Ensure Gluster packages are installed.
|
||||
yum:
|
||||
name:
|
||||
- glusterfs-server
|
||||
- glusterfs-client
|
||||
state: present
|
||||
30
ansible-5/roles/geerlingguy.glusterfs/tasks/setup-Ubuntu.yml
Normal file
30
ansible-5/roles/geerlingguy.glusterfs/tasks/setup-Ubuntu.yml
Normal file
@@ -0,0 +1,30 @@
|
||||
---
|
||||
- name: Ensure dependencies are installed.
|
||||
apt:
|
||||
name: dirmngr
|
||||
state: present
|
||||
|
||||
- name: Ensure PPA for GlusterFS is present.
|
||||
apt_repository:
|
||||
repo: 'ppa:gluster/glusterfs-{{ glusterfs_ppa_version }}'
|
||||
state: present
|
||||
update_cache: true
|
||||
register: glusterfs_ppa_added
|
||||
when: glusterfs_ppa_use
|
||||
|
||||
- name: Ensure GlusterFS will reinstall if the PPA was just added.
|
||||
apt:
|
||||
name:
|
||||
- glusterfs-server
|
||||
- glusterfs-client
|
||||
state: absent
|
||||
when: glusterfs_ppa_added.changed
|
||||
tags: ['skip_ansible_lint']
|
||||
|
||||
- name: Ensure GlusterFS is installed.
|
||||
apt:
|
||||
name:
|
||||
- glusterfs-server
|
||||
- glusterfs-client
|
||||
state: present
|
||||
default_release: "{{ glusterfs_default_release }}"
|
||||
29
ansible-5/roles/glusterfs/tasks/install.yaml
Normal file
29
ansible-5/roles/glusterfs/tasks/install.yaml
Normal file
@@ -0,0 +1,29 @@
|
||||
---
|
||||
# main tasks for installing glusterfs
|
||||
|
||||
|
||||
# install packages
|
||||
- name: Ensure glusterfs server is installed.
|
||||
apt:
|
||||
name: "{{ item }}"
|
||||
update_cache: yes
|
||||
cache_valid_time: 3600
|
||||
state: latest
|
||||
with_items:
|
||||
- glusterfs-server
|
||||
- xfsprogs
|
||||
- xfsdump
|
||||
|
||||
- name: Start service k3s, if not started
|
||||
block:
|
||||
- name: start on home
|
||||
ansible.builtin.service:
|
||||
name: glusterd
|
||||
state: started
|
||||
when: "ansible_lsb.major_release >= '20'"
|
||||
|
||||
- name: start on cubox-i
|
||||
ansible.builtin.service:
|
||||
name: glusterfs-server
|
||||
state: started
|
||||
when: "ansible_lsb.major_release < '20'"
|
||||
15
ansible-5/roles/glusterfs/tasks/main.yml
Normal file
15
ansible-5/roles/glusterfs/tasks/main.yml
Normal file
@@ -0,0 +1,15 @@
|
||||
---
|
||||
|
||||
- name: install on ubuntu
|
||||
ansible.builtin.include_role:
|
||||
name: geerlingguy.glusterfs
|
||||
when: ansible_architecture != 'armv7l'
|
||||
|
||||
- include_tasks: install.yaml
|
||||
when: ansible_architecture == 'armv7l'
|
||||
|
||||
- include_tasks: manage_volumes.yml
|
||||
|
||||
#- include_tasks: prometheus_exporter.yml
|
||||
|
||||
|
||||
57
ansible-5/roles/glusterfs/tasks/manage_volumes.yml
Normal file
57
ansible-5/roles/glusterfs/tasks/manage_volumes.yml
Normal file
@@ -0,0 +1,57 @@
|
||||
---
|
||||
# glusterfs mounts
|
||||
|
||||
# create mount points
|
||||
- name: create mount points for all bricks in all volumes
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
mode: 0755
|
||||
with_items: "{{mountpoints}}"
|
||||
|
||||
# manage volumes
|
||||
#- name: remove old gluster volumes
|
||||
# gluster_volume:
|
||||
# state: absent
|
||||
# name: "{{ item.key }}"
|
||||
# rebalance: no
|
||||
# replicas: false
|
||||
# cluster: "{{cluster}}"
|
||||
# with_dict: "{{removed_volumes}}"
|
||||
# run_once: true
|
||||
|
||||
|
||||
- name: create gluster volumes
|
||||
gluster_volume:
|
||||
state: present
|
||||
start_on_create: yes
|
||||
name: "{{ item.key }}"
|
||||
brick: '{{ item.value | join(",")}}'
|
||||
rebalance: no
|
||||
replicas: 2
|
||||
force: true
|
||||
cluster: "{{cluster}}"
|
||||
with_dict: "{{volumes}}"
|
||||
run_once: true
|
||||
|
||||
#- name: create tmp gluster volumes
|
||||
# gluster_volume:
|
||||
# state: present
|
||||
# name: "tmp"
|
||||
# brick: '/data/glusterfs/tmp/brick1/brick'
|
||||
# rebalance: no
|
||||
# replicas: 1
|
||||
# cluster: "{{cluster}}"
|
||||
# run_once: true
|
||||
|
||||
- name: create distributed gluster volumes
|
||||
gluster_volume:
|
||||
state: present
|
||||
name: "{{ item.key }}"
|
||||
brick: '{{ item.value | join(",")}}'
|
||||
rebalance: no
|
||||
replicas: false
|
||||
force: true
|
||||
cluster: "{{cluster}}"
|
||||
with_dict: "{{distributed_volumes}}"
|
||||
run_once: true
|
||||
31
ansible-5/roles/glusterfs/tasks/prometheus_exporter.yml
Normal file
31
ansible-5/roles/glusterfs/tasks/prometheus_exporter.yml
Normal file
@@ -0,0 +1,31 @@
|
||||
---
|
||||
# tasks to install prometheus gluster_exporter
|
||||
# https://github.com/ofesseler/gluster_exporter
|
||||
|
||||
# install packages
|
||||
- name: Update apt cache.
|
||||
apt: update_cache=yes cache_valid_time=86400
|
||||
|
||||
- name: Install gluster_exporter dependencies.
|
||||
apt: "name={{ item }} state=installed"
|
||||
with_items:
|
||||
- golang-go
|
||||
|
||||
- name: make golang workspace
|
||||
file:
|
||||
path: /opt/golang
|
||||
state: directory
|
||||
mode: 0775
|
||||
|
||||
- name: install gluster_exporter
|
||||
shell: GOPATH=/opt/golang go get github.com/ofesseler/gluster_exporter
|
||||
|
||||
- name: add gluster_exporter to startup
|
||||
lineinfile:
|
||||
dest: /etc/rc.local
|
||||
regexp: '/opt/golang/bin/gluster_exporter'
|
||||
line: 'nohup /opt/golang/bin/gluster_exporter --profile &'
|
||||
insertbefore: "^exit 0"
|
||||
|
||||
- name: start gluster_exporter
|
||||
shell: nohup /opt/golang/bin/gluster_exporter --profile &
|
||||
Reference in New Issue
Block a user