|
335 | 335 |
|
336 | 336 | - name: Block to test umask option
|
337 | 337 | block:
|
338 |
| - - name: Create empty file |
339 |
| - community.general.filesize: |
340 |
| - path: /tmp/myfs.img |
341 |
| - size: 1M |
342 |
| - - name: Format FS |
343 |
| - community.general.filesystem: |
344 |
| - fstype: ext3 |
345 |
| - dev: /tmp/myfs.img |
346 |
| - when: ansible_system == 'Linux' |
347 |
| - - name: Format FS |
348 |
| - community.general.filesystem: |
349 |
| - fstype: nullfs |
350 |
| - dev: /tmp/myfs.img |
351 |
| - when: ansible_system == 'FreeBSD' |
352 | 338 | - name: Make sure that mount point does not exist
|
353 | 339 | file:
|
354 |
| - path: /tmp/myfs_mountpoint |
| 340 | + path: /tmp/mount_dest |
355 | 341 | state: absent
|
356 |
| - |
357 |
| - - name: Mount the FS to non existent directory with raw umask |
| 342 | + - name: Create a directory to bind mount |
| 343 | + file: |
| 344 | + state: directory |
| 345 | + path: /tmp/mount_source |
| 346 | + - name: Bind mount a filesystem with umask |
358 | 347 | mount:
|
359 |
| - path: /tmp/myfs_mountpoint |
360 |
| - src: /tmp/myfs.img |
361 |
| - fstype: ext3 |
| 348 | + src: /tmp/mount_source |
| 349 | + path: /tmp/mount_dest |
362 | 350 | state: mounted
|
| 351 | + fstype: None |
| 352 | + opts: bind |
363 | 353 | umask: 0777
|
364 |
| - when: ansible_system == 'Linux' |
365 |
| - - name: Mount the FS to non existent directory with raw umask(FreeBSD) |
| 354 | + when: ansible_system != 'FreeBSD' |
| 355 | + - name: Bind mount a filesystem with umask(FreeBSD) |
366 | 356 | mount:
|
367 |
| - path: /tmp/myfs_mountpoint |
368 |
| - src: /tmp/myfs.img |
369 |
| - fstype: nullfs |
| 357 | + src: /tmp/mount_source |
| 358 | + path: /tmp/mount_dest |
370 | 359 | state: mounted
|
| 360 | + fstype: nullfs |
371 | 361 | umask: 0777
|
372 | 362 | when: ansible_system == 'FreeBSD'
|
373 |
| - - name: Check status of parent directory of mount point |
374 |
| - stat: |
375 |
| - path: /tmp/foobar |
376 |
| - register: parent_dir_stat |
377 |
| - - name: Assert that the parent directory of the mount point has right permission |
378 |
| - assert: |
379 |
| - that: |
380 |
| - - parent_dir_stat['stat']['mode'] == '0000' |
381 | 363 | - name: Unmount FS to access underlying directory
|
382 | 364 | command: |
|
383 |
| - umount /tmp/myfs.img |
384 |
| - - name: Check status of mount point |
| 365 | + umount /tmp/mount_dest |
| 366 | + - name: Stat mount point directory |
385 | 367 | stat:
|
386 |
| - path: /tmp/myfs_mountpoint |
| 368 | + path: /tmp/mount_dest |
387 | 369 | register: mount_point_stat
|
388 | 370 | - name: Assert that the mount point has right permission
|
389 | 371 | assert:
|
390 | 372 | that:
|
391 | 373 | - mount_point_stat['stat']['mode'] == '0000'
|
392 | 374 | - name: Cleanup directory
|
393 | 375 | file:
|
394 |
| - path: /tmp/myfs_mountpoint |
| 376 | + path: /tmp/mount_dest |
395 | 377 | state: absent
|
396 |
| - |
397 |
| - - name: Mount the FS to non existent directory with string umask |
| 378 | + - name: Bind mount a filesystem with string umask |
398 | 379 | mount:
|
399 |
| - path: /tmp/myfs_mountpoint |
400 |
| - src: /tmp/myfs.img |
401 |
| - fstype: ext3 |
| 380 | + src: /tmp/mount_source |
| 381 | + path: /tmp/mount_dest |
402 | 382 | state: mounted
|
| 383 | + fstype: None |
| 384 | + opts: bind |
403 | 385 | umask: "0777"
|
404 |
| - when: ansible_system == 'Linux' |
405 |
| - - name: Mount the FS to non existent directory with string umask(FreeBSD) |
| 386 | + when: ansible_system != 'FreeBSD' |
| 387 | + - name: Bind mount a filesystem with string umask(FreeBSD) |
406 | 388 | mount:
|
407 |
| - path: /tmp/myfs_mountpoint |
408 |
| - src: /tmp/myfs.img |
409 |
| - fstype: nullfs |
| 389 | + src: /tmp/mount_source |
| 390 | + path: /tmp/mount_dest |
410 | 391 | state: mounted
|
| 392 | + fstype: nullfs |
411 | 393 | umask: "0777"
|
412 | 394 | when: ansible_system == 'FreeBSD'
|
413 |
| - - name: Check status of parent directory of mount point |
414 |
| - stat: |
415 |
| - path: /tmp/foobar |
416 |
| - register: parent_dir_stat |
417 |
| - - name: Assert that the parent directory of the mount point has right permission |
418 |
| - assert: |
419 |
| - that: |
420 |
| - - parent_dir_stat['stat']['mode'] == '0000' |
421 | 395 | - name: Unmount FS to access underlying directory
|
422 | 396 | command: |
|
423 |
| - umount /tmp/myfs.img |
424 |
| - - name: Check status of mount point |
| 397 | + umount /tmp/mount_dest |
| 398 | + - name: Stat mount point directory |
425 | 399 | stat:
|
426 |
| - path: /tmp/myfs_mountpoint |
| 400 | + path: /tmp/mount_dest |
427 | 401 | register: mount_point_stat
|
428 | 402 | - name: Assert that the mount point has right permission
|
429 | 403 | assert:
|
430 | 404 | that:
|
431 | 405 | - mount_point_stat['stat']['mode'] == '0000'
|
432 |
| - - name: Cleanup directory |
433 |
| - file: |
434 |
| - path: /tmp/myfs_mountpoint |
435 |
| - state: absent |
436 |
| - |
437 |
| - - name: Remount the FS to non existent directory with symbolic umask expression |
438 |
| - mount: |
439 |
| - path: /tmp/myfs_mountpoint |
440 |
| - src: /tmp/myfs.img |
441 |
| - fstype: ext3 |
442 |
| - state: mounted |
443 |
| - umask: "u+rw,g-wx,o-rwx" |
444 |
| - when: ansible_system == 'Linux' |
445 |
| - - name: Remount the FS to non existent directory with symbolic umask expression(FreeBSD) |
446 |
| - mount: |
447 |
| - path: /tmp/myfs_mountpoint |
448 |
| - src: /tmp/myfs.img |
449 |
| - fstype: nullfs |
450 |
| - state: mounted |
451 |
| - umask: "u+rw,g-wx,o-rwx" |
452 |
| - when: ansible_system == 'FreeBSD' |
453 |
| - - name: Check status of parent directory of mount point |
454 |
| - stat: |
455 |
| - path: /tmp/foobar |
456 |
| - register: parent_dir_stat |
457 |
| - - name: Assert that the parent directory of the mount point has right permission |
458 |
| - assert: |
459 |
| - that: |
460 |
| - - parent_dir_stat['stat']['mode'] == '0640' |
461 |
| - - name: Unmount FS to access underlying directory |
462 |
| - command: | |
463 |
| - umount /tmp/myfs.img |
464 |
| - - name: Check status of mount point |
465 |
| - stat: |
466 |
| - path: /tmp/myfs_mountpoint |
467 |
| - register: mount_point_stat |
468 |
| - - name: Assert that the mount point has right permission |
469 |
| - assert: |
470 |
| - that: |
471 |
| - - mount_point_stat['stat']['mode'] == '0640' |
472 |
| - - name: Cleanup directory |
473 |
| - file: |
474 |
| - path: /tmp/myfs_mountpoint |
475 |
| - state: absent |
476 |
| - |
477 |
| - - name: Remount the FS to non existent directory with symbolic umask expression |
478 |
| - mount: |
479 |
| - path: /tmp/myfs_mountpoint |
480 |
| - src: /tmp/myfs.img |
481 |
| - fstype: ext3 |
482 |
| - state: mounted |
483 |
| - umask: "u=rw,g=r,o=r" |
484 |
| - when: ansible_system == 'Linux' |
485 |
| - - name: Remount the FS to non existent directory with symbolic umask expression(FreeBSD) |
486 |
| - mount: |
487 |
| - path: /tmp/myfs_mountpoint |
488 |
| - src: /tmp/myfs.img |
489 |
| - fstype: nullfs |
490 |
| - state: mounted |
491 |
| - umask: "u=rw,g=r,o=r" |
492 |
| - when: ansible_system == 'FreeBSD' |
493 |
| - - name: Check status of parent directory of mount point |
494 |
| - stat: |
495 |
| - path: /tmp/foobar |
496 |
| - register: parent_dir_stat |
497 |
| - - name: Assert that the parent directory of the mount point has right permission |
498 |
| - assert: |
499 |
| - that: |
500 |
| - - parent_dir_stat['stat']['mode'] == '0644' |
501 |
| - - name: Unmount FS to access underlying directory |
502 |
| - command: | |
503 |
| - umount /tmp/myfs.img |
504 |
| - - name: Check status of mount point |
505 |
| - stat: |
506 |
| - path: /tmp/myfs_mountpoint |
507 |
| - register: mount_point_stat |
508 |
| - - name: Assert that the mount point has right permission |
509 |
| - assert: |
510 |
| - that: |
511 |
| - - mount_point_stat['stat']['mode'] == '0644' |
512 | 406 | - name: Remove the test FS
|
513 | 407 | file:
|
514 |
| - path: '{{ item }}' |
| 408 | + path: /tmp/mount_dest |
515 | 409 | state: absent
|
516 |
| - loop: |
517 |
| - - /tmp/myfs.img |
518 |
| - - /tmp/myfs_mountpoint |
| 410 | + when: ansible_system not in ('MacOS') |
0 commit comments