Combine status with state update for start/stop

This commit is contained in:
Wojciech Kozlowski 2023-02-12 12:38:26 +01:00
parent ab4cc3e394
commit a8d1a9e9b2
2 changed files with 12 additions and 28 deletions

View File

@ -4,18 +4,10 @@
name: "services/include" name: "services/include"
vars_from: "user" vars_from: "user"
- block: - name: "enable and start pod-{{ services_service_name }}"
become_user: "{{ services_service_user_name }}"
- name: "enable pod-{{ services_service_name }}"
ansible.builtin.systemd: ansible.builtin.systemd:
name: "pod-{{ services_service_name }}.service" name: "pod-{{ services_service_name }}.service"
enabled: true enabled: true
scope: "user"
- name: "start pod-{{ services_service_name }}"
ansible.builtin.systemd:
name: "pod-{{ services_service_name }}.service"
state: "started" state: "started"
scope: "user" scope: "user"
become_user: "{{ services_service_user_name }}"

View File

@ -4,18 +4,10 @@
name: "services/include" name: "services/include"
vars_from: "user" vars_from: "user"
- block: - name: "disable and stop pod-{{ services_service_name }}"
become_user: "{{ services_service_user_name }}"
- name: "stop pod-{{ services_service_name }}"
ansible.builtin.systemd:
name: "pod-{{ services_service_name }}.service"
state: "stopped"
scope: "user"
- name: "disable pod-{{ services_service_name }}"
ansible.builtin.systemd: ansible.builtin.systemd:
name: "pod-{{ services_service_name }}.service" name: "pod-{{ services_service_name }}.service"
enabled: false enabled: false
state: "stopped"
scope: "user" scope: "user"
become_user: "{{ services_service_user_name }}"