Hi Brian,
Thanks for your response. I am working on building my student dictionary
entries from a csv file produced by the college admissions/administration,
and one of the values I create will be a future-dated expiration in epoch.
I understand the user module will set the expiration on the system for the
user account based on the value of the epoch in "user: expires=epoch".
I will write a playbook comparing the current date with the expiry date in
my dictionary to decide whether to remove accounts (fast, limited
processing for remote host). Or, I could use the shell command to look up
each user individually on the remote host (slower, but verifying live data
instead of dictionary data). Actually, I should combine the two: I'll
process the list to decide which accounts to target, and then look up the
targeted user account(s) on the remote host to verify the expiration hasn't
been changed manually.
I was hoping that a boolean for expired might be built in to the user
module, since the OS knows whether an account is expired. If it's not built
in before I get to it, I'll contribute to it. It could take me a long time
to get to it, though.
Thanks!
Joanna
On Tuesday, September 22, 2015 at 7:08:52 PM UTC-5, Brian Coca wrote:
>
> it mostly depends on how you have the data, supposing students is a
> list with each student being a dictionary with it's properties:
>
> is expired a key of each student? if it is a boolean, as you have it
> it should look like this:
>
> user: name=item.name ...
> when: item.expired
> with_items: students
>
> if you need an expression you need to give us the criteria which you
> follow to determine if a user is expired. For example:
>
> user: name=item.name ...
> when: item.graduates > lookup('pipe', 'date +%s')
> with_items: students
>
> # assumes you keep the epoch of when he graduates
>
> So it just needs to be an expression that evaluates to true or false,
> the exact expression depends on the structure of your data.
>
>
> --
> Brian Coca
>
--
You received this message because you are subscribed to the Google Groups
"Ansible Project" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/ansible-project/4a90b027-35ad-4570-9d0c-60d66cf1f2eb%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.