deploy-base/roles/glusterfs-server/tasks/main.yml
2019-02-25 21:49:51 -06:00

42 lines
1.1 KiB
YAML

---
- 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