我正在创建一个自动化LDAP配置的ansible脚本。但是,当我对脚本进行测试运行时,我总是得到:
ERROR: yum is not a legal parameter of an Ansible Play
使用ansible我有点生疏,但我很确定我的语法正确(语法上):
---
#Kicks off the installation of Tomcat and MySQL
- name: Connecting to Anssible_centos
hosts: ansible_centos
remote_user: root
- name: Retreiving MySQL RPM and Installing
yum: name=http://dev.sql.com/get/mysql157-community-release-e16-7.noarch.rpm state=present
- debug: var=outputmySql
- name: Disabling MySql57-Community
yum: disablerepo=mysql57-community
- debug: var=outputDisable
- name: Enabling Mysql56-Community
yum: enablerepo=mysql56-community
- debug: var=outputEnable
- name: Installing mySql 5.6
yum: name="mysql-community-server" state=present
- debug: var=install56
- name: Starting MySql 5.6
service: name=mysqld state=started
- debug: var=serviceStart
- name: Update MySql root password
mysql_user: name=root host=127.0.0.1 password=codiscope
- debug: var=rootmysql
有什么想法吗?
答案 0 :(得分:2)
你的语法实际上有点过时了。你的剧本看起来应该更像这样:
- name: Connecting to Anssible_centos
hosts: ansible_centos
remote_user: root
tasks:
- name: Retreiving MySQL RPM and Installing
yum: name=http://dev.sql.com/get/mysql157-community-release-e16-7.noarch.rpm state=present
如果你想查看每项任务的结果,那么你想要做更类似于此的事情:
- name: Retreiving MySQL RPM and Installing
yum: name=http://dev.sql.com/get/mysql157-community-release-e16-7.noarch.rpm state=present
register: outputmySql
- debug: var=outputmySql