User Tools

Site Tools


salt-stack:add_bofher_user

[SLS] Add bofher user

Documentation
Name: [SLS] Add bofher user
Description: Recipe to add bofher user on machines where is not available
Modification date :26/19/2018
Owner:dodger@ciberterminal.net
Notify changes to:Owner
Tags: salt, cloud-init

Update keys

Keys must be up-to-date on: Sysadmin's public ssh keys Then on salt-master:

cd /srv/salt/base
curl -k "https://dokuwiki.ciberterminal.net/doku.php?do=export_code&id=documentation:general:sysadmin_ssh_pubkeys&codeblock=0" >> bofher_defaults/authorized_keys.txt

Apply state

salt '*' state.apply bofher_defaults/add_bofher_user

Sample run

avmlm-salt-001 /srv/salt/base # salt 'acclp-psql-001*' state.apply bofher_defaults/add_bofher_user                                                                                                                                                                                   
acclp-psql-001:
    ----------
    cmd_|-add_to_sudoers_|-echo 'bofher ALL = (root) NOPASSWD:ALL' >/etc/sudoers.d/90-cloud-init-users_|-run:
        ----------
        __run_num__:
            1
        changes:
            ----------
            pid:
                60313
            retcode:
                0
            stderr:
            stdout:
        comment:
            Command "echo 'bofher ALL = (root) NOPASSWD:ALL' >/etc/sudoers.d/90-cloud-init-users" run
        duration:
            6.51
        name:
            echo 'bofher ALL = (root) NOPASSWD:ALL' >/etc/sudoers.d/90-cloud-init-users
        result:
            True
        start_time:
            12:57:20.021822
    file_|-/home/bofher/.ssh/authorized_keys_|-/home/bofher/.ssh/authorized_keys_|-managed:
        ----------
        __run_num__:
            3
        changes:
            ----------
            diff:
                New file
            group:
                bofher
            user:
                bofher
        comment:
            File /home/bofher/.ssh/authorized_keys updated
        duration:
            15.568
        name:
            /home/bofher/.ssh/authorized_keys
        result:
            True
        start_time:
            12:57:20.052797
    file_|-/home/bofher/.ssh_|-/home/bofher/.ssh_|-directory:
        ----------
        __run_num__:
            2
        changes:
            ----------
            /home/bofher/.ssh:
                New Dir
        comment:
            Directory /home/bofher/.ssh updated
        duration:
            13.002
        name:
            /home/bofher/.ssh
        result:
            True
        start_time:
            12:57:20.039588
    user_|-bofher_|-bofher_|-present:
        ----------
        __run_num__:
            0
        changes:
            ----------
            fullname:
            gid:
                1000
            groups:
                - bofher
            home:
                /home/bofher
            homephone:
            name:
                bofher
            passwd:
                x
            roomnumber:
            shell:
                /bin/bash
            uid:
                1000
            workphone:
        comment:
            New user bofher created
        duration:
            52.187
        name:
            bofher
        result:
            True
        start_time:
            12:57:19.968567
salt-stack/add_bofher_user.txt · Last modified: 2019/07/18 09:19 (external edit)