Skip to content

Commit

Permalink
use new container.
Browse files Browse the repository at this point in the history
  • Loading branch information
buluma committed Nov 18, 2023
1 parent 59b3811 commit 968643a
Show file tree
Hide file tree
Showing 5 changed files with 68 additions and 6 deletions.
1 change: 1 addition & 0 deletions .ansible-lint
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
# Ansible managed
#
exclude_paths:
- meta/preferences.yml
- molecule/default/prepare.yml
- molecule/default/converge.yml
- molecule/default/verify.yml
Expand Down
2 changes: 1 addition & 1 deletion .github/settings.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,4 @@
repository:
description: Install and configure haproxy on your system.
homepage: https://buluma.github.io/
topics: cloud, haproxy, ansible, molecule, tox, playbook
topics: cloud, haproxy, networking, ansible, molecule, tox, playbook
4 changes: 3 additions & 1 deletion .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ jobs:
config:
- image: "enterpriselinux"
tag: "8"
- image: "enterpriselinux"
tag: "latest"
- image: "debian-systemd"
tag: "latest"
- image: "debian-systemd"
Expand Down Expand Up @@ -70,7 +72,7 @@ jobs:
- name: parse apparmor for mysql
run: sudo apparmor_parser -R /etc/apparmor.d/usr.sbin.mysqld
- name: molecule
uses: buluma/molecule-action@v5.0.9
uses: buluma/molecule-action@v5.1.1
with:
image: ${{ matrix.config.image }}
tag: ${{ matrix.config.tag }}
4 changes: 3 additions & 1 deletion .gitlab-ci.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
---
image: "buluma/github-action-molecule:5.0.9"
image: "buluma/github-action-molecule:5.1.1"

variables:
PY_COLORS: 1
Expand All @@ -14,6 +14,8 @@ molecule:
matrix:
- image: "enterpriselinux"
tag: "8"
- image: "enterpriselinux"
tag: "latest"
- image: "debian-systemd"
tag: "latest"
- image: "debian-systemd"
Expand Down
63 changes: 60 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,13 @@ This example is taken from [`molecule/default/converge.yml`](https://github.com/
haproxy_backends:
- name: backend
httpcheck: yes
# You can tell how the health check must be done.
# This requires haproxy version 2
# http_check:
# send:
# method: GET
# uri: /health.html
# expect: status 200
balance: roundrobin
# You can refer to hosts in an Ansible group.
# The `ansible_default_ipv4` will be used as an address to connect to.
Expand All @@ -48,8 +55,8 @@ This example is taken from [`molecule/default/converge.yml`](https://github.com/
options:
- check
- name: smtp
httpcheck: yes
balance: roundrobin
balance: leastconn
mode: tcp
# You can also refer to a list of servers.
servers:
- name: first
Expand All @@ -59,8 +66,30 @@ This example is taken from [`molecule/default/converge.yml`](https://github.com/
address: "127.0.0.2"
port: 25
port: 25
- name: vault
mode: tcp
httpcheck: GET /v1/sys/health HTTP/1.1
servers: "{{ groups['all'] }}"
http_send_name_header: Host
port: 8200
options:
- check
- check-ssl
- ssl verify none

haproxy_listen_default_balance: roundrobin
haproxy_listens:
- name: listen
address: "*"
httpcheck: yes
listen_port: 8081
balance: roundrobin
# You can refer to hosts in an Ansible group.
# The `ansible_default_ipv4` will be used as an address to connect to.
servers: "{{ groups['all'] }}"
port: 8080
options:
- maxconn 100000
```
The machine needs to be prepared. In CI this is done using [`molecule/default/prepare.yml`](https://github.com/buluma/ansible-role-haproxy/blob/master/molecule/default/prepare.yml):
Expand All @@ -86,6 +115,24 @@ The machine needs to be prepared. In CI this is done using [`molecule/default/pr
# This role is applied to serve as a mock "backend" server. See `molecule/default/verify.yml`.
- role: buluma.httpd
httpd_port: 8080

vars:
_httpd_data_directory:
default: /var/www/html
Alpine: /var/www/localhost/htdocs
Suse: /srv/www/htdocs

httpd_data_directory: "{{ _httpd_data_directory[ansible_os_family] | default(_httpd_data_directory['default'] ) }}"
post_tasks:
- name: Place health check
ansible.builtin.copy:
content: 'ok'
dest: "{{ httpd_data_directory }}/health.html"

- name: Place sample page
ansible.builtin.copy:
content: 'Hello world!'
dest: "{{ httpd_data_directory }}/index.html"
```
Also see a [full explanation and example](https://buluma.github.io/how-to-use-these-roles.html) on how to use these roles.
Expand All @@ -101,6 +148,7 @@ The default values for the variables are set in [`defaults/main.yml`](https://gi
# Configure stats in HAProxy?
haproxy_stats: yes
haproxy_stats_port: 1936
haproxy_stats_bind_addr: "0.0.0.0"
# Default setttings for HAProxy.
haproxy_retries: 3
Expand All @@ -111,6 +159,15 @@ haproxy_timeout_server: 1m
haproxy_timeout_http_keep_alive: 10s
haproxy_timeout_check: 10s
haproxy_maxconn: 3000
# A list of frontends. See `molecule/
haproxy_frontends: []
haproxy_backend_default_balance: roundrobin
haproxy_backends: []

# For the listening lists:
haproxy_listen_default_balance: roundrobin
haproxy_listens: []
```
## [Requirements](#requirements)
Expand Down Expand Up @@ -145,7 +202,7 @@ This role has been tested on these [container images](https://hub.docker.com/u/b
|container|tags|
|---------|----|
|[EL](https://hub.docker.com/repository/docker/buluma/enterpriselinux/general)|8|
|[EL](https://hub.docker.com/repository/docker/buluma/enterpriselinux/general)|8, 9|
|[Debian](https://hub.docker.com/repository/docker/buluma/debian/general)|all|
|[Fedora](https://hub.docker.com/repository/docker/buluma/fedora/general)|all|
|[opensuse](https://hub.docker.com/repository/docker/buluma/opensuse/general)|all|
Expand Down

0 comments on commit 968643a

Please sign in to comment.