From 0fd16bdd1efe4e8258337e05d1cb634c1155755b Mon Sep 17 00:00:00 2001 From: Emilien Mantel Date: Wed, 31 May 2023 09:04:30 +0200 Subject: [PATCH] :rocket: Manage Ubuntu --- README.md | 5 ++++- meta/main.yml | 5 +++++ molecule/_shared/prepare.yml | 2 +- molecule/_shared/vars/misc.yml | 2 +- tasks/install/Debian.yml | 2 +- tasks/install/main.yml | 2 +- tests/group_vars/all.yml | 2 +- tests/test.yml | 4 ++-- 8 files changed, 16 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index f4053d0..740fe50 100644 --- a/README.md +++ b/README.md @@ -26,9 +26,12 @@ Supported OS: | Debian Stretch (9) | Yes | Check latest supported version ([1.9.0](https://github.com/HanXHX/ansible-nginx/releases/tag/1.9.0)) | | Debian Buster (10) | Yes | Yes | | Debian Bullseye (11) | Yes | Yes | -| Debian Bookworm (12) | Yes | No | +| Debian Bookworm (12) | Yes | Not yet :) | | FreeBSD 11 | NA | No | | FreeBSD 12 | NA | No | +| Ubuntu 18.04 | Yes | Yes | +| Ubuntu 20.04 | Yes | Yes | +| Ubuntu 22.04 | Yes | Yes | Requirements ------------ diff --git a/meta/main.yml b/meta/main.yml index ba077fb..57d4d68 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -14,6 +14,11 @@ galaxy_info: - buster - bullseye - bookworm + - name: Ubuntu + versions: + - bionic + - focal + - jammy - name: FreeBSD versions: - '11.0' diff --git a/molecule/_shared/prepare.yml b/molecule/_shared/prepare.yml index 2ee9e0e..01d50cc 100644 --- a/molecule/_shared/prepare.yml +++ b/molecule/_shared/prepare.yml @@ -9,7 +9,7 @@ tasks: - name: INCLUDE_TASKS | Pre tasks related to OS - ansible.builtin.include_tasks: "../../tests/includes/pre_{{ ansible_distribution }}.yml" + ansible.builtin.include_tasks: "../../tests/includes/pre_{{ ansible_os_family }}.yml" - name: INCLUDE_TASKS | Pre_tasks common ansible.builtin.include_tasks: "../../tests/includes/pre_common.yml" diff --git a/molecule/_shared/vars/misc.yml b/molecule/_shared/vars/misc.yml index baecfc6..3cbe715 100644 --- a/molecule/_shared/vars/misc.yml +++ b/molecule/_shared/vars/misc.yml @@ -111,7 +111,7 @@ nginx_ssl_pairs: nginx_custom_http: - 'add_header X-ansible 1;' - - 'geoip_country {% if ansible_distribution == "Debian" %}/usr/share/GeoIP/GeoIP.dat{% else %}/usr/local/share/GeoIP/GeoIP.dat{% endif %};' + - 'geoip_country {% if ansible_os_family == "Debian" %}/usr/share/GeoIP/GeoIP.dat{% else %}/usr/local/share/GeoIP/GeoIP.dat{% endif %};' - 'map $geoip_country_code $allowed_country {' - ' default yes;' - ' MA no;' diff --git a/tasks/install/Debian.yml b/tasks/install/Debian.yml index a42ee00..c62c5ef 100644 --- a/tasks/install/Debian.yml +++ b/tasks/install/Debian.yml @@ -14,7 +14,7 @@ - name: APT | Install nginx and dependencies ansible.builtin.apt: pkg: "{{ nginx_apt_package }}" - default_release: "{{ ansible_distribution_release + '-backports' if nginx_backports else ansible_distribution_release }}" + default_release: "{{ ansible_distribution_release + '-backports' if (nginx_backports and ansible_distribution == 'Debian') else ansible_distribution_release }}" - name: APT | Install nginx modules ansible.builtin.apt: diff --git a/tasks/install/main.yml b/tasks/install/main.yml index 4c3c3fd..74d9cd3 100644 --- a/tasks/install/main.yml +++ b/tasks/install/main.yml @@ -1,7 +1,7 @@ --- - name: INCLUDE_TASKS | Install - ansible.builtin.include_tasks: "{{ ansible_distribution }}.yml" + ansible.builtin.include_tasks: "{{ ansible_os_family }}.yml" - name: IMPORT_TASKS | acme ansible.builtin.import_tasks: "acme.yml" diff --git a/tests/group_vars/all.yml b/tests/group_vars/all.yml index c7cc678..504657e 100644 --- a/tests/group_vars/all.yml +++ b/tests/group_vars/all.yml @@ -104,7 +104,7 @@ nginx_ssl_pairs: nginx_custom_http: - 'add_header X-ansible 1;' - - 'geoip_country {% if ansible_distribution == "Debian" %}/usr/share/GeoIP/GeoIP.dat{% else %}/usr/local/share/GeoIP/GeoIP.dat{% endif %};' + - 'geoip_country {% if ansible_os_family == "Debian" %}/usr/share/GeoIP/GeoIP.dat{% else %}/usr/local/share/GeoIP/GeoIP.dat{% endif %};' - 'map $geoip_country_code $allowed_country {' - ' default yes;' - ' MA no;' diff --git a/tests/test.yml b/tests/test.yml index aa0891d..f733884 100644 --- a/tests/test.yml +++ b/tests/test.yml @@ -4,7 +4,7 @@ hosts: all pre_tasks: - name: INCLUDE_TASKS | Pre_tasks related to OS version - ansible.builtin.include_tasks: "includes/pre_{{ ansible_distribution }}.yml" + ansible.builtin.include_tasks: "includes/pre_{{ ansible_os_family }}.yml" - name: IMPORT_TASKS | Pre_tasks common ansible.builtin.import_tasks: "includes/pre_common.yml" @@ -14,7 +14,7 @@ post_tasks: - name: INCLUDE_TASKS | Post_tasks related to OS version - ansible.builtin.include_tasks: "includes/post_{{ ansible_distribution }}.yml" + ansible.builtin.include_tasks: "includes/post_{{ ansible_os_family }}.yml" - name: IMPORT_TASKS | Post_tasks common ansible.builtin.import_tasks: "includes/post_common.yml"