
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 490 Views
Hello everyone!
While reading the ch01s07, I noticed that there is a typo in the code snippet below the topic "Using the Block and Rescue Directives to Recover or Roll Back":
- block:
- name: Check web site from web server
ansible.builtin.uri:
url: http://{{ ansible_fqdn }}
return_content: true
register: example_webpage
failed_when: example_webpage.status != 200
rescue:
- name: Restart web server
ansible.builtin.service:
name: httpd
status: restarted
To be more specific, in the rescue clause, the ansible.builtin.service is used with the option "status", but this is not supported by the module. The correct option should be "state".
Cheers!
Rolando.
Accepted Solutions

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 454 Views
@Roldo The fix is in place and will be released in the future release of this course ( until the course is updated after the release of AAP 2.5 ).

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 462 Views
@Roldo You are right, thanks for pointing that out! I will report it for rectification.
https://docs.ansible.com/ansible/latest/collections/ansible/builtin/service_module.html

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
- 455 Views
@Roldo The fix is in place and will be released in the future release of this course ( until the course is updated after the release of AAP 2.5 ).