---
# Script to deactivate a system user on the servers
#
# To run the script:
# ansible-playbook -K deactivate_user.yml -i hosts-xxx -e 'target=targethost login=username'
# ansible-playbook -K deactivate_user.yml -i hosts-xxx -e 'target=targethost login=username' --limit=*.mydomain.com
#

- name: Create user on target system(s)
  hosts: '{{target}}'
  become: yes
  become_user: root
  tasks:
  - name: Deactivate system user
    command: "chage -E0 {{login}}"
    register: command_output

  - debug:
      var: command_output.stdout_lines
