This role manage users for hosts.
It currently supports those Operating Systems:
Since you don't want to define your users for every host individually, you need to place your variable somewhere every host has access to it. In this example the
users variable will be defined in the scope of an Ansible group called allhosts.
users: - name: "jdenker" comment: "Johann Denker" uid: 2048 password: "$6$6FlXAIFWM2v1clqj$pVYUclQuCJ0kDDcg2QFFmS8cVKUxsDKSOmaqcQJECEpaiCjm0GxRtsmCNoTh/mlIp9gQDGr97pvUhswZOieSi0" shell: "bash" createonhost_bygroup: - "tags_allhosts" groups_byhostname: deskrx1.libcom.de: - "audio" - "input" - "lp" - "storage" - "users" - "network" - "power" - "gdm" - name: "skuchen" comment: "Sibille Kuchen" uid: 2050 password: "$6$clsF9Lxzh9JF5LZJ$RhUnTHwDHiLwrLjIkFj2.K0BHh6gi95g6JSe0BoCs6141.sA3RGtvMiLXn4NmhsX.zXu4ozlIQTaoQL2xuP9I/" shell: "zsh" createonhosts: - "hosta.example.com" - "hostb.example.com"
The password is expected to be encrypted. The easiest way to get such an encrypted password is to use the
mkpasswd command line tool.
A full list of available options can be found in the role's documentation.
This role has a dependency to imp1sh.ansible_managemynetwork.ansible_users and will install the shell package you choose for the users.
In order to associate a user with a host there is the dict attribute
createonhosts which expects a list of hostnames. The hostnames need to match the ansible hostnames.
You can also deploy users to a group of hosts by referencing Ansible groups with the
createonhost_bygroup dict attribute. It expects a matching Ansible groupname.
You do not give the full path to the shell here, but only the binary name, e.g.
zsh. If your OS doesn't work with this role, please open an issue.