Skip to content

Instantly share code, notes, and snippets.

@jpsecher
Last active June 9, 2018 20:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save jpsecher/87bda704f147bec7e913316cb969ebd5 to your computer and use it in GitHub Desktop.
Save jpsecher/87bda704f147bec7e913316cb969ebd5 to your computer and use it in GitHub Desktop.
Ansible gluster_volume fails during probe peer

I am hitting the same problem with (which used to work)

- name: Create Gluster volume
  gluster_volume:
    name: "{{ volume_name }}"
    state: present
    host: "{{ inventory_hostname }}"
    bricks: "{{ brick_dir }}/{{ brick_name }}"
    cluster: "{% for host in workers %}{{ host }},{% endfor %}{{ inventory_hostname }}"
    replicas: "{{ workers|length + 1 }}"
    force: true

The above does not work because Gluster fails to probe inventory_hostname (the master), as can be witnessed by running the probe manually on the remote machine:

$ ssh glustermaster.example.com
$ sudo gluster peer probe $(hostname)
peer probe: failed: glustermaster.example.com is either already part of another cluster or having volumes configured  

Using localhost instead of inventory_hostname

- name: Create Gluster volume
  gluster_volume:
    name: "{{ volume_name }}"
    state: present
    host: "{{ inventory_hostname }}"
    bricks: "{{ brick_dir }}/{{ brick_name }}"
    cluster: "{% for host in workers %}{{ host }},{% endfor %}localhost"
    replicas: "{{ workers|length + 1 }}"
    force: true

makes the probe succeed, but fails during the next volume create step:

Please provide a valid hostname/ip other than localhost, 127.0.0.1 or loopback address (0.0.0.0 to 0.255.255.255)

Omitting the master altogether

- name: Create Gluster volume
  gluster_volume:
    name: "{{ volume_name }}"
    state: present
    host: "{{ inventory_hostname }}"
    bricks: "{{ brick_dir }}/{{ brick_name }}"
    cluster: "{% for host in workers %}{{ host }},{% endfor %}"
    replicas: "{{ workers|length + 1 }}"
    force: true

fails because the replica count then does not match the cluster list length:

number of bricks is not a multiple of replica count
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment