users-formula/docs
semantic-release-bot 0f7cd67261 chore(release): 0.48.7 [skip ci]
## [0.48.7](https://github.com/saltstack-formulas/users-formula/compare/v0.48.6...v0.48.7) (2022-02-13)

### Code Refactoring

* **salt-lint:** fix violation ([696139a](696139a841))

### Continuous Integration

* update linters to latest versions [skip ci] ([a4fb2c6](a4fb2c6380))
* **3003.1:** update inc. AlmaLinux, Rocky & `rst-lint` [skip ci] ([ec9506d](ec9506da14))
* **commitlint:** ensure `upstream/master` uses main repo URL [skip ci] ([2f0db66](2f0db666e4))
* **gemfile:** allow rubygems proxy to be provided as an env var [skip ci] ([47cfe0e](47cfe0ecd7))
* **gemfile+lock:** use `ssf` customised `inspec` repo [skip ci] ([6ad3c6a](6ad3c6a148))
* **gemfile+lock:** use `ssf` customised `kitchen-docker` repo [skip ci] ([8698fa5](8698fa535f))
* **gitlab-ci:** add `rubocop` linter (with `allow_failure`) [skip ci] ([9b8b6e6](9b8b6e6a82))
* **gitlab-ci:** use GitLab CI as Travis CI replacement ([3c879df](3c879df953))
* **kitchen:** move `provisioner` block & update `run_command` [skip ci] ([72c64ad](72c64adbea))
* **kitchen+ci:** update with `3004` pre-salted images/boxes [skip ci] ([4a8452a](4a8452a266))
* **kitchen+ci:** update with latest `3003.2` pre-salted images [skip ci] ([6de2acb](6de2acbe93))
* **kitchen+ci:** update with latest CVE pre-salted images [skip ci] ([22c21e4](22c21e490e))
* **kitchen+ci:** use latest pre-salted images (after CVE) [skip ci] ([dabc4b7](dabc4b742a))
* **kitchen+gitlab:** adjust matrix to add `3003` [skip ci] ([34c757a](34c757a9bb))
* **kitchen+gitlab:** remove Ubuntu 16.04 & Fedora 32 (EOL) [skip ci] ([3935693](3935693b58))
* **kitchen+gitlab:** update for new pre-salted images [skip ci] ([0bff9fb](0bff9fba4c))
* add `arch-master` to matrix and update `.travis.yml` [skip ci] ([632dc3c](632dc3cc4b))
* add Debian 11 Bullseye & update `yamllint` configuration [skip ci] ([0c49302](0c493020ee))
* **kitchen+gitlab-ci:** use latest pre-salted images [skip ci] ([c260fe7](c260fe7126))
* **pre-commit:** add to formula [skip ci] ([d0e7c0a](d0e7c0a19e))
* **pre-commit:** enable/disable `rstcheck` as relevant [skip ci] ([013b2cd](013b2cd3b8))
* **pre-commit:** finalise `rstcheck` configuration [skip ci] ([89c3c8f](89c3c8f806))
* **pre-commit:** update hook for `rubocop` [skip ci] ([0e7c6a3](0e7c6a3896))

### Documentation

* **readme:** fix headings [skip ci] ([7d06cd5](7d06cd56dd))

### Tests

* standardise use of `share` suite & `_mapdata` state [skip ci] ([2a7c0de](2a7c0de4aa))
2022-02-13 00:00:53 +00:00
..
AUTHORS.rst chore(release): 0.48.7 [skip ci] 2022-02-13 00:00:53 +00:00
CHANGELOG.rst chore(release): 0.48.7 [skip ci] 2022-02-13 00:00:53 +00:00
README.rst docs(readme): fix headings [skip ci] 2021-05-05 15:37:43 +01:00

README.rst

users-formula
=============

|img_travis| |img_sr|

.. |img_travis| image:: https://travis-ci.com/saltstack-formulas/users-formula.svg?branch=master
   :alt: Travis CI Build Status
   :scale: 100%
   :target: https://travis-ci.com/saltstack-formulas/users-formula
.. |img_sr| image:: https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg
   :alt: Semantic Release
   :scale: 100%
   :target: https://github.com/semantic-release/semantic-release

Formula to configure users via pillar.

.. contents:: **Table of Contents**

General notes
-------------

See the full `SaltStack Formulas installation and usage instructions
<https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html>`_.

If you are interested in writing or contributing to formulas, please pay attention to the `Writing Formula Section
<https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#writing-formulas>`_.

If you want to use this formula, please pay attention to the ``FORMULA`` file and/or ``git tag``,
which contains the currently released version. This formula is versioned according to `Semantic Versioning <http://semver.org/>`_.

See `Formula Versioning Section <https://docs.saltstack.com/en/latest/topics/development/conventions/formulas.html#versioning>`_ for more details.

Contributing to this repo
-------------------------

**Commit message formatting is significant!!**

Please see `How to contribute <https://github.com/saltstack-formulas/.github/blob/master/CONTRIBUTING.rst>`_ for more details.

Available states
----------------

.. contents::
   :local:

``users``
^^^^^^^^^

Configures a user's home directory, group, the user itself, secondary groups,
and associated keys. Also configures sudo access, and absent users.

``users.sudo``
^^^^^^^^^^^^^^

Ensures the sudo group exists, the sudo package is installed and the sudo file
is configured.

``users.bashrc``
^^^^^^^^^^^^^^^^

Ensures the bashrc file exists in the users home directory. Sets 'manage_bashrc:
True' in pillar per user. Defaults to False.

``users.profile``
^^^^^^^^^^^^^^^^^

Ensures the profile file exists in the users home directory. Sets 'manage_profile:
True' in pillar per user. Defaults to False.

``users.vimrc``
^^^^^^^^^^^^^^^

Ensures the vimrc file exists in the users home directory. Sets 'manage_vimrc:
True' in pillar per user. Defaults to False.
This depends on the vim-formula being available and pillar `users:use_vim_formula: True`.

``users.user_files``
^^^^^^^^^^^^^^^^^^^^

Permits the abitrary management of files. See pillar.example for configuration details.

Overriding default values
-------------------------

In order to separate actual user account definitions from configuration the pillar ``users-formula`` was introduced:

.. code-block:: yaml

    users:
      myuser:
        # stuff

    users-formula:
      lookup:
        root_group: toor
        shell: '/bin/zsh'

Testing
-------

Linux testing is done with ``kitchen-salt``.

Requirements
^^^^^^^^^^^^

* Ruby
* Docker

.. code-block:: bash

   $ gem install bundler
   $ bundle install
   $ bin/kitchen test [platform]

Where ``[platform]`` is the platform name defined in ``kitchen.yml``,
e.g. ``debian-9-2019-2-py3``.

``bin/kitchen converge``
^^^^^^^^^^^^^^^^^^^^^^^^

Creates the docker instance and runs the ``template`` main state, ready for testing.

``bin/kitchen verify``
^^^^^^^^^^^^^^^^^^^^^^

Runs the ``inspec`` tests on the actual instance.

``bin/kitchen destroy``
^^^^^^^^^^^^^^^^^^^^^^^

Removes the docker instance.

``bin/kitchen test``
^^^^^^^^^^^^^^^^^^^^

Runs all of the stages above in one go: i.e. ``destroy`` + ``converge`` + ``verify`` + ``destroy``.

``bin/kitchen login``
^^^^^^^^^^^^^^^^^^^^^

Gives you SSH access to the instance for manual testing.