From 2e7231edd1723e6da257370c45add932d681d781 Mon Sep 17 00:00:00 2001 From: Muhammed Hussein Karimi Date: Mon, 4 Apr 2022 06:16:59 +0430 Subject: [PATCH] making it functional when you have a minimal host --- ansible/playbook.yml | 13 +++++++------ ansible/roles/nginx/templates/nginx.conf | 2 +- ansible/roles/requirements/tasks/main.yml | 11 +++++++++++ ansible/roles/requirements/tasks/setup-Debian.yml | 9 +++++++++ ansible/roles/requirements/tasks/setup-RedHat.yml | 9 +++++++++ 5 files changed, 37 insertions(+), 7 deletions(-) create mode 100644 ansible/roles/requirements/tasks/main.yml create mode 100644 ansible/roles/requirements/tasks/setup-Debian.yml create mode 100644 ansible/roles/requirements/tasks/setup-RedHat.yml diff --git a/ansible/playbook.yml b/ansible/playbook.yml index e8b54b1ec..60140b7a4 100644 --- a/ansible/playbook.yml +++ b/ansible/playbook.yml @@ -3,16 +3,17 @@ vars: pip_install_packages: + - name: wheel + - name: pip + state: latest + - name: setuptools + - name: cffi - name: docker + - name: dockerpty docker_compose_version: "v2.0.1" - tasks: - - name: Ensure {{inventory_hostname}} is set as hostname - hostname: - name: "{{inventory_hostname}}" - tags: ["hostname"] - roles: + - {role: requirements, tags: ["docker", "requirements"]} - {role: geerlingguy.docker, tags: ["docker"]} - {role: geerlingguy.pip, tags: ["docker"]} - {role: nginx, tags: ["nginx"]} diff --git a/ansible/roles/nginx/templates/nginx.conf b/ansible/roles/nginx/templates/nginx.conf index 8f5e9312a..bc728aa9a 100644 --- a/ansible/roles/nginx/templates/nginx.conf +++ b/ansible/roles/nginx/templates/nginx.conf @@ -77,7 +77,7 @@ http { # location ~ (?.+)/$ { # return 302 https://$host$no_slash; # } - proxy_set_header X-Real-IP $remote_addr; + proxy_set_header X-Real-IP $remote_addr; proxy_set_header X-Forwarded-For $proxy_add_x_forwarded_for; proxy_pass http://uptime-kuma:3001/; proxy_http_version 1.1; diff --git a/ansible/roles/requirements/tasks/main.yml b/ansible/roles/requirements/tasks/main.yml new file mode 100644 index 000000000..f5e6ab7f0 --- /dev/null +++ b/ansible/roles/requirements/tasks/main.yml @@ -0,0 +1,11 @@ +--- +- name: Ensure {{inventory_hostname}} is set as hostname + hostname: + name: "{{inventory_hostname}}" + tags: ["hostname"] + +- include_tasks: setup-RedHat.yml + when: ansible_os_family == 'RedHat' + +- include_tasks: setup-Debian.yml + when: ansible_os_family == 'Debian' \ No newline at end of file diff --git a/ansible/roles/requirements/tasks/setup-Debian.yml b/ansible/roles/requirements/tasks/setup-Debian.yml new file mode 100644 index 000000000..25883c2fb --- /dev/null +++ b/ansible/roles/requirements/tasks/setup-Debian.yml @@ -0,0 +1,9 @@ +- name: Ensure packages for some requirements are installed + apt: + pkg: + - libffi-dev + - libzbar-dev + - libzbar0 + - python3-docopt + update_cache: yes + state: present \ No newline at end of file diff --git a/ansible/roles/requirements/tasks/setup-RedHat.yml b/ansible/roles/requirements/tasks/setup-RedHat.yml new file mode 100644 index 000000000..045f2b2de --- /dev/null +++ b/ansible/roles/requirements/tasks/setup-RedHat.yml @@ -0,0 +1,9 @@ +- name: Ensure packages for some requirements are installed + dnf: + name: + - libffi-devel + - zbar-devel + - zbar + - python3-docopt + update_cache: yes + state: present \ No newline at end of file