There is a person who uses it together with the motive of "I'm worried whether the ansible code is correct, so check it with serverspec", but it is a mistake. It is impossible to check unless the serverspec code is absolutely correct.
with ansible
python
- name: restart hogehoge.service
systemd:
name: hogehoge.service
state: restarted
daemon_reload: yes
enabled: yes
become: yes
With serverspec,
describe process('hogehoge') do
it { should be_running }
end
It is also a mistake to write ** only **.
Since the systemd module is guaranteed idempotent, it makes no sense to check the serverspec for process startup. If you know TDD's "test your anxiety" word, let's suppress the meaning of idempotence.
If you really want to check with serverspec, you should check the value of the configuration file referenced by the service other than starting the process. However, keep in mind that all those check items can be confirmed with ansible.