September 2018
Beginner to intermediate
214 pages
5h 53m
English
This use case allows you to automate the addition of a new user to your system. Basically, we are going to create a new user in all Linux hosts, with the password already set up. We are also going to create an SSH key so that it can be accessed remotely and add some sudo configurations for easier management. This is implemented in the following code:
---- name: Create a dedicated remote management user hosts: Linux become: yes gather_facts: yes tasks: - name: Create a now basic user user: name: 'ansuser' password: $6$C2rcmXJPhMAxLLEM$N.XOWkuukX7Rms7QlvclhWIOz6.MoQd/ jekgWRgDaDH5oU2OexNtRYPTWwQ2lcFRYYevM83wIqrK76sgnVqOX. # A hash for generic password. append: yes groups: sudo shell: ...
Read now
Unlock full access