Skip to content

Commit

Permalink
fix test
Browse files Browse the repository at this point in the history
  • Loading branch information
netr0m committed Oct 25, 2023
1 parent 34239a1 commit fc6facd
Show file tree
Hide file tree
Showing 7 changed files with 43 additions and 22 deletions.
3 changes: 0 additions & 3 deletions .github/workflows/molecule.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,6 @@ jobs:
- name: 'Install dependencies'
run: pip3 install ansible molecule molecule-plugins[docker] docker requests

- name: 'List packages'
run: pip3 freeze

- name: 'Run molecule tests'
run: |
cd ${{ inputs.dirname }}
Expand Down
15 changes: 13 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -56,12 +56,12 @@ svc_traefik_acme_settings:
#### Extending Traefik
##### Adding additional middlewares
*See default middlewares in [vars/main.yml](vars/main.yml) under `svc_traefik_middlewares_default`.*
*See default middlewares in [vars/main.yml](vars/main.yml) under `svc_traefik_default_middlewares`.*

See the [Traefik Docs on HTTP Middlewares](https://doc.traefik.io/traefik/middlewares/http/overview/#available-http-middlewares) for details.

```yml
svc_traefik_middlewares:
svc_traefik_extra_middlewares:
my-custom-mwr:
headers:
customRequestHeaders:
Expand All @@ -71,6 +71,17 @@ svc_traefik_middlewares:
prefix: "/api"
```

##### Adding additional entryPoints
*See default entryPoints in [traefik.yml.j2](templates/etc/traefik/traefik.yml.j2)*

```yml
svc_traefik_extra_entrypoints:
- name: dns
port: 53
- name: dnsUdp
port: 53/udp
```

##### Adding additional hosts without using Docker container labels (also applies to non-Docker hosts and services on remote hosts)
```yml
svc_traefik_extra_hosts:
Expand Down
16 changes: 10 additions & 6 deletions defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,6 @@ svc_packages: []
# Pip packages to install
svc_packages_pip:
- 'docker'
- 'requests'

### Services ###
# Default restart policy
Expand Down Expand Up @@ -115,17 +114,22 @@ svc_traefik_extra_hosts: []
# protocol: https
# ip_addr: 10.10.10.10
# port: 8080
# Extra middlewares for Traefik. See templates/etc/traefik/config/http.yml
svc_traefik_middlewares: {}
# Extra middlewares for Traefik. See templates/etc/traefik/config/http.yml.j2
svc_traefik_extra_middlewares: {}
# example-mwr:

Check warning on line 119 in defaults/main.yml

View workflow job for this annotation

GitHub Actions / lint / Run linting (yamllint)

119:3 [comments-indentation] comment not indented like content
# headers:
# customRequestHeaders:
# Authorization: ''
# X-Forwarded-Proto: 'https'

# Extra certificates for Traefik. See templates/etc/traefik/traefik.yml
# Extra entrypoints for Traefik. See templates/etc/traefik/traefik.yml.j2
svc_traefik_extra_entrypoints: []
# - name: dns

Check warning on line 126 in defaults/main.yml

View workflow job for this annotation

GitHub Actions / lint / Run linting (yamllint)

126:3 [comments-indentation] comment not indented like content
# port: 53
# - name: dnsUdp
# port: 53/udp
# Extra certificates for Traefik. See templates/etc/traefik/traefik.yml.j2
# First entry in the list will be used as the default, if any
svc_traefik_certificates: []
svc_traefik_extra_certificates: []
# - crt: /etc/traefik/tls/domain.tld.crt

Check warning on line 133 in defaults/main.yml

View workflow job for this annotation

GitHub Actions / lint / Run linting (yamllint)

133:3 [comments-indentation] comment not indented like content
# key: /etc/traefik/tls/domain.tld.key

Expand Down
17 changes: 13 additions & 4 deletions docs/default-variables.md
Original file line number Diff line number Diff line change
Expand Up @@ -222,21 +222,30 @@ svc_traefik_extra_hosts: []
# ip_addr: 10.10.10.10
# port: 8080
```
### Extra middlewares for Traefik. See templates/etc/traefik/config/http.yml
### Extra middlewares for Traefik. See templates/etc/traefik/config/http.yml.j2

```yaml
svc_traefik_middlewares: {}
svc_traefik_extra_middlewares: {}
# example-mwr:
# headers:
# customRequestHeaders:
# Authorization: ''
# X-Forwarded-Proto: 'https'
```
### Extra certificates for Traefik. See templates/etc/traefik/traefik.yml
### Extra entrypoints for Traefik. See templates/etc/traefik/traefik.yml.j2

```yaml
svc_traefik_extra_entrypoints: []
# - name: dns
# port: 53
# - name: dnsUdp
# port: 53/udp
```
### Extra certificates for Traefik. See templates/etc/traefik/traefik.yml.j2
First entry in the list will be used as the default, if any

```yaml
svc_traefik_certificates: []
svc_traefik_extra_certificates: []
# - crt: /etc/traefik/tls/domain.tld.crt
# key: /etc/traefik/tls/domain.tld.key
```
Expand Down
2 changes: 1 addition & 1 deletion templates/etc/traefik/config/http.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ http:
- "*.{{ svc_domain }}"

{% endfor %}
middlewares: {{ svc_traefik_middlewares_default | combine(svc_traefik_middlewares | default({})) | combine(svc_traefik_middlewares_extra | default({})) }}
middlewares: {{ svc_traefik_default_middlewares | combine(svc_traefik_extra_middlewares | default({})) }}

services:
{% for service in svc_traefik_extra_hosts %}
Expand Down
10 changes: 5 additions & 5 deletions templates/etc/traefik/traefik.yml.j2
Original file line number Diff line number Diff line change
Expand Up @@ -74,16 +74,16 @@ certificatesResolvers:
- 1.1.1.1:53
- 1.0.0.1:53
{% endif %}
{% if svc_traefik_certificates | length > 0 %}
{% if svc_traefik_extra_certificates | length > 0 %}
tls:
stores:
default:
defaultCertificate:
certFile: {{ svc_traefik_certificates[0].crt }}
keyFile: {{ svc_traefik_certificates[0].key }}
{% if svc_traefik_certificates | length > 1 %}
certFile: {{ svc_traefik_extra_certificates[0].crt }}
keyFile: {{ svc_traefik_extra_certificates[0].key }}
{% if svc_traefik_extra_certificates | length > 1 %}
certificates:
{% for certificate in svc_traefik_certificates %}
{% for certificate in svc_traefik_extra_certificates %}
- certFile: {{ certificate.crt }}
keyFile: {{ certificate.key }}
{% endfor %}
Expand Down
2 changes: 1 addition & 1 deletion vars/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ svc_docker_network_name: "svc_net"
svc_traefik_letsencrypt_staging_server: https://acme-staging-v02.api.letsencrypt.org/directory

# Default middlewares for traefik
svc_traefik_middlewares_default:
svc_traefik_default_middlewares:
lan-mwr:
ipWhiteList:
sourceRange:
Expand Down

0 comments on commit fc6facd

Please sign in to comment.