bushvin / ansible-module-xfs_quota

This ansible module allow one to set xfs user, group and project quotas
GNU General Public License v3.0
8 stars 2 forks source link

Project quotas are not set after running this module #4

Open ljmc-github opened 4 years ago

ljmc-github commented 4 years ago

Hi,

I just used this module to set up project quotas on XFS directories as per the task I join, but then when connecting to the target machine, the projects do not seem to be set.

I dd'ed a 1GB file in there and chowned it to the expected owner but it is not accounted for the project in xfs_quota report.

/etc/projects and /etc/projid are set correctly.

From the correct path, xfs_quota> project -c home_bvance gives:

Checking project home_bvance (path /stor/home/bvance)...
/stor/home/bvance - project identifier is not set (inode=0, tree=12)
/stor/home/bvance - project inheritance flag is not set
Processed 1 (/etc/projects and cmdline) paths for project home_bvance with recursion depth infinite (-1).

So, I force set the project with xfs_quota> project -s home_bvance which gives:

Setting up project home_bvance (path /stor/home/bvance)...
Processed 1 (/etc/projects and cmdline) paths for project home_bvance with recursion depth infinite (-1).

Then, xfs_quota> project -c home_bvance gives:

Checking project home_bvance (path /stor/home/bvance)...
Processed 1 (/etc/projects and cmdline) paths for project home_bvance with recursion depth infinite (-1).

And the 1GB file is reported correctly in the report.

Thanks for the module, I hope there is a solution for this.

Task:

    - name: Set default soft and hard limits for homedirs
      xfs_quota:
        type: project
        name: "home_{{ item.name }}"
        mountpoint: "/stor"
        bsoft: 40G
        bhard: 50G
        state: present
      loop: "{{ users }}"
      register: pquota_out

Output results:

{
  "ansible_loop_var": "item",
  "bhard": 53687091200,
  "bsoft": 42949672960,
  "changed": true,
  "failed": false,
  "invocation": {
    "module_args": {
      "bhard": "50G",
      "bsoft": "40G",
      "ihard": null,
      "isoft": null,
      "mountpoint": "/stor",
      "name": "home_bvance",
      "rtbhard": null,
      "rtbsoft": null,
      "state": "present",
      "type": "project"
    }
  },
  "item": {
    "email": "bob@vance-refrigeration.com",
    "fn": "Bob",
    "ln": "Vance",
    "name": "bvance"
  },
  "xfs_quota": {
    "bhard": null,
    "bsoft": null,
    "ihard": null,
    "isoft": null,
    "rtbhard": null,
    "rtbsoft": null
  }
}

EDIT: correct a typo

bushvin commented 4 years ago

I will try to find some time to troubleshoot this.

bushvin commented 4 years ago

I didn't realise where this issue was made. I actually got the module into the ansible project as one of the modules since v2.8 I did some additional refactoring and bugfixes to get it in, so could you check if you experience the same issue with the same module in Ansible 2.8 ? Thanks

ljmc-github commented 4 years ago

My bad, I didn't know where to log the issue so I created it in the module. Do you want me to move it ?

Also, I am using ansible 2.9.11 provided in RHEL 8. Anything you need me to test in this setup ?

bushvin commented 4 years ago

That's fine. I just wanted to make sure you were using the one included with Ansible. Maybe in the future, open an issue on the ansible project, but I'll trace the issue here...

Will try to free up some time this week to test/troubleshoot this. I think I have everything, but if you could provide me with the relevant bits from '/etc/projid' and '/etc/projects' that would be awesome!

ljmc-github commented 4 years ago

/etc/projects

# user homedirs 10:99 in /stor/home
10:/stor/home/bvance

/etc/projid

# user homedirs 10:99 as home_user:number
home_bvance:10
ljmc-github commented 4 years ago

Just a quick ping to check if there is any solution to this, especially since 2.10 came out recently. :)

bushvin commented 4 years ago

Apologies, life happened. I'll make sure to make modifications for both 2.9 and 2.10

ljmc-github commented 4 years ago

No worries, I was just checking. It's fairly easy to just issue the xfs_quota set command.

bushvin commented 4 years ago

yes, I pinpointed it down to a change in output on xfs_quota's part...

Before doeing anything, I perform the following:

xfs_quota> project <project name> And back in the days when I wrote this, the result for a non-initialized project directory was Project Id '<project name>' - is not set. Now it seems to have changed to project identifier is not set

In a way, this is good, as looking for it becomes easier... I'll post an update here shortly

bushvin commented 4 years ago

@BiochemLouis I've updated this repo for testing purposes. When you have time, could you test? If it works as well on your end, I will do the necessary to update the relevant ansible repo's

ljmc-github commented 4 years ago

Servers are down for the afternoon and maybe tomorrow, I'll spin up a VM as soon as possible.

ljmc-github commented 4 years ago

Works perfectly, tested with the following playbook in a Centos 8 server VM.

---

- hosts: localhost
  become: true

  tasks:
    - name: test quotas
      xfs_quota:
        type: project
        name: "home_{{item}}"
        mountpoint: /mnt/quotadisk
        bsoft: 1G
        bhard: 1.5G
        isoft: 100
        ihard: 150
        state: present
      loop:
        - alice
        - bob
bushvin commented 4 years ago

Awesome! I'll get started on updating the ansible repo's.

Sep 30, 2020 10:27:57 Louis Cochen notifications@github.com:

Works perfectly, tested with the following playbook in a Centos 8 server VM.

--- - hosts: localhost become: true tasks: - name: test quotas xfsquota: type: project name: "home{{item}}" mountpoint: /mnt/quotadisk bsoft: 1G bhard: 1.5G isoft: 100 ihard: 150 state: present loop: - alice - bob— You are receiving this because you commented. Reply to this email directly, view it on GitHub[https://github.com/bushvin/ansible-module-xfs_quota/issues/4#issuecomment-701243948], or unsubscribe[https://github.com/notifications/unsubscribe-auth/ABEQMYCK4HCECXYT7YFOLQTSILTYLANCNFSM4PE3BPCQ]. [https://github.com/notifications/beacon/ABEQMYHGHJ6OSZO74JTC3IDSILTYLA5CNFSM4PE3BPC2YY3PNVWWK3TUL52HS4DFVREXG43VMVBW63LNMVXHJKTDN5WW2ZLOORPWSZGOFHGCELA.gif]