From 668ba6b6e0975e5cc81293eac0290b660d3e01c0 Mon Sep 17 00:00:00 2001 From: Pablo Moreno Date: Sun, 20 Nov 2016 17:05:43 +0000 Subject: [PATCH] Adds glusterfs client role for systems where glusterfs-client needs to be installed. --- .../glusterfs/{ => client}/defaults/main.yml | 0 roles/glusterfs/{ => client}/meta/main.yml | 0 roles/glusterfs/client/tasks/main.yml | 16 ++++++++++ roles/glusterfs/client/tasks/setup-Debian.yml | 24 +++++++++++++++ roles/glusterfs/client/tasks/setup-RedHat.yml | 10 +++++++ roles/glusterfs/server/defaults/main.yml | 11 +++++++ roles/glusterfs/server/meta/main.yml | 30 +++++++++++++++++++ roles/glusterfs/{ => server}/tasks/main.yml | 0 .../{ => server}/tasks/setup-Debian.yml | 0 .../{ => server}/tasks/setup-RedHat.yml | 0 roles/glusterfs/{ => server}/tests/test.yml | 0 roles/glusterfs/{ => server}/vars/Debian.yml | 0 roles/glusterfs/{ => server}/vars/RedHat.yml | 0 13 files changed, 91 insertions(+) rename roles/glusterfs/{ => client}/defaults/main.yml (100%) rename roles/glusterfs/{ => client}/meta/main.yml (100%) create mode 100644 roles/glusterfs/client/tasks/main.yml create mode 100644 roles/glusterfs/client/tasks/setup-Debian.yml create mode 100644 roles/glusterfs/client/tasks/setup-RedHat.yml create mode 100644 roles/glusterfs/server/defaults/main.yml create mode 100644 roles/glusterfs/server/meta/main.yml rename roles/glusterfs/{ => server}/tasks/main.yml (100%) rename roles/glusterfs/{ => server}/tasks/setup-Debian.yml (100%) rename roles/glusterfs/{ => server}/tasks/setup-RedHat.yml (100%) rename roles/glusterfs/{ => server}/tests/test.yml (100%) rename roles/glusterfs/{ => server}/vars/Debian.yml (100%) rename roles/glusterfs/{ => server}/vars/RedHat.yml (100%) diff --git a/roles/glusterfs/defaults/main.yml b/roles/glusterfs/client/defaults/main.yml similarity index 100% rename from roles/glusterfs/defaults/main.yml rename to roles/glusterfs/client/defaults/main.yml diff --git a/roles/glusterfs/meta/main.yml b/roles/glusterfs/client/meta/main.yml similarity index 100% rename from roles/glusterfs/meta/main.yml rename to roles/glusterfs/client/meta/main.yml diff --git a/roles/glusterfs/client/tasks/main.yml b/roles/glusterfs/client/tasks/main.yml new file mode 100644 index 000000000..dc151284d --- /dev/null +++ b/roles/glusterfs/client/tasks/main.yml @@ -0,0 +1,16 @@ +--- +# This is meant for Ubuntu and RedHat installations, where apparently the glusterfs-client is not used from inside +# hyperkube and needs to be installed as part of the system. + +# Setup/install tasks. +- include: setup-RedHat.yml + when: ansible_os_family == 'RedHat' and groups['gfs-cluster'] is defined + +- include: setup-Debian.yml + when: ansible_os_family == 'Debian' and groups['gfs-cluster'] is defined + +- name: Ensure Gluster mount directories exist. + file: "path={{ item }} state=directory mode=0775" + with_items: + - "{{ gluster_mount_dir }}" + when: ansible_os_family in ["Debian","RedHat"] and groups['gfs-cluster'] is defined diff --git a/roles/glusterfs/client/tasks/setup-Debian.yml b/roles/glusterfs/client/tasks/setup-Debian.yml new file mode 100644 index 000000000..dc2dfa875 --- /dev/null +++ b/roles/glusterfs/client/tasks/setup-Debian.yml @@ -0,0 +1,24 @@ +--- +- name: Add PPA for GlusterFS. + apt_repository: + repo: 'ppa:gluster/glusterfs-{{ glusterfs_ppa_version }}' + state: present + update_cache: yes + register: glusterfs_ppa_added + when: glusterfs_ppa_use + +- name: Ensure GlusterFS client will reinstall if the PPA was just added. + apt: + name: "{{ item }}" + state: absent + with_items: + - glusterfs-client + when: glusterfs_ppa_added.changed + +- name: Ensure GlusterFS client is installed. + apt: + name: "{{ item }}" + state: installed + default_release: "{{ glusterfs_default_release }}" + with_items: + - glusterfs-client diff --git a/roles/glusterfs/client/tasks/setup-RedHat.yml b/roles/glusterfs/client/tasks/setup-RedHat.yml new file mode 100644 index 000000000..2034aa8ef --- /dev/null +++ b/roles/glusterfs/client/tasks/setup-RedHat.yml @@ -0,0 +1,10 @@ +--- +- name: Install Prerequisites + yum: name={{ item }} state=present + with_items: + - "centos-release-gluster{{ glusterfs_default_release }}" + +- name: Install Packages + yum: name={{ item }} state=present + with_items: + - glusterfs-client diff --git a/roles/glusterfs/server/defaults/main.yml b/roles/glusterfs/server/defaults/main.yml new file mode 100644 index 000000000..5580ed271 --- /dev/null +++ b/roles/glusterfs/server/defaults/main.yml @@ -0,0 +1,11 @@ +--- +# For Ubuntu. +glusterfs_default_release: "" +glusterfs_ppa_use: yes +glusterfs_ppa_version: "3.5" + +# Gluster configuration. +gluster_mount_dir: /mnt/gluster +gluster_volume_node_mount_dir: /mnt/xfs-drive-gluster +gluster_brick_dir: "{{ gluster_volume_node_mount_dir }}/brick" +gluster_brick_name: gluster diff --git a/roles/glusterfs/server/meta/main.yml b/roles/glusterfs/server/meta/main.yml new file mode 100644 index 000000000..c53f17159 --- /dev/null +++ b/roles/glusterfs/server/meta/main.yml @@ -0,0 +1,30 @@ +--- +dependencies: [] + +galaxy_info: + 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: + - precise + - trusty + - xenial + - name: Debian + versions: + - wheezy + - jessie + galaxy_tags: + - system + - networking + - cloud + - clustering + - files + - sharing diff --git a/roles/glusterfs/tasks/main.yml b/roles/glusterfs/server/tasks/main.yml similarity index 100% rename from roles/glusterfs/tasks/main.yml rename to roles/glusterfs/server/tasks/main.yml diff --git a/roles/glusterfs/tasks/setup-Debian.yml b/roles/glusterfs/server/tasks/setup-Debian.yml similarity index 100% rename from roles/glusterfs/tasks/setup-Debian.yml rename to roles/glusterfs/server/tasks/setup-Debian.yml diff --git a/roles/glusterfs/tasks/setup-RedHat.yml b/roles/glusterfs/server/tasks/setup-RedHat.yml similarity index 100% rename from roles/glusterfs/tasks/setup-RedHat.yml rename to roles/glusterfs/server/tasks/setup-RedHat.yml diff --git a/roles/glusterfs/tests/test.yml b/roles/glusterfs/server/tests/test.yml similarity index 100% rename from roles/glusterfs/tests/test.yml rename to roles/glusterfs/server/tests/test.yml diff --git a/roles/glusterfs/vars/Debian.yml b/roles/glusterfs/server/vars/Debian.yml similarity index 100% rename from roles/glusterfs/vars/Debian.yml rename to roles/glusterfs/server/vars/Debian.yml diff --git a/roles/glusterfs/vars/RedHat.yml b/roles/glusterfs/server/vars/RedHat.yml similarity index 100% rename from roles/glusterfs/vars/RedHat.yml rename to roles/glusterfs/server/vars/RedHat.yml