Ansible Setup Httpd and PHP - task failed because of file extension

Hi @player001 @KodeKloud @kodekloud-support3 @Inderpreet
i have assigned with below task. In the task it asked to create file with name “httpd.yml”.
But mistakenly i have created with extension as “.yaml”. Because of this my task failed with error message as “- ‘/home/thor/playbooks/httpd.yml’ file does not exist on Jump Server”. Since both are valid extension can you validate the task further.

Task Statement:

Partially this task should be mark as success because both yaml and yml extension is valid.

Mention the KKE Support team to look into this issue.

Hi,

I guess you’ve to use the correct file name, it’s mentioned in the question.

Yeah, all the times we have to stick with the task descriptions but yaml or yml is same so it should be consider fine.

@player001
Can you help me to tag the correct person.
I have marked @KodeKloud @kodekloud-support3. Have not received any response yet. Not sure are they correct mention or not.

tag inderpreet. @pragasekar

@Inderpreet can you help me on this

@Inderpreet
@rahul456

Kindly check on my task.
Task: Ansible Setup Httpd and PHP

Task Status - Failed
  • playbook ‘/home/thor/playbooks/httpd.yml’ should not run for ‘hosts: all’

Even i have given all in hosts but still My playbook will run on only stapp01. I have written condition. Then how my task can be failed.

  • name: package module

    hosts: all
    become: true
    tasks:

    • name: install httpd and php
      yum:
      name:
      - httpd
      - php
      state: latest
      when: inventory_hostname == ‘stapp01’
    • name: Create document root
      file:
      path: /var/www/html/myroot
      state: directory
      when: inventory_hostname == ‘stapp01’
    • name: change documenr root directory
      lineinfile: dest=/etc/httpd/conf/httpd.conf regexp="^DocumentRoot “/var/www/html”" line=“DocumentRoot “/var/www/html/myroot”” state=present
      when: inventory_hostname == ‘stapp01’
    • name: copy template
      template:
      src: /home/thor/playbooks/templates/phpinfo.php.j2
      dest: /var/www/html/myroot/phpinfo.php
      owner: apache
      group: apache
      when: inventory_hostname == ‘stapp01’
    • name: enable services
      service:
      name: httpd
      state: started
      enabled: yes
      when: inventory_hostname == ‘stapp01’
      thor@jump_host ~/playbooks$

hi @nithyaks, sorry for the issue, this is marked success for you

@rahul456

Thanks a lot