Docker installation via ansible

Does anyone know why there is an error showing “ERROR: yum is not a legal parameter of an ansible Play” whenever I tried to run my playbook to install docker?

No, because you have not given us enough info to determine that :slight_smile:

OTOH, why not use a Ansible Galaxy playbook like this: Ansible Galaxy
No need to write your own when there’s a hi-quality pre-written (& debugged) one out there!

@wdennisnla is right in everything. Sharing an error message without showing what you did to get that doesn’t help much. Not to mention that this is a Docker community forum and your question is about Ansible and yum. The fact that you want to install docker, is not really important here.

Although I agree with Willard, you could use the Ansible Role of Jeff Geerling, I use my own role too, because this is how I learned Ansible. Ansible has playbooks containing plays. Each play can have roles and tasks. You can use a module in each task. “yum” is a module, so you need to use it in a task, not directly in a play. So I guess there is an indentation problem in your playbook. Or there was, because you posted the question 11 days ago.