Giter Club home page Giter Club logo

ansible-role-chage's Introduction

Ansible Module: chage

Build Status

Query & manage the shadow password file on Linux.

Ansible Galaxy Page: https://galaxy.ansible.com/lqueryvg/chage/

Please star this repo if you think it's useful.

With the right encouragement I will try to get it added as a standard Ansible module.

Features

  • provides an interface to the chage command
  • returns a user's shadow file settings as a dictionary
  • python module packaged in a role

Examples

  # force password change on next login
  - chage: user=john sp_lstchg=0

  # or using argument alias:
  - chage: user=john lastday=0

  # remove an account expiration date.
  - chage: user=john sp_expire=-1

  # set inactivity days after password expired before account is locked
  - chage: user=john sp_inact=14

  # set both min and max days in single task
  - chage: user=john sp_min=7 sp_max=28

  # retrieve then access user's password expiry days
  - chage: user=john
    register: result

  - debug: msg={{result.shadow.sp_expire}}

Options

Most of the option names follow the fields documented in /usr/include/shadow.h and pydoc spwd.

See also man chage.

argument alias required default comments
user yes user name
sp_lstchg lastday no None chage -d, --lastday
days since 1970/01/01 when password was last changed or date in format YYYY-MM-DD
sp_min mindays no None chage -m, --mindays
minimum number of days between changes
sp_max maxdays no None chage -M, --maxdays
maximum number of days between changes or remove with -1
sp_warn warndays no None chage -W, --warndays
number of days before password expiry to warn user to change password
sp_inact inactive no None chage -I, --inactive
set number of days the account may be inactive remove the field by passing value of -1
sp_expire expiredate no None chage -E, --expiredate
days since 1970-01-01 until account expires or date in format YYYY-MM-DD$

Note: argument aliases (e.g. lastday) are to assist those who are already familiar with the chage command flags, however I would recommend using the actual argument names (e.g. sp_lstchg) instead for the following reasons:

  1. The data structure fields names returned by chage will match the real argument names, even if you used alias names in the playbook task.
  2. Libraries (e.g. Python spwd module) are more likely to use the real argument names which in turn match the /usr/include/shadow.h and the C library which uses it. Although this Ansible module is called chage, it's real intention is to provide an interface to the /etc/shadow file.

Requirements

  • chage command
  • /etc/shadow file (read pwconv man page if /etc/shadow does not exist)
  • root access (to read /etc/shadow file)

Role Variables

None

Dependencies

None

License

GPLv3

Author Information

John Buxton

ansible-role-chage's People

Contributors

lqueryvg avatar deacomm avatar jamescassell avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.