working disable/enable services

This commit is contained in:
Sebastien Thebert committed 2022-10-29 13:17:53 +02:00
1 parent 3de1cd1c9b
commit 342c00eda6
6 files changed
+69 -30

No files matched your search

+11
View File
@@ -0,0 +1,11 @@
---
- name: Enable services
ansible.builtin.command: "pro enable {{ item }}"
become: yes
register: reg_pro_enable
when: item in ubuntu_pro_services
loop: "{{ enabled_services }}"
changed_when: reg_pro_enable.rc == 0
failed_when:
- reg_pro_enable.rc != 0
- ('is already enabled' not in reg_pro_enable.stdout_lines[1] and 'is not available for' not in reg_pro_enable.stdout_lines[1])