Coder Social home page Coder Social logo

geerlingguy / ansible-role-glusterfs Goto Github PK

View Code? Open in Web Editor NEW
105.0 7.0 59.0 66 KB

Ansible Role - GlusterFS

Home Page: https://galaxy.ansible.com/geerlingguy/glusterfs/

License: MIT License

ansible role glusterfs gluster file server filesystem install sync

ansible-role-glusterfs's Introduction

Ansible Role: GlusterFS

CI

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 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 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 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, a blog post by this role's author, which is included in Chapter 8 of Ansible for DevOps.

License

MIT / BSD

Author Information

This role was created in 2015 by Jeff Geerling, author of Ansible for DevOps.

ansible-role-glusterfs's People

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar

ansible-role-glusterfs's Issues

Glusterfs doesn't work for debian 8

I checkout project from master branch and I ran molecule test for geerlingguy/docker-debian8-ansible:latest. I don't know why but got an error. My ansible version is ansible 2.7.1

TASK [ansible-role-glusterfs : Ensure debian repo is present.] ***************** An exception occurred during task execution. To see the full traceback, use -vvv. The error was: , E:Some index files failed to download. They have been ignored, or old ones used instead. fatal: [instance]: FAILED! => {"changed": false, "module_stderr": "Traceback (most recent call last):\n File \"/root/.ansible/tmp/ansible-tmp-1551168034.8251243-176084680185581/AnsiballZ_apt_repository.py\", line 113, in <module>\n _ansiballz_main()\n File \"/root/.ansible/tmp/ansible-tmp-1551168034.8251243-176084680185581/AnsiballZ_apt_repository.py\", line 105, in _ansiballz_main\n invoke_module(zipped_mod, temp_path, ANSIBALLZ_PARAMS)\n File \"/root/.ansible/tmp/ansible-tmp-1551168034.8251243-176084680185581/AnsiballZ_apt_repository.py\", line 48, in invoke_module\n imp.load_module('__main__', mod, module, MOD_DESC)\n File \"/tmp/ansible_apt_repository_payload_IJ5oNY/__main__.py\", line 550, in <module>\n File \"/tmp/ansible_apt_repository_payload_IJ5oNY/__main__.py\", line 542, in main\n File \"/usr/lib/python2.7/dist-packages/apt/cache.py\", line 443, in update\n raise FetchFailedException(e)\napt.cache.FetchFailedException: W:Failed to fetch https://download.gluster.org/pub/gluster/glusterfs/LATEST/Debian/jessie/amd64/apt/dists/jessie/main/binary-amd64/Packages HttpError404\n, E:Some index files failed to download. They have been ignored, or old ones used instead.\n", "module_stdout": "", "msg": "MODULE FAILURE\nSee stdout/stderr for the exact error", "rc": 1}

In my opinion the gluster 5 version doesn't support debian jessie https://download.gluster.org/pub/gluster/glusterfs/LATEST/Debian/

Failed install on Raspberry pi 3/4 32bit

as requested in #33 i have created a new ticket for this issue.

when using this role to install to a raspberry pi 3/3 on the "Ensure Debian Repo is present" step you get the following error.

{"changed": false, "msg": "apt cache update failed"}

running in debug mode produces the following.
The full traceback is: File "/tmp/ansible_apt_repository_payload_nycaw82d/ansible_apt_repository_payload.zip/ansible/modules/packaging/os/apt_repository.py", line 548, in main File "/usr/lib/python3/dist-packages/apt/cache.py", line 589, in update raise FetchFailedException(e) fatal: [192.168.0.200]: FAILED! => { "changed": false, "invocation": { "module_args": { "codename": null, "filename": "gluster", "install_python_apt": true, "mode": null, "repo": "deb [trusted=yes] https://download.gluster.org/pub/gluster/glusterfs/LATEST/Debian/buster/armhf/apt buster main", "state": "present", "update_cache": true, "validate_certs": true } }, "msg": "apt cache update failed" }

