Webserver
We are now going to install, configure and enable a web server on our target systems. Take a look at the webserver.yml playbook. It’s first installing the packages, then using systemctl to enable the webserver and making sure it’s started.
Execute the playbook
After the playbook completes successfully, run the following commands to ensure the package is installed and the service is started and enabled:
Edit the playbook and add another task to create a custom web page.
This task uses the copy module to add file to the system. You could copy a file local to the ansible server to the target system, but in this case, we are providing the contents inline.
Run the playbook again. Notice that the first two tasks are green (unchanged), but the new task is yellow (change made). This demonstrates idempotency. Run the curl command against the servers to see the custom web page.