nginx-service
Example:
# Install Nginx webserver - nginx-service
Description
Installs the Nginx web server.
This uses the geerlingguy.nginx Ansible role to do the heavy lifting.
It's recommended to use the 'webserver-service' frecklet instead of this if you want to provision a web server with things like https certificate, php installed, etc.
Variables
Name | Type | Default | Description |
---|---|---|---|
|
boolean | True | Whether to remove the 'default' virtualhost configuration supplied by Nginx. Useful if you want the base / URL to be directed at one of your own virtual hosts configured in a separate .conf file. |
|
string | -- | the user nginx will run under |
Examples
Example 1
Install Nginx webserver
Code
- nginx-service
Example 2
Install Nginx webserver, use freckles user as the user who runs the Nginx service.
Code
- nginx-service: user: freckles
Description
Install Nginx webserver, use freckles user as the user who runs the Nginx service. The freckles user has to exists already for this to work.
This is useful for example when you develop using Vagrant or a similar tool, and can't easily change the owner/permissions of files Nginx is supposed to server. Much easier to just change the user who runs Nginx than trying to muck about with mount options and such.
Example 3
Install Nginx webserver, keep default vhost config in place.
Code
- nginx-service: remove_default_vhost: false
Code
doc: short_help: Ensures the nginx web server is installed and running. help: | Installs the Nginx web server. This uses the [geerlingguy.nginx](https://github.com/geerlingguy/ansible-role-nginx) Ansible role to do the heavy lifting. It's recommended to use the 'webserver-service' frecklet instead of this if you want to provision a web server with things like https certificate, php installed, etc. furter_reading: nginx website: https://www.nginx.com geerlingguy.nginx Ansible role: https://github.com/geerlingguy/ansible-role-nginx examples: - title: Install Nginx webserver - title: Install Nginx webserver, use *freckles* user as the user who runs the Nginx service. desc: | Install Nginx webserver, use *freckles* user as the user who runs the Nginx service. The *freckles* user has to exists already for this to work. This is useful for example when you develop using Vagrant or a similar tool, and can't easily change the owner/permissions of files Nginx is supposed to server. Much easier to just change the user who runs Nginx than trying to muck about with mount options and such. vars: user: freckles - title: Install Nginx webserver, keep default vhost config in place. vars: remove_default_vhost: false args: user: type: string required: false doc: short_help: the user nginx will run under remove_default_vhost: type: boolean doc: short_help: Whether to remove the 'default' virtualhost configuration supplied by Nginx. help: | Whether to remove the 'default' virtualhost configuration supplied by Nginx. Useful if you want the base / URL to be directed at one of your own virtual hosts configured in a separate .conf file. required: false default: true cli: param_decls: - --remove-default-vhost meta: tags: - webserver - nginx - featured-frecklecutable frecklets: - task: include-type: import become: true frecklet: type: ansible-role resources: ansible-role: - geerlingguy.nginx name: geerlingguy.nginx properties: idempotent: true elevated: true internet: true desc: short: install nginx web server references: "'geerlingguy.nginx' Ansible role": https://github.com/geerlingguy/ansible-role-nginx vars: nginx_user: '{{:: user ::}}' nginx_remove_default_vhost: '{{:: remove_default_vhost ::}}'
frecklecute nginx-service --help Usage: frecklecute nginx-service [OPTIONS] Installs the Nginx web server. This uses the [geerlingguy.nginx](https://github.com/geerlingguy/ansible- role-nginx) Ansible role to do the heavy lifting. It's recommended to use the 'webserver-service' frecklet instead of this if you want to provision a web server with things like https certificate, php installed, etc. Options: --remove-default-vhost Whether to remove the 'default' virtualhost configuration supplied by Nginx. --user USER the user nginx will run under --help Show this message and exit.
# -*- coding: utf-8 -*- # # module path: pycklets.nginx_service.NginxService # from dataclasses import dataclass from pyckles import AutoPycklet from typing import * # noqa @dataclass class NginxService(AutoPycklet): """Installs the Nginx web server. This uses the [geerlingguy.nginx](https://github.com/geerlingguy/ansible-role-nginx) Ansible role to do the heavy lifting. It's recommended to use the 'webserver-service' frecklet instead of this if you want to provision a web server with things like https certificate, php installed, etc. Args: remove_default_vhost: Whether to remove the 'default' virtualhost configuration supplied by Nginx. user: the user nginx will run under """ FRECKLET_ID = "nginx-service" remove_default_vhost: bool = None user: str = None def __post_init__(self): super(NginxService, self).__init__(var_names=["remove_default_vhost", "user"]) frecklet_class = NginxService
# -*- coding: utf-8 -*- # # module path: pycklets.nginx_service.NginxService # from pyckles import AutoPycklet class NginxService(AutoPycklet): """Installs the Nginx web server. This uses the [geerlingguy.nginx](https://github.com/geerlingguy/ansible-role-nginx) Ansible role to do the heavy lifting. It's recommended to use the 'webserver-service' frecklet instead of this if you want to provision a web server with things like https certificate, php installed, etc. Args: remove_default_vhost: Whether to remove the 'default' virtualhost configuration supplied by Nginx. user: the user nginx will run under """ FRECKLET_ID = "nginx-service" def __init__(self, remove_default_vhost=True, user=None): super(NginxService, self).__init__(var_names=["remove_default_vhost", "user"]) self._remove_default_vhost = remove_default_vhost self._user = user @property def remove_default_vhost(self): return self._remove_default_vhost @remove_default_vhost.setter def remove_default_vhost(self, remove_default_vhost): self._remove_default_vhost = remove_default_vhost @property def user(self): return self._user @user.setter def user(self, user): self._user = user frecklet_class = NginxService