Synopsis:
You need to create user accounts from user names listed in pillar, set a default password, and then force that password to be changed next time they log in.
This is how I've been doing it:
pillar/users.sls:
sys-users:
- joe
- mike
- sally
salt/users/init.sls
{% for users in pillar['sys-users'] %}
{{users}}:
user.present:
- shell: /bin/bash
- home: /home/{{users}}
- password: $1$wrYj9xuAmZyAzt7YPqhVk.
- require_in: chage -d 0 {{users}}
{% endfor %}
{% for users in pillar['sys-users'] %}
chage -d 0 {{users}}:
cmd:
- run
{% endfor %}
I also realize I could have used the shadow module.
Am I making it harder than it is? Is there a better way that I am missing?
Would it make sense to have an option in the user state to expire the password to force this change?