performing an apt update on the rpi manually provides no error and multiple other roles also update the cache. after doing some investigation i can see that in this step it adds the glusterFS repository and searches for the following.

https://download.gluster.org/pub/gluster/glusterfs/LATEST/Debian/buster/armhf/

but armhf does not exists and only builds for arm64 and amd 64.

this could be a side issue as ansible is reporting an apt update error but this is the only thing i could see wrong.

Hope this helps.

Installation of GlusterFS fails

Hi,
The installation of GlusterFS fails.

I created a role that I want to roll out to some nodes in my home lab.

The role is defined as follows:

---
# tasks file for single_data_volume
- include_role:
    name: gluster-node
    tasks_from: single_data_volume
  vars:
    gluster_brick_dir: '/data1'
    gluster_mount_dir: '/gluster_volume1'
    gluster_brick_name: 'brick1'

- include_role:
    name: gluster-node-partition
    tasks_from: default_partitioning

- name: Create default partitioning
  include_role:
    name: gluster-node-partition

- name: Create gluster volume for partition 1
  include_role:
    name: gluster-node
  vars:
    gluster_brick_dir: /data1/glusterbrick1
    gluster_mount_dir: /gluster_volume1
    gluster_brick_name: 'brick1'

- name: Create gluster volume for partition 2
  include_role:
    name: gluster-node
  vars:
    gluster_brick_dir: /data1/glusterbrick2
    gluster_mount_dir: /gluster_volume2
    gluster_brick_name: 'brick2'

- name: Create gluster volume for partition 3
  include_role:
    name: gluster-node
  vars:
    gluster_brick_dir: /data1/glusterbrick3
    gluster_mount_dir: /gluster_volume3
    gluster_brick_name: 'brick3'

