Skip to content
Snippets Groups Projects
Commit e6bd68fb authored by jurgenhaas's avatar jurgenhaas
Browse files

ansible-playbooks/general#85 Linting

parent b7c970c6
Branches
No related tags found
No related merge requests found
......@@ -5,23 +5,23 @@
---
# file: cleanup.yml
- name: "Grab the user list"
- name: Grab the user list
shell: cat /etc/passwd
register: passwd
- name: "Unlock legitimate user accounts"
- name: Unlock legitimate user accounts
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"
- name: Lock deprecated user accounts
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"
- name: Disable ssh keys for deprecated user accounts
command: rm {{item.split(':').5}}/.ssh/authorized_keys
when: item.split(':').0 not in users
and item.split(':').2|int > 499
......
......@@ -5,7 +5,7 @@
---
# file: main.yml
- name: "Check requirements: is the user hash defined"
- name: Check requirements: is the user hash defined
local_action: shell echo "There are no users defined"
when: not users
changed_when: false
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment