7.处理task错误
vim playbook.yml
---
- name: Task Failure Exercise
hosts: databases
vars:
web_package: http
db_package: mariadb-server
db_service: mariadb
tasks:
- name: Install {
{
web_package }} package
ansible.builtin.dnf:
name: "{
{ web_package }}"
state: present
ignore_errors: yes
- name: Install {
{
db_package }} package
ansible.builtin.dnf:
name: "{
{ db_package }}"
state: present
ansible-navigator run -m stdout playbook.yml
![在这里插入图片描述](https://i-blog.csdnimg.cn/direct/1d6046e5b5e142c8aec594097983793f.png#pic_center)
vim playbook.yml
---
- name: Task Failure Exercise
hosts: databases
vars:
web_package: http
db_package: mariadb-server
db_service: mariadb
tasks:
- name: attempt to set up a webserver
block:
- name: Install {