From ec2ec921b59fa5b1171f417d4daa786cbd7884ba Mon Sep 17 00:00:00 2001 From: roshi Date: Mar 02 2017 22:05:24 +0000 Subject: Update the service_manipulation role to reflect the fact that chronyd is enabled by default. --- diff --git a/roles/service_manipulation/tasks/main.yml b/roles/service_manipulation/tasks/main.yml index 69b01f2..869bae1 100644 --- a/roles/service_manipulation/tasks/main.yml +++ b/roles/service_manipulation/tasks/main.yml @@ -5,19 +5,35 @@ # to better simulate actual calls on the host. This requires a SERVICE to # be set in the vars/main.yml +- name: check that SERVICE is enabled + register: service_status + shell: systemctl is-enabled {{ SERVICE }} + failed_when: service_status.rc != 0 + +- name: check if SERVICE is started + register: service_status + shell: systemctl is-active {{ SERVICE }} + failed_when: service_status.rc != 0 + +- name: stop a SERVICE + systemd: state=stopped name={{ SERVICE }} + - name: ensure SERVICE is stopped register: service_status shell: systemctl is-active {{ SERVICE }} failed_when: service_status.rc != 3 -- name: start a SERVICE - systemd: state=started name={{ SERVICE }} +- name: reboot + include: roles/reboot/tasks/main.yml - name: check if SERVICE is started register: service_status shell: systemctl is-active {{ SERVICE }} failed_when: service_status.rc != 0 +- name: disbale SERVICE + shell: systemctl disable {{ SERVICE }} + - name: check that SERVICE is disabled register: service_status shell: systemctl is-enabled {{ SERVICE }} @@ -26,7 +42,7 @@ - name: reboot include: roles/reboot/tasks/main.yml -- name: ensure SERVICE still stopped +- name: ensure SERVICE stopped after reboot register: service_status shell: systemctl is-active {{ SERVICE }} failed_when: service_status.rc != 3