You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: CHANGELOG.md
+1
Original file line number
Diff line number
Diff line change
@@ -8,6 +8,7 @@ BUG FIXES:
8
8
9
9
CI/CD:
10
10
11
+
- Add Molecule tests covering common NGINX use cases (web server, reverse proxy), enabling the NGINX stub status metrics, and NGINX Plus API and live metrics dashboard.
11
12
- Update the platforms used in the various Molecule scenarios.
12
13
- Use the local role name (`ansible-role-nginx-config`) instead of the fully qualified role name (`nginxinc.nginx_config`) in Molecule to ensure tests always work as intended in environments where the role has been already installed beforehand.
Copy file name to clipboardExpand all lines: README.md
+33-10
Original file line number
Diff line number
Diff line change
@@ -42,7 +42,7 @@ This role configures NGINX Open Source and NGINX Plus on your target host.
42
42
43
43
- Molecule is used to test the various functionalities of the role. The recommended version of Molecule to test this role is `4.x`.
44
44
- Instructions on how to install Molecule can be found in the [Molecule website](https://molecule.readthedocs.io/en/latest/installation.html). *You will also need to install the Molecule Docker driver.*
45
-
- To run the NGINX Plus/App Protect config Molecule tests, you must copy your NGINX Plus/App Protect license to the role's [`files/license`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/files/license/) folder.
45
+
- To run the NGINX Plus/App Protect config Molecule tests, you must copy your NGINX Plus/App Protect license to the role's [`files/license`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/files/license/) directory.
46
46
47
47
You can alternatively add your NGINX Plus/App Protect repository certificate and key to the local environment. Run the following commands to export these files as base64-encoded variables and execute the Molecule tests:
48
48
@@ -54,6 +54,8 @@ This role configures NGINX Open Source and NGINX Plus on your target host.
54
54
55
55
## Installation
56
56
57
+
This role can be installed via either Ansible Galaxy (the Ansible community marketplace) or by cloning this repo. Once installed, you will need to include the role it in your Ansible playbook using [the `roles` keyword, the `import_role` module, or the `include_role` module](https://docs.ansible.com/ansible/latest/playbook_guide/playbooks_reuse_roles.html#using-roles).
58
+
57
59
### Ansible Galaxy
58
60
59
61
To install the latest stable release of the role on your system, use:
@@ -62,12 +64,20 @@ To install the latest stable release of the role on your system, use:
62
64
ansible-galaxy install nginxinc.nginx_config
63
65
```
64
66
65
-
Alternatively, if you have already installed the role, update the role to the latest release:
67
+
Alternatively, if you have already installed the role, you can update the role to the latest release by using:
66
68
67
69
```bash
68
70
ansible-galaxy install -f nginxinc.nginx_config
69
71
```
70
72
73
+
To use the role, include the following task in your playbook:
74
+
75
+
```yaml
76
+
- name: Configure NGINX
77
+
ansible.builtin.include_role:
78
+
name: nginxinc.nginx_config
79
+
```
80
+
71
81
### Git
72
82
73
83
To pull the latest edge commit of the role from GitHub, use:
@@ -76,6 +86,14 @@ To pull the latest edge commit of the role from GitHub, use:
To use the role, include the following task in your playbook:
90
+
91
+
```yaml
92
+
- name: Configure NGINX
93
+
ansible.builtin.include_role:
94
+
name: <path/to/repo> # e.g. <roles/ansible-role-nginx-config> if you clone the repo inside your project's roles folder
95
+
```
96
+
79
97
## Platforms
80
98
81
99
The NGINX config Ansible role supports all platforms supported by [NGINX Open Source](https://nginx.org/en/linux_packages.html#mainline) and [NGINX Plus](https://www.nginx.com/products/technical-specs/).
@@ -84,7 +102,7 @@ The NGINX config Ansible role supports all platforms supported by [NGINX Open So
84
102
85
103
## Role Variables
86
104
87
-
This role has multiple variables. The descriptions and defaults for all these variables can be found in the **[`defaults/main/`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/defaults/main/)** folder in the following files:
105
+
This role has multiple variables. The descriptions and defaults for all these variables can be found in the **[`defaults/main/`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/defaults/main/)** directory in the following files:
88
106
89
107
| Name | Description |
90
108
| ---- | ----------- |
@@ -95,16 +113,21 @@ This role has multiple variables. The descriptions and defaults for all these va
95
113
96
114
## Example Playbooks
97
115
98
-
Working functional playbook examples can be found in the **[`molecule/`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/)** folder in the following files:
116
+
Working functional playbook examples can be found in the **[`molecule/`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/)** directory in the following files:
99
117
100
118
| Name | Description |
101
119
| ---- | ----------- |
102
-
| **[`cleanup_module/converge.yml`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/cleanup_module/converge.yml)** | Cleanup an NGINX config and configure NGINX supported modules |
103
-
| **[`default/converge.yml`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/default/converge.yml)** | Use the NGINX config templating variables to create an NGINX config |
104
-
| **[`plus/converge.yml`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/plus/converge.yml)** | Use the NGINX config templating variables to create an NGINX Plus config |
105
-
| **[`push/converge.yml`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/push/converge.yml)** | Push a preexisting config from your system to your NGINX instance |
106
-
107
-
Do note that if you install this repository via Ansible Galaxy, you will have to replace the role variable in the sample playbooks from `ansible-role-nginx-config` to `nginxinc.nginx_config`.
120
+
| **[`api/converge.yml`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/api/converge.yml)** | Configure the NGINX Plus API and live metrics dashboard |
121
+
| **[`cleanup_config/converge.yml`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/cleanup_config/converge.yml)** | Cleanup an NGINX config |
122
+
| **[`complete/converge.yml`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/complete/converge.yml)** | Test all NGINX directives are correctly templated |
123
+
| **[`complete_plus/converge.yml`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/complete_plus/converge.yml)** | Test all NGINX Plus specific directives are correctly templated |
124
+
| **[`default/converge.yml`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/default/converge.yml)** | Configure NGINX with a config as close as possible to the default config |
125
+
| **[`push_config/converge.yml`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/push_config/converge.yml)** | Push a preexisting NGINX config from your system to your NGINX instance |
126
+
| **[`reverse_proxy/converge.yml`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/reverse_proxy/converge.yml)** | Configure NGINX as a reverse proxy between two web servers |
127
+
| **[`stub_status/converge.yml`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/stub_status/converge.yml)** | Configure the NGINX Open Source stub status metrics |
128
+
| **[`web_server/converge.yml`](https://github.com/nginxinc/ansible-role-nginx-config/blob/main/molecule/web_server/converge.yml)** | Configure NGINX as a web server |
129
+
130
+
**Note:** If you install this repository via Ansible Galaxy, you will need to replace the `include_role` variable in the example playbooks from `ansible-role-nginx-config` to `nginxinc.nginx_config`.
Copy file name to clipboardExpand all lines: defaults/main/template.yml
+2-2
Original file line number
Diff line number
Diff line change
@@ -21,7 +21,7 @@ nginx_config_main_template:
21
21
# - modules/ngx_http_js_module.so
22
22
user: # nginx # Can alternatively be set to a 'username' string
23
23
username: nginx # Required
24
-
group: nginx
24
+
#group: nginx
25
25
# worker_cpu_affinity:
26
26
# auto: true # Optional boolean
27
27
# cpumask: 0101 1010 # Optional if 'auto' is set to 'true'
@@ -37,7 +37,7 @@ nginx_config_main_template:
37
37
# - file: /var/log/nginx/error.log # Required
38
38
# level: notice
39
39
pid: /var/run/nginx.pid
40
-
daemon: true # Boolean
40
+
#daemon: true # Boolean
41
41
# debug_points: abort # Can be set to 'abort' or 'stop'
42
42
# env: # MALLOC_OPTIONS # String, a list of strings, a dictionary, or a list of dictionaries. The 'variable' variable is only required when setting a 'value'.
0 commit comments