mirror of
https://gitlab.sectorq.eu/jaydee/ansible.git
synced 2026-01-29 02:49:44 +01:00
This commit is contained in:
@@ -2,19 +2,29 @@
|
||||
become: "{{ 'no' if inventory_hostname in ['sectorq.cloud', 'nas.home.lan'] else 'yes' }}"
|
||||
become_method: su
|
||||
block:
|
||||
|
||||
- name: Include vault
|
||||
ansible.builtin.include_vars:
|
||||
file: jaydee.yml
|
||||
file: init.yml
|
||||
- name: Change password for jd
|
||||
ansible.builtin.user:
|
||||
name: jd
|
||||
password: "{{ jd_password | password_hash('sha512') }}"
|
||||
- name: Check if group exists
|
||||
getent:
|
||||
database: group
|
||||
key: sudo
|
||||
register: group_check
|
||||
ignore_errors: true
|
||||
|
||||
- name: Ensure deploy user exists
|
||||
ansible.builtin.user:
|
||||
name: jd
|
||||
shell: /bin/bash
|
||||
groups: sudo
|
||||
append: true
|
||||
when: group_check is succeeded
|
||||
|
||||
- name: Give deploy sudo access
|
||||
ansible.builtin.copy:
|
||||
dest: /etc/sudoers.d/jd
|
||||
|
||||
Reference in New Issue
Block a user