deploy-base/roles/glusterfs-server/tasks/main.yml

43 lines
1.1 KiB
YAML
Raw Normal View History

2019-02-26 03:49:51 +00:00
---
- name: install glusterfs 4.1 LTS SIG package (CentOS)
package:
name: centos-release-gluster41
state: latest
when: ansible_distribution == 'CentOS'
- name: install glusterfs-server
package:
name: glusterfs-server
state: present
when: ansible_distribution in ["CentOS", "Red Hat Enterprise Linux", "Fedora"] and not is_atomic
register: gluster_installed
- name: start glusterd
service:
name: glusterd
state: started
enabled: yes
when: gluster_installed is changed
- name: add hosts to /etc/hosts
lineinfile:
path: /etc/hosts
state: present
line: "{{ hostvars[item].ip }} {{ hostvars[item].gluster_hostname }}"
regexp: "^{{ hostvars[item].ip }} "
with_items: "{{ groups.all }}"
- name: create glusterfs-server container (atomic)
docker_container:
name: glusterfs-server
image: gluster/gluster-centos:gluster4u0_centos7
hostname: glusterfs-server
network_mode: host
privileged: yes
restart_policy: always
shm_size: 2G
devices:
- "{{ gluster_dev }}:{{ gluster_dev }}:rwo"
when: is_atomic