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