August 2015
Intermediate to advanced
168 pages
3h 32m
English
We will now create a separate role for Nginx and move the previous code that we wrote in the simple_playbook.yml file to it, as follows:
$ mkdir roles/nginx $ cd roles/nginx $ mkdir tasks meta files $ cd tasks
install.yml file inside roles/base. Move the Nginx-related tasks to it. It should look like this:--- - name: add official nginx repository apt_repository: repo='deb http://nginx.org/packages/ubuntu/ lucid nginx' - name: install nginx web server and ensure its at the latest version apt: name=nginx state=latest force=yes
service.yml file to manage the state of the Nginx daemon:--- - name: start nginx service service: name=nginx state=started ...
Read now
Unlock full access