Initial commit
This commit is contained in:
commit
f5f2981b53
4 changed files with 42 additions and 0 deletions
5
handlers/main.yml
Normal file
5
handlers/main.yml
Normal file
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- name: reload caddy
|
||||
service:
|
||||
name: caddy
|
||||
state: restarted
|
18
meta/main.yml
Normal file
18
meta/main.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
|
||||
dependencies: []
|
||||
|
||||
galaxy_info:
|
||||
role_name: caddy-config-svc
|
||||
author: 'Pierre-Olivier Mercier <nemunaire+iac@nemunai.re>'
|
||||
description: Abstraction to configure caddy server
|
||||
license: GPL-3.0-or-later
|
||||
min_ansible_version: 2.9
|
||||
platforms:
|
||||
- name: Alpine
|
||||
versions:
|
||||
- all
|
||||
- name: Debian
|
||||
versions:
|
||||
- all
|
||||
galaxy_tags: []
|
18
tasks/main.yml
Normal file
18
tasks/main.yml
Normal file
|
@ -0,0 +1,18 @@
|
|||
---
|
||||
- name: check if the config already exists
|
||||
ansible.builtin.stat:
|
||||
path: "/etc/caddy/sites-enabled/{{ instance_name | default(ansible_play_name) }}"
|
||||
get_mime: false
|
||||
get_checksum: false
|
||||
get_attributes: false
|
||||
when: onlyifnotexist is defined and onlyifnotexist
|
||||
register: cnf
|
||||
|
||||
- name: configure caddy for {{ instance_name | default(ansible_play_name) }}
|
||||
template:
|
||||
src: caddy.j2
|
||||
dest: "/etc/caddy/sites-enabled/{{ instance_name | default(ansible_play_name) }}"
|
||||
mode: 0644
|
||||
when: onlyifnotexist is not defined or not onlyifnotexist or not cnf.stat.exists
|
||||
notify:
|
||||
- reload nginx
|
1
templates/caddy.j2
Normal file
1
templates/caddy.j2
Normal file
|
@ -0,0 +1 @@
|
|||
{{ server }}
|
Loading…
Add table
Add a link
Reference in a new issue