Properly fix daemon reload
This commit is contained in:
parent
abdc0fff9c
commit
0119db15e8
@ -3,6 +3,6 @@ argument_specs:
|
||||
daemon_reload:
|
||||
options:
|
||||
services_host_services:
|
||||
type: "list"
|
||||
type: "dict"
|
||||
elem: "dict"
|
||||
required: true
|
||||
|
@ -1,6 +1,6 @@
|
||||
---
|
||||
- name: "daemon_reload : loop over services"
|
||||
ansible.builtin.include_tasks: "daemon_reload/main.yml"
|
||||
loop: "{{ services_host_services | dict2items | selectattr('key') }}"
|
||||
loop: "{{ services_host_services | dict2items | map(attribute='key') }}"
|
||||
loop_control:
|
||||
loop_var: "services_service_name"
|
||||
|
@ -1,11 +1,12 @@
|
||||
---
|
||||
- name: "daemon_reload : {{ services_service_name }} : set variables"
|
||||
ansible.builtin.import_tasks: "../vars.yml"
|
||||
ansible.builtin.include_vars: "user.yml"
|
||||
|
||||
- name: "daemon_reload : {{ services_service_name }} : check if home exists"
|
||||
ansible.builtin.stat:
|
||||
path: "{{ services_service_user_home }}"
|
||||
register: services_include_daemon_reload_user_home
|
||||
- name: "daemon_reload : {{ services_service_name }} : check if user exists"
|
||||
ansible.builtin.getent:
|
||||
database: "passwd"
|
||||
key: "{{ services_service_user_name }}"
|
||||
fail_key: false
|
||||
|
||||
- name: "daemon_reload : {{ services_service_name }} : systemd daemon reload"
|
||||
become_user: "{{ services_service_user_name }}"
|
||||
@ -13,4 +14,4 @@
|
||||
daemon_reload: true
|
||||
scope: "user"
|
||||
when:
|
||||
services_include_daemon_reload_user_home.stat.exists
|
||||
ansible_facts.getent_passwd[services_service_user_name]
|
||||
|
Loading…
Reference in New Issue
Block a user