Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

ERROR: apt is not a legal parameter of an Ansible Play

Tags:

ansible

I'm getting the following error when trying to run a YML file:-

user@ubuntuA:~$ ansible-playbook -i hostfile setup.yml

ERROR:

apt is not a legal parameter of an Ansible Play

Ansible version: 1.9.2

yml-file:-

---

- name: Install MySQL server
  apt: name=mysql-server state=latest

- name: Install Apache module for MySQL authentication
  apt: name=libapache2-mod-auth-mysql state=latest

- name: Install MySQL module for PHP
  apt: name=php5-mysql state=latest
like image 474
Tanuj Kumar Avatar asked Aug 19 '15 06:08

Tanuj Kumar


1 Answers

Your yml file should look something like this:

---
- hosts: all
  become: yes
  tasks: 
  - name: Install packages
    apt:
      name:
      - mysql-server
      - libapache2-mod-auth-mysql
      - php5-mysql
      state: latest
      cache_valid_time: 3600    # update cache if more than an hour old
like image 72
MillerGeek Avatar answered Oct 15 '22 08:10

MillerGeek