0

I've written a playbook using a tag feature so that I can control the execution of the playbook. The Playbook is correct syntax-wise.

ansible-playbook tags.yml --syntax-check

Gives no Error

However, when I run the playbook, I receive the following error

fatal: [controlnode]: FAILED! => {"ansible_facts": {"discovered_interpreter_python": "/usr/bin/python"}, "changed": false, "msg": "Failure talking to yum: near \"telnet\": syntax error"}

Here is the complete playbook

---
- hosts: RHEL7
  become: yes
  connection: ssh
  gather_facts: no
  tasks:
    - name: Installing packages
      yum: pkg=['telnet','httpd','tree'] state=installed
      tags:
        - packages
    - name: Verifying if those packages are installed properly
      raw: rpm -qa --last | head -5 > /home/packages.log
      tags:
        - verification_packages
Gaël Marziou
  • 16,028
  • 4
  • 38
  • 49
FM2012
  • 61
  • 1
  • 1
  • 8
  • Hi..WC to SO!. Kindly go through the link for creating minimal viable question .https://stackoverflow.com/help/minimal-reproducible-example. Also instead of google or any shared drive link kindly upload the question with the code. – error404 Jun 01 '19 at 15:03
  • I tried to paste the code, that didn't work somehow, that's why I shared the link, instead of sharing a messing code. Thank you – FM2012 Jun 01 '19 at 15:34

1 Answers1

1

Try full YAML syntax:

- name: Ensure packages are installed
  yum:
    state: installed
    name:
      - telnet
      - httpd
      - tree
Gaël Marziou
  • 16,028
  • 4
  • 38
  • 49