Today we study an example of using Ansible to configure nginx.
We create an Ansible playbook named web-notls.yml.
Type the following commands:
We need to extra files.
1) files/nginx.conf
2) templates/index.html.j2
Then, we run ansible-playbook and got an error:
Why is that?
After running
The output is
If we run
It is found that
httpd ....................TCP *:80 (LISTEN)
Port 80 was used by httpd.
After we stopped httpd, the error disappeared.
Then we type "localhost" in a web browser, we got the following words printed:
nginx, configured by Ansible
If you can see this, Ansible successfully installed nginx.
Ansible managed