UID and GID need user to exist first
This commit is contained in:
parent
459e561a24
commit
260bc71939
@ -1,4 +1,5 @@
|
||||
- block:
|
||||
- import_tasks: ../vars.yml
|
||||
- import_tasks: ../vars-user.yml
|
||||
- import_tasks: service-deploy/service.yml
|
||||
tags: "{{ service_name }}"
|
||||
|
15
playbooks/tasks/services/vars-user.yml
Normal file
15
playbooks/tasks/services/vars-user.yml
Normal file
@ -0,0 +1,15 @@
|
||||
- name: Get user info
|
||||
getent:
|
||||
database: passwd
|
||||
key: "{{ service_user_name }}"
|
||||
|
||||
- name: Set service variables
|
||||
set_fact:
|
||||
service_user_uid: "{{ ansible_facts.getent_passwd[service_user_name].1 }}"
|
||||
service_user_gid: "{{ ansible_facts.getent_passwd[service_user_name].2 }}"
|
||||
|
||||
- name: Print service variables
|
||||
debug:
|
||||
msg:
|
||||
- "service_user_uid: {{ service_user_uid }}"
|
||||
- "service_user_gid: {{ service_user_gid }}"
|
@ -10,22 +10,10 @@
|
||||
set_fact:
|
||||
local_service_home: "./filesystem/{{ ansible_hostname }}/{{ service_home }}"
|
||||
|
||||
- name: Get user info
|
||||
getent:
|
||||
database: passwd
|
||||
key: "{{ service_user_name }}"
|
||||
|
||||
- name: Set service variables
|
||||
set_fact:
|
||||
service_user_uid: "{{ ansible_facts.getent_passwd[service_user_name].1 }}"
|
||||
service_user_gid: "{{ ansible_facts.getent_passwd[service_user_name].2 }}"
|
||||
|
||||
- name: Print service variables
|
||||
debug:
|
||||
msg:
|
||||
- "service_name: {{ service_name }}"
|
||||
- "service_user_name: {{ service_user_name }}"
|
||||
- "service_user_uid: {{ service_user_uid }}"
|
||||
- "service_user_gid: {{ service_user_gid }}"
|
||||
- "service_home: {{ service_home }}"
|
||||
- "local_service_home: {{ local_service_home }}"
|
||||
|
Loading…
Reference in New Issue
Block a user