Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create missing mountpoint without permissions? #178

Open
c0xc opened this issue Apr 20, 2021 · 1 comment
Open

Create missing mountpoint without permissions? #178

c0xc opened this issue Apr 20, 2021 · 1 comment
Labels
feature This issue/PR relates to a feature request. needs_verified Needs to reproduced before processing waiting_on_contributor Needs help. Feel free to engage to get things unblocked

Comments

@c0xc
Copy link

c0xc commented Apr 20, 2021

SUMMARY

In some environments, it's common practice to create mountpoints without read/write permissions to prevent admins and services from using them as local directories, filling up the local disk. With Ansible's mount module, a missing mountpoint is created with the default umask instead, so it may be mistaken for a mounted share if the mount failed. Is it possible to have missing mountpoints created without permissions?

ISSUE TYPE
  • Feature Idea
COMPONENT NAME

mount

ADDITIONAL INFORMATION

Manual approach:

mkdir /mnt/xyz && chmod 0 /mnt/xyz
mount /mnt/xyz

Ansible workaround:

- name: Check for /mnt/xyz
  stat:
    path: /mnt/xyz
  register: st_mount_xyz
  ignore_errors: "yes"

- name: Create /mnt/xyz
  file:
    path: /mnt/xyz
    state: directory
    owner: root
    group: root
    mode: 0000
  when:
    - st_mount_xyz.stat is defined
    - st_mount_xyz.stat.exists == false

- name: Mount /mnt/xyz
  mount:
    src: "filer:/data/xyz"
    path: /mnt/xyz
    state: mounted
    fstype: nfs

@quidame
Copy link
Contributor

quidame commented May 16, 2021

@c0xc, thanks for reporting this. For me, it's also related to #163 since these two issues refer to permissions/ownership of directories created by the module in a one-shot way, with no user control over what is done. Especially in this case, once the filesystem is mounted, the underlying directory (same path than the mountpoint, and hidden by the mount) is nearly inaccessible, or at least non trivial to modify. Implementing control/changes over this directory mode at playbook-level or role-level is no less than tricky, so it seems fair to implement it in the module.

@Akasurde Akasurde added feature This issue/PR relates to a feature request. needs_verified Needs to reproduced before processing waiting_on_contributor Needs help. Feel free to engage to get things unblocked labels Jun 3, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature This issue/PR relates to a feature request. needs_verified Needs to reproduced before processing waiting_on_contributor Needs help. Feel free to engage to get things unblocked
Projects
None yet
Development

No branches or pull requests

3 participants