diff --git a/playbook/inventories/os_vars/archlinux.yml b/playbook/inventories/os_vars/archlinux.yml index 92be7b8..510aabb 100644 --- a/playbook/inventories/os_vars/archlinux.yml +++ b/playbook/inventories/os_vars/archlinux.yml @@ -85,7 +85,7 @@ postgresql_python3_psycopg: python3-psycopg2 ### NGINX packages nginx_pkg: nginx -nginx_version: 1.20.1 +nginx_version: 1.22.1 ### systemd systemd_dir: /usr/lib/systemd diff --git a/playbook/inventories/os_vars/centos-8.yml b/playbook/inventories/os_vars/centos-8.yml index 994da61..3b3d8c5 100644 --- a/playbook/inventories/os_vars/centos-8.yml +++ b/playbook/inventories/os_vars/centos-8.yml @@ -96,7 +96,7 @@ postgresql_python3_psycopg: python3-psycopg2 ### NGINX packages nginx_pkg: nginx -nginx_version: 1.20.1 +nginx_version: 1.22.1 ### systemd systemd_dir: /lib/systemd/system diff --git a/playbook/inventories/os_vars/centos-9.yml b/playbook/inventories/os_vars/centos-9.yml index 05bc8ac..aa52307 100644 --- a/playbook/inventories/os_vars/centos-9.yml +++ b/playbook/inventories/os_vars/centos-9.yml @@ -96,7 +96,7 @@ postgresql_python3_psycopg: python3-psycopg2 ### NGINX packages nginx_pkg: nginx -nginx_version: 1.20.1 +nginx_version: 1.22.1 ### systemd systemd_dir: /lib/systemd/system diff --git a/playbook/inventories/os_vars/debian-12.yml b/playbook/inventories/os_vars/debian-12.yml index 4daca16..d634cb0 100644 --- a/playbook/inventories/os_vars/debian-12.yml +++ b/playbook/inventories/os_vars/debian-12.yml @@ -92,7 +92,7 @@ postgresql_python3_psycopg: python3-psycopg2 ### NGINX packages nginx_pkg: nginx -nginx_version: 1.20.1 +nginx_version: 1.22.1 ### systemd systemd_dir: /lib/systemd/system diff --git a/playbook/inventories/os_vars/redhat-8.yml b/playbook/inventories/os_vars/redhat-8.yml index 9ebcfd6..e958a80 100644 --- a/playbook/inventories/os_vars/redhat-8.yml +++ b/playbook/inventories/os_vars/redhat-8.yml @@ -96,7 +96,7 @@ postgresql_python3_psycopg: python3-psycopg2 ### NGINX packages nginx_pkg: nginx -nginx_version: 1.20.1 +nginx_version: 1.22.1 ### systemd systemd_dir: /lib/systemd/system diff --git a/playbook/inventories/os_vars/redhat-9.yml b/playbook/inventories/os_vars/redhat-9.yml index 35c993f..f217f23 100644 --- a/playbook/inventories/os_vars/redhat-9.yml +++ b/playbook/inventories/os_vars/redhat-9.yml @@ -96,7 +96,7 @@ postgresql_python3_psycopg: python3-psycopg2 ### NGINX packages nginx_pkg: nginx -nginx_version: 1.20.1 +nginx_version: 1.22.1 ### systemd systemd_dir: /lib/systemd/system diff --git a/playbook/inventories/production/hosts.ini b/playbook/inventories/production/hosts.ini index 33defe8..965e218 100644 --- a/playbook/inventories/production/hosts.ini +++ b/playbook/inventories/production/hosts.ini @@ -1,2 +1,2 @@ [ckan_servers] -production_01 ansible_host=192.168.68.01 ansible_user=sudouser ansible_port=222 ansible_ssh_pass=sudouserpassword ansible_connection=ssh \ No newline at end of file +production_01 ansible_connection=local \ No newline at end of file diff --git a/playbook/roles/webserver/tasks/nginx.yml b/playbook/roles/webserver/tasks/nginx.yml index 80b02d1..d9b4781 100644 --- a/playbook/roles/webserver/tasks/nginx.yml +++ b/playbook/roles/webserver/tasks/nginx.yml @@ -1,23 +1,29 @@ +- name: Check if NGINX is installed + command: nginx -v + register: nginx_installed + failed_when: false + changed_when: false + - name: "Install NGINX {{ nginx_version }} (RHEL/CentOS >= 8)" dnf: name: "nginx-{{ nginx_version }}" state: present update_cache: true - when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 8 + when: ansible_os_family == "RedHat" and ansible_distribution_major_version|int >= 8 and nginx_installed.rc != 0 - name: "Install NGINX {{ nginx_version }} (Debian/Ubuntu)" apt: name: "nginx={{ nginx_version }}" state: present update_cache: true - when: ansible_os_family == "Debian" + when: ansible_os_family == "Debian" and nginx_installed.rc != 0 - name: "Install NGINX {{ nginx_version }} (Arch Linux)" pacman: name: "nginx={{ nginx_version }}" state: present update_cache: true - when: ansible_os_family == "Archlinux" + when: ansible_os_family == "Archlinux" and nginx_installed.rc != 0 - name: Copy nginx config file template: