Install and Configure Gluster File System

Hi Guys,

I’m not sure why the below yaml gives me an error ?

  • name: Install Gluster and create file system on Cluster
    hosts: localhost
    connection: local
    tasks:
  • name: create gluster volume
    gluster_volume:
    state: present
    name: gluster_vol1
    bricks: /bricks/brick1/g1
    rebalance: yes
    cluster:
  • 192.168.1.9
  • 192.168.1.7
    run_once: true

Error message below:

TASK [create gluster volume] ****************************************************************************************
An exception occurred during task execution. To see the full traceback, use -vvv. The error was: None
fatal: [localhost]: FAILED! => {“changed”: false, “msg”: “error running gluster (/usr/sbin/gluster --mode=script peer status) command (rc=255): ERROR: failed to create logfile "/var/log/glusterfs/cli.log" (Permission denied)\nERROR: failed to open logfile /var/log/glusterfs/cli.log\n”}

Any assistance would be appreciated.

Thanks and Regards,
Ameya Agashe

The playbook is running at the user you started ansible-playbook with.
This user have no permission in /var/log/glusterfs.

You probably need to run this as root/sudo, and that's called become in Ansible
Good staring point is here
https://docs.ansible.com/ansible/latest/user_guide/become.html