Ansible 语域不是可译剧本的法定参数
我试图运行一个简单的Ansible剧本,但不断出现以下错误,我不知道为什么 错误:寄存器不是Ansible播放的合法参数 下面是我试图执行的代码Ansible 语域不是可译剧本的法定参数,ansible,conditional-statements,Ansible,Conditional Statements,我试图运行一个简单的Ansible剧本,但不断出现以下错误,我不知道为什么 错误:寄存器不是Ansible播放的合法参数 下面是我试图执行的代码 --- - name: Get SELinux sestatus command: sestatus | grep enforcing | grep 'config file' register: sestatus - name: Check if module1.pp exists stat: path: bin/module
---
- name: Get SELinux sestatus
command: sestatus | grep enforcing | grep 'config file'
register: sestatus
- name: Check if module1.pp exists
stat:
path: bin/module1.pp
register: module1_pp
- name: Disable SELinux if enforcing
sudo: yes
command: "{{ item }}"
with_items:
- setenforce 0
- semodule -i bin/module1.pp
- setsebool -P httpd_can_network_connect 1
when: sestatus.rc == 0 and module1.stat.exists == true
这就是你的全部剧本?您缺少
主机
和任务
声明
谢谢你的帮助,这解决了我的问题
- hosts: some_hosts
tasks:
- name: Get SELinux sestatus
command: sestatus | grep enforcing | grep 'config file'
register: sestatus
- name: Check if module1.pp exists
stat:
path: bin/module1.pp
register: module1_pp
- name: Disable SELinux if enforcing
sudo: yes
command: "{{ item }}"
with_items:
- setenforce 0
- semodule -i bin/module1.pp
- setsebool -P httpd_can_network_connect 1
when: sestatus.rc == 0 and module1.stat.exists == true