It makes use of another role I defined which contains the code from you tutorial (https://www.jeffgeerling.com/blog/simple-glusterfs-setup-ansible)

---
# tasks file for single_data_volume
- include_role:
    name: gluster-node-partition
    tasks_from: default_partitioning

- include_role:
    name: geerlingguy.glusterfs

- name: Install glusterfs
  include_role:
    name: geerlingguy.glusterfs

- name: Ensure Gluster brick and mount directories exist.
  file: "path={{ item }} state=directory mode=0775"
  with_items:
    - "{{ gluster_brick_dir }}"
    - "{{ gluster_mount_dir }}"
  become: true

- name: Configure Gluster volume.
  gluster_volume:
    state: present
    name: "{{ gluster_brick_name }}"
    brick: "{{ gluster_brick_dir }}"
    replicas: 2
    cluster: "{{ groups.storageservers | join(',') }}"
    host: "{{ inventory_hostname }}"
    force: yes
  run_once: true

- name: Ensure Gluster volume is mounted.
  mount:
    name: "{{ gluster_mount_dir }}"
    src: "{{ inventory_hostname }}:/{{ gluster_brick_name }}"
    fstype: glusterfs
    opts: "defaults,_netdev"
    state: mounted
  become: true

I do the rollout using the following command:

ansible-playbook -i inventories/playground/hosts.yaml site.yml -K

This is the error message I get:

fatal: [node2]: FAILED! => {"changed": false, "msg": "'/usr/bin/apt-mark manual dirmngr' failed: E: Could not create temporary file for /var/lib/apt/extended_states - mkstemp (13: Permission denied)\nE: Failed to write temporary StateFile /var/lib/apt/extended_states\n", "rc": 100, "stderr": "E: Could not create temporary file for /var/lib/apt/extended_states - mkstemp (13: Permission denied)\nE: Failed to write temporary StateFile /var/lib/apt/extended_states\n", "stderr_lines": ["E: Could not create temporary file for /var/lib/apt/extended_states - mkstemp (13: Permission denied)", "E: Failed to write temporary StateFile /var/lib/apt/extended_states"], "stdout": "dirmngr set to manually installed.\n", "stdout_lines": ["dirmngr set to manually installed."]}
fatal: [node1]: FAILED! => {"changed": false, "msg": "'/usr/bin/apt-mark manual dirmngr' failed: E: Could not create temporary file for /var/lib/apt/extended_states - mkstemp (13: Permission denied)\nE: Failed to write temporary StateFile /var/lib/apt/extended_states\n", "rc": 100, "stderr": "E: Could not create temporary file for /var/lib/apt/extended_states - mkstemp (13: Permission denied)\nE: Failed to write temporary StateFile /var/lib/apt/extended_states\n", "stderr_lines": ["E: Could not create temporary file for /var/lib/apt/extended_states - mkstemp (13: Permission denied)", "E: Failed to write temporary StateFile /var/lib/apt/extended_states"], "stdout": "dirmngr set to manually installed.\n", "stdout_lines": ["dirmngr set to manually installed."]}

Both nodes run latest Ubuntu 18.04 server edition.

What do I need to do to make it work?

TASK [geerlingguy.glusterfs : Import GlusterFS GPG key.] failed

fatal: [host1.local]: FAILED! => {"changed": false, "failed": true, "msg": "failed to fetch key at http://download.gluster.org/pub/gluster/glusterfs/LATEST/rsa.pub , error was: HTTP Error 404: Not Found"}
        to retry, use: --limit @1_prepare_gluster.retry

Maybe the repo isn't there anymore?

IPC connect call failed - in task: Ensure PPA for GlusterFS is present. (Ubuntu 22)

Hello Jeff, i've been using your roles a lot and this one sometimes give me an error in the task Ensure PPA for GlusterFS is present
This only happens sometimes and may be a problem with my hoster(hetzner) or other things on my Ubuntu box.

vars:

glusterfs_default_release: ""
glusterfs_ppa_use: true
glusterfs_ppa_version: "10"

error

TASK [geerlingguy.glusterfs : Ensure PPA for GlusterFS is present.] ****************************************************************************
fatal: [data-01-5c156b41-1c43-5588-8b28-d382b21ba464]: FAILED! => changed=false 
  cmd: /usr/bin/apt-key adv --recv-keys --no-tty --keyserver hkp://keyserver.ubuntu.com:80 F7C73FCC930AC9F83B387A5613E01B7B3FE869A9
  msg: |-
    Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
    gpg: key 13E01B7B3FE869A9: public key "Launchpad PPA for Gluster" imported
    gpg: can't connect to the agent: IPC connect call failed
    gpg: Total number processed: 1
    gpg:               imported: 1
  rc: 2
  stderr: |-
    Warning: apt-key is deprecated. Manage keyring files in trusted.gpg.d instead (see apt-key(8)).
    gpg: key 13E01B7B3FE869A9: public key "Launchpad PPA for Gluster" imported
    gpg: can't connect to the agent: IPC connect call failed
    gpg: Total number processed: 1
    gpg:               imported: 1
  stderr_lines: <omitted>
  stdout: |-
    Executing: /tmp/apt-key-gpghome.fRR92Wrx6D/gpg.1.sh --recv-keys --no-tty --keyserver hkp://keyserver.ubuntu.com:80 F7C73FCC930AC9F83B387A5613E01B7B3FE869A9
  stdout_lines: <omitted>

This may be a problem with me running the playbook too many times in development but i don't know just wanted to post maybe you have a idea for a workaround to ensure the task won't fail.

Replication: Unfortunately i am not able to replicate this.

edit: without ppa i have no issues.

Thanks for all your work!

wrong apt repo address for raspberry pi

TASK [geerlingguy.glusterfs : Ensure debian repo is present.] ******************************************************************************************************************************************************************************************************************
fatal: [pi3modelb]: FAILED! => {"changed": false, "msg": "Failed to update apt cache: E:The repository 'https://download.gluster.org/pub/gluster/glusterfs/LATEST/Debian/bullseye/armhf/apt bullseye Release' does not have a Release file."}

i believe the right address is https://download.gluster.org/pub/gluster/glusterfs/LATEST/Debian/bullseye/arm64/apt/ but its currently empty.

is there any way to ignore this error and move on?

Packages actualization

Maybe it would be good to switch off GlusterFS pakages upgrading (for example for Ubuntu "apt-mark hold glusterfs*") for security reasons.

Error adding glusterfs3.5

I get this error when adding your role to a server - it looks like an issue with a missing Release file in the 3.5 ppa. Changing glusterfs_ppa_version from 3.5 to 3.8 gets around the issue

TASK [geerlingguy.glusterfs : Add PPA for GlusterFS.] ************************** fatal: [site02]: FAILED! => {"changed": false, "failed": true, "module_stderr": "", "module_stdout": "Traceback (most recent call last):\r\n File \"/tmp/ansible_ezhESi/ansible_module_apt_repository.py\", line 522, in <module>\r\n main()\r\n File \"/tmp/ansible_ezhESi/ansible_module_apt_repository.py\", line 512, in main\r\n cache.update()\r\n File \"/usr/lib/python2.7/dist-packages/apt/cache.py\", line 454, in update\r\n raise FetchFailedException(e)\r\napt.cache.FetchFailedException: W:The repository 'http://ppa.launchpad.net/gluster/glusterfs-3.5/ubuntu xenial Release' does not have a Release file., W:Data from such a repository can't be authenticated and is therefore potentially dangerous to use., W:See apt-secure(8) manpage for repository creation and user configuration details., E:Failed to fetch http://ppa.launchpad.net/gluster/glusterfs-3.5/ubuntu/dists/xenial/main/binary-amd64/Packages 404 Not Found, E:Some index files failed to download. They have been ignored, or old ones used instead.\r\n", "msg": "MODULE FAILURE", "parsed": false}

See how this role would work with Ansible's new gluster_volume module

Using Ansible's gluster_volume module (available starting in 1.9.x) might simplify this role's ambition a bit; I was originally looking into ways to use this role to communicate with multiple servers and coordinating bricks and service starts... but it looks like this role might be best suited to simply installing all the requisite software and configuration.

Then playbooks would be responsible for all the actual brick setup using gluster_volume.

GlusterFS in clients only mode.

I am using GlusterFS in a small setup to share files between Servers.

My Setup:
2 GlusterFS server for redudency.
4 GlusterFS clients which mounts the server brick.

While this Ansible Role is perfect for setting up GlusterFS server, This playbook also installs glusterfs-server on the client machines.

Proposal: We can have a variable such as glusterfs_server_use Which will not install glusterfs-server on the client machines.

glusterfs_server_use: true

I can make the above changes and send a PR in some time.

Wrong service name

I have Ubuntu 16.04.4 LTS. Role cannot run the system service named "glusterfs-server" because it doesn't exist. Exists the "glusterd" service.

New CentOS release 7.6 breaks repo install

With the new CentOS release the installation of the repository package now installs centos-release-gluster-legacy from the extras, which by default which doesn't give access to any gluster packages.

Packages available:

centos-release-gluster-legacy.noarch : Disable unmaintained Gluster repositories from the CentOS Storage SIG
centos-release-gluster40.x86_64 : Gluster 4.0 (Short Term Stable) packages from the CentOS Storage SIG repository
centos-release-gluster41.noarch : Gluster 4.1 (Long Term Stable) packages from the CentOS Storage SIG repository
centos-release-gluster5.noarch : Gluster 5 packages from the CentOS Storage SIG repository

Looking at the setup-RedHat.yml file it specified centos-release-gluster{{ glusterfs_default_release }} so I guess specifying 40, 41 or 5 should work but in the default file this variable suggests usage is only for Ubuntu.

I fixed this in my env by changing the variable above in the defaults to 41 (LTS repo for Gluster)

Not sure what the best approach would be to resolve this, other than ensure a relevant repo version is specified. Shame CentOS/RHEL don't have a package without version in the title which works.

glusterfs installation fails due to missing python3-pyxattr package

Summary
The installation of glusterfs fails on a fresh CentOS 8 Stream installation with the following error:

TASK [geerlingguy.glusterfs : Ensure Gluster packages are installed.]
*******************************************************************************
fatal: [centos8stream]: FAILED! => {"changed": false, "failures": [], "msg": "Depsolve Error occured: \n Problem: 
cannot install the best candidate for the job\n  - nothing provides python3-pyxattr needed by 
glusterfs-server-9.1-1.el8.aarch64", "rc": 1, "results": []}

The package python3-pyxattr is provided by the PowerTools repo, which is not activated per default. The repository can be activated with dnf config-manager --enable PowerTools

[fgierlinger@centos8stream ~]$ sudo dnf repolist
repo id                                                  repo name
AppStream                                                CentOS-8 - AppStream
BaseOS                                                   CentOS-8 - Base
centos-gluster9                                          CentOS-8 - Gluster 9
extras                                                   CentOS-8 - Extras
[fgierlinger@centos8stream ~]$ sudo dnf config-manager --enable PowerTools
[fgierlinger@centos8stream ~]$ sudo dnf repolist
repo id                                                  repo name
AppStream                                                CentOS-8 - AppStream
BaseOS                                                   CentOS-8 - Base
PowerTools                                               CentOS-8 - PowerTools
centos-gluster9                                          CentOS-8 - Gluster 9
extras                                                   CentOS-8 - Extras

The parameter enablerepo for yum might solve this problem, but I have not tested it.

Steps to reproduce
Execute the following playbook on a CentOS 8 Stream host.

- hosts: all
  gather_facts: yes
  roles:
    - role: geerlingguy.glusterfs
      vars:
        glusterfs_default_release: 9

Expected behaviour
Glusterfs installation succeeds when executing the role and specifying glusterfs_default_release: 9

Actual behaviour
The installation of glusterfs fails, because the package python3-pyxattr can not be installed, which is located in the PowerTools repository. The PowerTools repository is not enabled in a CentOS 8 Stream minimal installation

Host information
OS: CentOS 8 Stream aarch64
Python: 3.8.2
Ansible: 2.10.7
geerlingguy.glusterfs: 3.1.2

missing release-file in gluster repo for Debian Bullseye

Hi Jeff,

at first thank you for your role.
Actually it fails for for Debian Bullseye, because of a missing Release file at the configured path.

E: The repository 'https://download.gluster.org/pub/gluster/glusterfs/LATEST/Debian/bullseye/amd64/apt bullseye Release' does not have a Release file. N: Updating from such a repository can't be done securely, and is therefore disabled by default. N: See apt-secure(8) manpage for repository creation and user configuration details.

There is a simple solution for it.
There's a path with a Release file.

I will commit a patch soon.

Rocky Linux 8 installation fails with 'failed to download metadata for repo "centos-gluster9"'

In CI, RL8 fails with:

TASK [geerlingguy.glusterfs : Ensure Gluster packages are installed.] **********
[117](https://github.com/geerlingguy/ansible-role-glusterfs/runs/5356276882?check_suite_focus=true#step:5:117)
  fatal: [instance]: FAILED! => {"changed": false, "msg": "Failed to download metadata for repo 'centos-gluster9': Cannot prepare internal mirrorlist: No URLs in mirrorlist", "rc": 1, "results": []}

For now I'm disabling those tests.

Install fails for Raspberry Pi 3B

Hi,

I am trying to use the role and it fails for Rpi B3+:

TASK [geerlingguy.glusterfs : Ensure debian repo is present.] *********************************************************************************************************************
Sunday 26 January 2020 12:14:12 -0800 (0:00:01.080) 0:03:11.539 ********
fatal: [pi1]: FAILED! => {"changed": false, "msg": "apt cache update failed"}

Thanks.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.