Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
U
user-management
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
user-management
Commits
8fe4cd93
Commit
8fe4cd93
authored
11 years ago
by
Jürgen Haas
Browse files
Options
Downloads
Patches
Plain Diff
Remove the dependency on perl
parent
9d229d0c
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
files/etc_ansible_facts_d_users_sh
+0
-5
0 additions, 5 deletions
files/etc_ansible_facts_d_users_sh
tasks/cleanup.yml
+18
-25
18 additions, 25 deletions
tasks/cleanup.yml
with
18 additions
and
30 deletions
files/etc_ansible_facts_d_users_sh
deleted
100644 → 0
+
0
−
5
View file @
9d229d0c
#!/bin/bash
echo
"["
>
/etc/ansible/facts.d/users.fact
cat
/etc/passwd | perl
-aF
:
-ne
'print "{\"name\": \"",$F[0],"\",\"home\": \"",$F[5],"\"},\n" if $F[2] > 499'
>>
/etc/ansible/facts.d/users.fact
echo
"0]"
>>
/etc/ansible/facts.d/users.fact
This diff is collapsed.
Click to expand it.
tasks/cleanup.yml
+
18
−
25
View file @
8fe4cd93
...
...
@@ -5,31 +5,24 @@
---
# file: cleanup.yml
-
name
:
"
Make
sure,
the
directory
exists"
file
:
dest='/etc/ansible/facts.d'
state=directory
owner=root
group=root
mode=775
-
name
:
"
Copy
the
extract
script"
copy
:
src='etc_ansible_facts_d_users_sh'
dest='/etc/ansible/facts.d/users.sh'
owner=root
group=root
mode=755
-
name
:
"
Extract
user
list"
shell
:
/etc/ansible/facts.d/users.sh
-
name
:
"
Gather
facts"
setup
:
-
name
:
"
Grab
the
user
list"
shell
:
cat /etc/passwd
register
:
passwd
-
name
:
"
Unlock
legitimate
user
accounts"
command
:
usermod --unlock {{item.name}}
with_items
:
ansible_local.users
when
:
item.name is defined and item.name in users
command
:
usermod --unlock {{item.split(':').0}}
when
:
item.split(':').0 in users
and item.split(':').2|int >
499
with_items
:
passwd.stdout_lines
-
name
:
"
Lock
deprecated
user
accounts"
command
:
usermod --lock {{item.name}}
with_items
:
ansible_local.users
when
:
item.name is defined and item.name not in users
command
:
usermod --lock {{item.split(':').0}}
when
:
item.split(':').0 not in users
and item.split(':').2|int >
499
with_items
:
passwd.stdout_lines
-
name
:
"
Disable
ssh
keys
for
deprecated
user
accounts"
command
:
rm {{item.home}}/.ssh/authorized_keys
with_items
:
ansible_local.users
when
:
item.name is defined and item.name not in users
command
:
rm {{item.split(':').5}}/.ssh/authorized_keys
when
:
item.split(':').0 not in users
and item.split(':').2|int >
499
with_items
:
passwd.stdout_lines
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