Why ansible playbook & lab got stuck (Day 18 in 100 days of devops tasks)

Here is my play book and commands i ran. Here i just specified playbook to configure appservers only. But in Installing httpd,php packages tasks terminal got stuck, as well as full lab. I don’t know what i am missing. I tried multiple times. It would be great, if someone please assist with this?

app.yaml

  • name: Configuring appservers
    hosts: app_servers
    become: yes
    tasks:

    • name: Installing httpd,php packages
      yum:
      name: “{{ item }}”
      state: present
      loop:

      • httpd
      • php
      • php-mysqlnd
    • name: Changing apache port to 6300
      lineinfile:
      path: /etc/httpd/conf/httpd.conf
      regexp: ‘^Listen’
      line: ‘Listen 6300’
      notify: restart httpd

    handlers:

    • name: restart httpd
      service:
      name: httpd
      state: restarted

#vi inventory.ini
[app_servers]
stapp01 ansible_host=172.16.238.10 ansible_user=tony ansible_ssh_pass=Ir0nM@n ansible_become_pass=Ir0nM@n
stapp02 ansible_host=172.16.238.11 ansible_user=steve ansible_ssh_pass=Am3ric@ ansible_become_pass=Am3ric@
stapp03 ansible_host=172.16.238.12 ansible_user=banner ansible_ssh_pass=BigGr33n ansible_become_pass=BigGr33n
[db_server]
stdb01 ansible_host=172.16.239.10 ansible_user=peter ansible_ssh_pass=Sp!dy ansible_become_pass=Sp!dy

Commands i ran:-
#sudo dnf install epel-release -y
#sudo dnf install ansible -y
#ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook app.yaml -i inventory.ini --syntax-check
#ANSIBLE_HOST_KEY_CHECKING=False ansible-playbook -i inventory.ini app.yaml

Can you please confirm the task number again?

As Day 18 is Configure Lamp server.

Yes, It’s Day 18 (Configuring Lamp server). This config for Just appservers via ansible.

These beginner-level task labs are configured with the minimum resources required for task execution.

This could be because the Ansible script is trying to consume more resources than are allocated on the servers.

Can you try this via a Shell script or by running the commands on app servers?

Yeah, I had same thought. By the way i have completed that task using shell script.

Hi @Deepak_Raj_T this might help Day 18

1 Like

check this repo : 100-Days-Of-DevOps-KodeKloud-Challenges-Solutions