First version

This commit is contained in:
SebClem 2022-04-01 16:28:22 +02:00
parent 0ad07fa232
commit 3d3c16fe9d
No known key found for this signature in database
GPG Key ID: 3D8E353F900B1305
5 changed files with 35 additions and 5 deletions

3
ansible.cfg Normal file
View File

@ -0,0 +1,3 @@
[defaults]
roles_path = ../
stdout_callback = yaml

View File

@ -4,3 +4,5 @@
nginx_source_version: 1.21.6 nginx_source_version: 1.21.6
vts_repot_url: https://github.com/vozlt/nginx-module-vts.git vts_repot_url: https://github.com/vozlt/nginx-module-vts.git
nginx_module_install_path: "/usr/lib/nginx/modules"

View File

@ -3,7 +3,7 @@
- name: Download NGINX - name: Download NGINX
get_url: get_url:
url: "https://nginx.org/download/{{ nginx_source_version }}.tar.gz" url: "https://nginx.org/download/nginx-{{ nginx_source_version }}.tar.gz"
dest: "/tmp/{{ nginx_source_version }}.tar.gz" dest: "/tmp/{{ nginx_source_version }}.tar.gz"
mode: 0600 mode: 0600
register: nginx_source register: nginx_source
@ -12,10 +12,35 @@
unarchive: unarchive:
copy: false copy: false
dest: /tmp/ dest: /tmp/
src: "{{ nginx_source_version.dest }}" src: "{{ nginx_source.dest }}"
mode: 0755 mode: 0755
- name: Get vts - name: Get vts
ansible.builtin.git: ansible.builtin.git:
repo: "{{ vts_repot_url }}" repo: "{{ vts_repot_url }}"
dest: "/tmp/vts" dest: "/tmp/vts"
- name: Get build flags
ansible.builtin.command: "nginx -V"
register: command_result
- name: Clean flags
ansible.builtin.set_fact:
build_flags: "{{ command_result.stderr_lines | last | replace('configure arguments: ' ,'')}}"
- name: Configure build
args:
chdir: "/tmp/nginx-{{ nginx_source_version }}"
ansible.builtin.command: "./configure --add-dynamic-module=../vts {{ build_flags }}"
- name: Build module
community.general.make:
chdir: "/tmp/nginx-{{ nginx_source_version }}"
target: modules
- name: Copy VTS module
ansible.builtin.copy:
remote_src: True
src: "/tmp/nginx-{{ nginx_source_version }}/objs/ngx_http_vhost_traffic_status_module.so"
dest: "{{ nginx_module_install_path }}/ngx_http_vhost_traffic_status_module.so"
mode: "0644"

View File

@ -1,2 +1,2 @@
localhost nginx.home

View File

@ -1,5 +1,5 @@
--- ---
- hosts: localhost - hosts: nginx.home
remote_user: root remote_user: root
roles: roles:
- Ansible-Nginx-Vts-Role - ansible-nginx-vts-role