Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
H
haproxy
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Terraform modules
Monitor
Service Desk
Analyze
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
FSI Ansible
haproxy
Commits
4cd3c96c
Verified
Commit
4cd3c96c
authored
1 year ago
by
Nicolas Lenz
Browse files
Options
Downloads
Patches
Plain Diff
add http-errors
parent
737c246e
No related branches found
No related tags found
No related merge requests found
Pipeline
#199111
failed
1 year ago
Stage: linting
Changes
4
Pipelines
1
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
README.md
+3
-0
3 additions, 0 deletions
README.md
tasks/configure.yml
+42
-0
42 additions, 0 deletions
tasks/configure.yml
templates/frontend.cfg
+5
-1
5 additions, 1 deletion
templates/frontend.cfg
templates/http-errors.cfg
+7
-0
7 additions, 0 deletions
templates/http-errors.cfg
with
57 additions
and
1 deletion
README.md
+
3
−
0
View file @
4cd3c96c
...
...
@@ -35,6 +35,9 @@ Role Variables
*
`haproxy_listen`
A list of listen proxies.
*
`haproxy_http_errors`
A list of http-errors sections containing errorfiles for various status codes.
Here is a complete list of variables:
```
...
...
This diff is collapsed.
Click to expand it.
tasks/configure.yml
+
42
−
0
View file @
4cd3c96c
...
...
@@ -99,6 +99,40 @@
loop
:
"
{{
haproxy_backends
}}"
when
:
haproxy_backends is defined
## ASSEMBLE CONFIG - HTTP-ERRORS
-
name
:
'
Create
directory
for
the
http-errors'
ansible.builtin.file
:
path
:
"
{{
haproxy_config_dir
}}/http-errors.d"
state
:
directory
owner
:
root
group
:
root
mode
:
0755
-
name
:
"
List
files
for
the
http-errors"
ansible.builtin.find
:
paths
:
"
{{
haproxy_config_dir
}}/http-errors.d"
patterns
:
"
*.cfg"
register
:
directory_contents
changed_when
:
false
-
name
:
"
Remove
unmanaged
files
for
the
http-errors"
ansible.builtin.file
:
path
:
"
{{
item.path
}}"
state
:
absent
when
:
(item.path | basename) not in (haproxy_http-errors | json_query('[*].name') | map('regex_replace', '(^.*$)', '\\1.cfg') | list)
loop
:
"
{{
directory_contents.files
}}"
-
name
:
'
Build
up
the
http-errors'
ansible.builtin.template
:
src
:
"
backend.cfg"
dest
:
"
{{
haproxy_config_dir
}}/http-errors.d/{{
item.name
}}.cfg"
owner
:
root
group
:
root
mode
:
0644
loop
:
"
{{
haproxy_http_errors
}}"
when
:
haproxy_http_errors is defined
## ASSEMBLE CONFIG - LISTEN
-
name
:
'
Create
directory
for
the
listen
sections'
...
...
@@ -236,6 +270,14 @@
group
:
root
mode
:
0644
-
name
:
'
Assemble
the
http-errors
configuration
file'
ansible.builtin.assemble
:
src
:
"
{{
haproxy_config_dir
}}/http-errors.d"
dest
:
"
{{
haproxy_config_dir
}}/compiled/07-http-errors.cfg"
owner
:
root
group
:
root
mode
:
0644
-
name
:
'
Assemble
the
final
configuration
file'
ansible.builtin.assemble
:
src
:
"
{{
haproxy_config_dir
}}/compiled"
...
...
This diff is collapsed.
Click to expand it.
templates/frontend.cfg
+
5
−
1
View file @
4cd3c96c
...
...
@@ -113,3 +113,7 @@ frontend {{ item.name }} {%if item.ip is defined %}{{ item.ip }}{% endif %}{%if
use_backend
{{
backend.name
}}
{{
backend.condition
}}
{%
endfor
-%}
{%
endif
-%}
{%-
if
item.errorfiles
-%}
errorfiles
{%
item.errorfiles
%}
{%
endif
%}
This diff is collapsed.
Click to expand it.
templates/http-errors.cfg
0 → 100644
+
7
−
0
View file @
4cd3c96c
{%-
import
'_macros.j2'
as
macros
with
context
-%}
#{{ ansible_managed }}
http-errors
{{
item.name
}}
{%
if
item.errorfiles
is
defined
%}
{%-
for
errorfile
in
item.errorfiles
-%}
errorfile
{{
errorfile.status
}}
{{
errorfile.file
}}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment