ansible/roles/common/tasks/services.yml

64 lines
1.3 KiB
YAML
Raw Normal View History

2023-09-25 08:40:20 +00:00
# 2023-09-25
# Tasks: services
---
- ansible.builtin.include_vars: services.yml
- name: Disable services
ansible.builtin.service:
name: "{{ item }}"
enabled: false
state: "stopped"
with_items: "{{ services_disable }}"
tags:
- system
- services
- disable
when:
- ansible_facts['system'] == "Linux"
- ansible_facts['os_family'] == "Debian"
- name: Enable services
ansible.builtin.service:
name: "{{ item }}"
enabled: true
state: "started"
with_items: "{{ services_enable }}"
tags:
- system
- services
- enable
- restart
when:
- ansible_facts['system'] == "Linux"
- ansible_facts['os_family'] == "Debian"
- name: Restart services
ansible.builtin.service:
name: "{{ item }}"
enabled: true
state: "restarted"
with_items: "{{ services_restart }}"
tags:
- system
- services
- enable
- restart
when:
- ansible_facts['system'] == "Linux"
- ansible_facts['os_family'] == "Debian"
- name: Enable timers
ansible.builtin.service:
name: "{{ item }}"
enabled: true
state: "started"
with_items: "{{ timers_enable }}"
tags:
- system
- timers
- enable
when:
- ansible_facts['system'] == "Linux"
- ansible_facts['os_family'] == "Debian"