Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
ansible
Overview
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
OpenEdx
ansible
Commits
59305751
Commit
59305751
authored
Jul 21, 2014
by
James Cammarata
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #8223 from renard/create-fstab-if-not-exists
Create fstab if not exists
parents
8e940004
48128ec0
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
15 additions
and
1 deletions
+15
-1
library/system/mount
+15
-1
No files found.
library/system/mount
100644 → 100755
View file @
59305751
...
...
@@ -69,7 +69,14 @@ options:
required: true
choices: [ "present", "absent", "mounted", "unmounted" ]
default: null
fstab:
description:
- file to use instead of C(/etc/fstab). You shouldn't use that option
unless you really know what you are doing. This might be useful if
you need to configure mountpoints in a chroot environment.
required: false
default: /etc/fstab
notes: []
requirements: []
author: Seth Vidal
...
...
@@ -260,6 +267,13 @@ def main():
if
module
.
params
[
'fstab'
]
is
not
None
:
args
[
'fstab'
]
=
module
.
params
[
'fstab'
]
# if fstab file does not exist, we first need to create it. This mainly
# happens when fstab optin is passed to the module.
if
not
os
.
path
.
exists
(
args
[
'fstab'
]):
if
not
os
.
path
.
exists
(
os
.
path
.
dirname
(
args
[
'fstab'
])):
os
.
makedirs
(
os
.
path
.
dirname
(
args
[
'fstab'
]))
open
(
args
[
'fstab'
],
'a'
)
.
close
()
# absent == remove from fstab and unmounted
# unmounted == do not change fstab state, but unmount
# present == add to fstab, do not change mount state
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment