Skip to content

Instantly share code, notes, and snippets.

@andy722
Created April 22, 2020 16:05
Show Gist options
  • Save andy722/3e29906e10300b1660906fd870170f00 to your computer and use it in GitHub Desktop.
Save andy722/3e29906e10300b1660906fd870170f00 to your computer and use it in GitHub Desktop.
ansible / delete user
ansible swarm_dtln -b -m user -a "name=USERNAME state=absent remove=yes force=true"
ansible swarm_dtln -b -m replace -a 'backup=yes dest=/etc/ssh/sshd_config regexp=^(AllowUsers.*)\\b(USERNAME)\\b(.*)$ replace=\\1\\3'
ansible swarm_dtln -b -m replace -a 'backup=yes dest=/etc/ssh/sshd_config regexp=^(Match.*)\\b(USERNAME\,)\\b(.*)$ replace=\\1\\3'
ansible swarm_dtln -b -m service -a "name=sshd state=restarted"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment