diff --git a/create-gilles-user.yml b/create-gilles-user.yml new file mode 100644 index 0000000..53fe982 --- /dev/null +++ b/create-gilles-user.yml @@ -0,0 +1,20 @@ +- name: install mandatory python for encrypt password + dnf: + name: [python3, python3-bcrypt] + state: present + +- name: create password for user kadmin + shell: python -c 'import crypt;hashed = crypt.crypt("{{ gilles_passwd }}"); print(hashed);' + register: passwd + +- name: create user kadmin + user: + name: gilles + comment: Gilles Mouchet + password: "{{ passwd.stdout }}" + +- name: copy sudo file + lineinfile: + path: /etc/sudoers.d/gilles + insertbefore: EOF + line: 'gilles ALL=(ALL) NOPASSWD: ALL' \ No newline at end of file diff --git a/group_vars/all.yml b/group_vars/all.yml index 3430817..d11485c 100644 --- a/group_vars/all.yml +++ b/group_vars/all.yml @@ -4,4 +4,11 @@ mail_domain: gmotech.dyndns.org #mail_relay_host: smtpauths.bluewin.ch #mail_relay_host: smtp.gmail.com # DNS -#dns_domain_search: gmotech.net \ No newline at end of file +#dns_domain_search: gmotech.net +gilles_passwd: !vault | + $ANSIBLE_VAULT;1.1;AES256 + 30333961653331613064333063326538393232633833663932386632653765613933396239316230 + 3061626535666636333866633538623365333139666163340a336531643364626630653331306264 + 35326238636466643938366535666462666534613137633631316638363763313164343563353734 + 6366393333326564340a623738653735363932313635616530613863313639306130363562656332 + 3738 \ No newline at end of file diff --git a/main.yml b/main.yml index c65d7d3..37b218b 100644 --- a/main.yml +++ b/main.yml @@ -22,6 +22,7 @@ - include_tasks: hosts.yml - include_tasks: inst-packages.yml - include_tasks: misc.yml + - include_tasks: create-gilles-user.yml - name: import postfix role import_role: