Hello all :)
In this exercise I was able to install nginx in an Ansible script.
This Ansible playbook installs the Nginx Web server on a specified Ubuntu host.
I created a directory called ansible project with the command mkdir ansibleproject.
In that same directory, I created 3 files.
touch ansible.cfg
touch inventory.init
touch webserver.yml




#!/bin/bash -So this is an exercise how to install nginx or apache ( in this case nginx ) with ansible automation.
- Connects to the host at IP
192.168.1.29
using the usersloba
. - Uses
sudo
privileges (become: yes
). - Updates the package cache.
- Installs the
apache2
package to ensure Apache is present.
- Make sure you have Ansible installed on your control machine.
- Ensure you have SSH access to the target host (
192.168.1.29
) as usersloba
. - I Run the playbook with :
ansible-playbook -i 192.168.1.29, install-apache.yml
Slobodan Milojevic