- name: Include variables for Amazon Linux.
include_vars: ../vars/test.yml
- name: populate service facts
service_facts:
- name: start the service if it's enabled
service:
name: "{{ item }}"
enabled: no
state: stopped
loop: "{{ stop_services |union(services) }}"
when: stop_services is defined
I'm trying to stop and disable a list of services only if they are installed. I'm calling the service_facts module to generate a list of running services and using filter "union" - name: Include ...
Your problem is described accurately by the error message:
is a list, and stop_services
我试图只在安装了服务的情况下停止和禁用服务列表。我调用service_facts模块来生成正在运行的服务列表,并使用 "union "过滤器。services
我得到一个错误
在({{ stop_services)上发生了意外的模板类型错误。