ansible-edda/playbooks/tasks/services/vars-user.yml

16 lines
442 B
YAML

- 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 }}"