Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
sftp
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Ansible
Roles
sftp
Commits
1cbf9fff
Commit
1cbf9fff
authored
5 years ago
by
jurgenhaas
Browse files
Options
Downloads
Patches
Plain Diff
ansible-playbooks/general#85 Linting
parent
f574a02b
No related branches found
No related tags found
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
defaults/main.yml
+2
-2
2 additions, 2 deletions
defaults/main.yml
tasks/groups.yml
+3
-3
3 additions, 3 deletions
tasks/groups.yml
tasks/main.yml
+29
-27
29 additions, 27 deletions
tasks/main.yml
tasks/mount.yml
+7
-7
7 additions, 7 deletions
tasks/mount.yml
with
41 additions
and
39 deletions
defaults/main.yml
+
2
−
2
View file @
1cbf9fff
sftp_basepath
:
'
/var/sftp
'
sftp_basepath
:
/var/sftp
sftp_groups
:
sftp
:
path
:
'
data
'
path
:
data
user
:
[]
sftp_user
:
[]
This diff is collapsed.
Click to expand it.
tasks/groups.yml
+
3
−
3
View file @
1cbf9fff
---
# file: roles/sftp/tasks/groups.yml
-
name
:
"
Add
Users
to
Group
"
-
name
:
Add Users to Group
user
:
name
:
'
{{
item
}}'
groups
:
'
{{
group
}}'
append
:
yes
with_items
:
'
{{
sftp_groups[group].user
}}'
-
name
:
"
Add
Users
to
SFTP
Group
"
-
name
:
Add Users to SFTP Group
user
:
name
:
'
{{
item
}}'
groups
:
'
sftp{{
group
}}
'
groups
:
sftp{{ group }}
append
:
yes
with_items
:
'
{{
sftp_groups[group].user
}}'
This diff is collapsed.
Click to expand it.
tasks/main.yml
+
29
−
27
View file @
1cbf9fff
---
# file: roles/sftp/tasks/main.yml
-
name
:
"
SFTP
Role"
set_fact
:
role_sftp_started=true
tags
:
'
always'
-
name
:
SFTP Role
set_fact
:
role_sftp_started
:
yes
tags
:
-
always
-
block
:
-
name
:
"
Ensure
Groups
"
-
name
:
Ensure Groups
group
:
name
:
'
{{
item
}}'
state
:
'
present
'
state
:
present
with_items
:
'
{{
sftp_groups
}}'
-
name
:
"
Ensure
SFTP
Groups
"
-
name
:
Ensure SFTP Groups
group
:
name
:
'
sftp{{
item
}}
'
state
:
'
present
'
name
:
sftp{{ item }}
state
:
present
with_items
:
'
{{
sftp_groups
}}'
-
name
:
"
Ensure
SFTP
Base-Directory
"
-
name
:
Ensure SFTP Base-Directory
file
:
dest
:
'
{{
sftp_basepath
}}'
owner
:
'
root
'
group
:
'
root
'
state
:
'
directory
'
mode
:
'
755
'
owner
:
root
group
:
root
state
:
directory
mode
:
755
-
name
:
"
Ensure
SFTP
Directories
"
-
name
:
Ensure SFTP Directories
file
:
dest
:
'
{{
sftp_basepath
}}/{{
sftp_groups[item].path
}}'
owner
:
'
root
'
owner
:
root
group
:
'
{{
item
}}'
state
:
'
directory
'
mode
:
'
770
'
state
:
directory
mode
:
770
with_items
:
'
{{
sftp_groups
}}'
when
:
'
sftp_groups[item].mountpath
is
not
defined
'
when
:
sftp_groups[item].mountpath is not defined
-
name
:
"
Create
Users
"
-
name
:
Create Users
user
:
name
:
'
{{
item.username
}}'
home
:
'
/home/{{
item.username
}}
'
shell
:
'
/bin/false
'
home
:
/home/{{ item.username }}
shell
:
/bin/false
with_items
:
'
{{
sftp_user
}}'
-
name
:
"
Install
Keys
"
-
name
:
Install Keys
authorized_key
:
user
:
'
{{
item.username
}}'
key
:
'
{{
item.key
}}'
with_items
:
'
{{
sftp_user
}}'
-
name
:
"
User-Group-Relations
"
include_tasks
:
'
groups.yml
'
-
name
:
User-Group-Relations
include_tasks
:
groups.yml
loop_control
:
loop_var
:
group
with_items
:
'
{{
sftp_groups
}}'
-
include_tasks
:
'
mount.yml
'
-
include_tasks
:
mount.yml
loop_control
:
loop_var
:
group
with_items
:
'
{{
sftp_groups
}}'
when
:
'
sftp_groups[group].mountpath
is
defined
'
when
:
sftp_groups[group].mountpath is defined
when
:
'
"sftp"
not
in
excluded_roles
'
when
:
not excluded_roles or
"sftp" not in excluded_roles
This diff is collapsed.
Click to expand it.
tasks/mount.yml
+
7
−
7
View file @
1cbf9fff
---
# file: roles/sftp/tasks/mount.yml
-
name
:
"
Ensure
Mount
Path
"
-
name
:
Ensure Mount Path
file
:
dest
:
'
{{
sftp_groups[group].mountpath
}}'
owner
:
'
{{
item
}}'
group
:
'
{{
group
}}'
state
:
'
directory
'
mode
:
'
775
'
state
:
directory
mode
:
775
with_items
:
'
{{
sftp_groups[group].user
}}'
-
name
:
"
Create
Mount
Point
"
-
name
:
Create Mount Point
mount
:
fstype
:
'
none
'
opts
:
'
bind
'
fstype
:
none
opts
:
bind
name
:
'
{{
sftp_basepath
}}/{{
sftp_groups[group].path
}}'
src
:
'
{{
sftp_groups[group].mountpath
}}'
state
:
'
mounted
'
state
:
mounted
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment