From a355ee21c15e915f394952abe76703d7865c991b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Romain=20Gon=C3=A7alves?= Date: Sun, 12 May 2024 17:32:53 +0200 Subject: feat(roles/httpd_pre): add httpd_pre role --- roles/httpd/meta/main.yml | 25 ++++++++++++++++++++++++ roles/httpd_pre/defaults/main.yml | 14 +++++++++++++ roles/httpd_pre/meta/main.yml | 41 +++++++++++++++++++++++++++++++++++++++ roles/httpd_pre/tasks/main.yml | 25 ++++++++++++++++++++++++ 4 files changed, 105 insertions(+) create mode 100644 roles/httpd/meta/main.yml create mode 100644 roles/httpd_pre/defaults/main.yml create mode 100644 roles/httpd_pre/meta/main.yml create mode 100644 roles/httpd_pre/tasks/main.yml diff --git a/roles/httpd/meta/main.yml b/roles/httpd/meta/main.yml new file mode 100644 index 0000000..c2fc9b3 --- /dev/null +++ b/roles/httpd/meta/main.yml @@ -0,0 +1,25 @@ +--- + +dependencies: + - role: httpd_pre + +argument_specs: + main: + short_description: httpd main entry point. + options: + + httpd__supported_types: + type: list + elements: str + required: true + description: Supported MIME types + + httpd__log_format: + type: str + required: true + choices: + - combined + - common + - connection + - forwarded + description: Network protocol diff --git a/roles/httpd_pre/defaults/main.yml b/roles/httpd_pre/defaults/main.yml new file mode 100644 index 0000000..dfda874 --- /dev/null +++ b/roles/httpd_pre/defaults/main.yml @@ -0,0 +1,14 @@ +--- + +httpd_pre__configuration_file: /etc/httpd.conf +httpd_pre__configuration_dir: /etc/httpd.d +httpd_pre__chroot_dir: /var/www + +httpd_pre__chroot_passwords_dir: /htpasswd +httpd_pre__chroot_sites_dir: /htdocs + +httpd_pre__passwords_dir: "{{ httpd_pre__chroot_dir }}{{ httpd_pre__chroot_passwords_dir }}" +httpd_pre__sites_dir: "{{ httpd_pre__chroot_dir }}{{ httpd_pre__chroot_sites_dir }}" + +httpd_pre__user: www +httpd_pre__group: www diff --git a/roles/httpd_pre/meta/main.yml b/roles/httpd_pre/meta/main.yml new file mode 100644 index 0000000..df8fb89 --- /dev/null +++ b/roles/httpd_pre/meta/main.yml @@ -0,0 +1,41 @@ +--- + +argument_specs: + main: + short_description: httpd_pre main entrypoint. + options: + + httpd_pre__configuration_file: + type: path + required: true + description: Configuration file + + httpd_pre__configuration_dir: + type: path + required: true + description: Configuration directory + + httpd_pre__chroot_dir: + type: path + required: true + description: Chroot directory + + httpd_pre__passwords_dir: + type: path + required: true + description: Passwords directory + + httpd_pre__sites_dir: + type: path + required: true + description: Sites directory + + httpd_pre__user: + type: str + required: true + description: User + + httpd_pre__group: + type: str + required: true + description: Group diff --git a/roles/httpd_pre/tasks/main.yml b/roles/httpd_pre/tasks/main.yml new file mode 100644 index 0000000..d1760db --- /dev/null +++ b/roles/httpd_pre/tasks/main.yml @@ -0,0 +1,25 @@ +--- + +- name: create httpd directory + ansible.builtin.file: + path: "{{ httpd_pre__configuration_dir }}" + state: directory + owner: 0 + group: 0 + mode: "0644" + +- name: create passwords directory + ansible.builtin.file: + path: "{{ httpd_pre__passwords_dir }}" + state: directory + owner: "{{ httpd_pre__user }}" + group: "{{ httpd_pre__group }}" + mode: "0700" + +- name: create sites directory + ansible.builtin.file: + path: "{{ httpd_pre__sites_dir }}" + state: directory + owner: 0 + group: 0 + mode: "0755" -- cgit v1.2.3