Fix ansible issues
This commit is contained in:
parent
ecd00fc75d
commit
872f545c64
6 changed files with 32 additions and 18 deletions
1
.envrc
Normal file
1
.envrc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
use nix
|
|
@ -10,23 +10,27 @@
|
||||||
path: "{{ service_path }}"
|
path: "{{ service_path }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
|
||||||
- name: Create a service-config directory for {{ svc.name }}
|
- name: Create a service-config directory for {{ svc.name }}
|
||||||
ansible.builtin.file:
|
ansible.builtin.file:
|
||||||
path: "{{ config_path }}"
|
path: "{{ config_path }}"
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0755"
|
mode: "0700"
|
||||||
|
|
||||||
- name: Template {{ svc.name }} docker-compose
|
- name: Template docker-compose for {{ svc.name }}
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: docker-compose.yml.j2
|
src: docker-compose.yml.j2
|
||||||
dest: "{{ (service_path, 'docker-compose.yml') | path_join }}"
|
dest: "{{ (service_path, 'docker-compose.yml') | path_join }}"
|
||||||
|
mode: "0644"
|
||||||
|
|
||||||
- name: Template {{ svc.name }} config
|
- name: Template config for {{ svc.name }}
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: config.cfg.j2
|
src: config.cfg.j2
|
||||||
dest: "{{ (config_path, 'config.cfg') | path_join }}"
|
dest: "{{ (config_path, 'config.cfg') | path_join }}"
|
||||||
|
mode: "0600"
|
||||||
|
|
||||||
- name: Template {{ svc.name }} caddy config
|
- name: Template caddy config for {{ svc.name }}
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: caddy_site.conf.j2
|
src: caddy_site.conf.j2
|
||||||
dest: "{{ (caddy_config_path, svc.domain + '.conf') | path_join }}"
|
dest: "{{ (caddy_config_path, svc.domain + '.conf') | path_join }}"
|
||||||
|
mode: "0644"
|
||||||
|
|
|
@ -16,8 +16,7 @@ svc:
|
||||||
compose:
|
compose:
|
||||||
watchtower: true
|
watchtower: true
|
||||||
image: joohoi/acme-dns
|
image: joohoi/acme-dns
|
||||||
|
file:
|
||||||
compose_file:
|
|
||||||
services:
|
services:
|
||||||
app:
|
app:
|
||||||
ports:
|
ports:
|
||||||
|
|
|
@ -12,17 +12,20 @@
|
||||||
state: directory
|
state: directory
|
||||||
mode: "0755"
|
mode: "0755"
|
||||||
|
|
||||||
- name: Template {{ svc.name }} docker-compose
|
- name: Template docker-compose for {{ svc.name }}
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: docker-compose.yml.j2
|
src: docker-compose.yml.j2
|
||||||
dest: "{{ (service_path, 'docker-compose.yml') | path_join }}"
|
dest: "{{ (service_path, 'docker-compose.yml') | path_join }}"
|
||||||
|
mode: "0644"
|
||||||
|
|
||||||
- name: Template {{ svc.name }} service.env file
|
- name: Template service.env file for {{ svc.name }}
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: service.env.j2
|
src: service.env.j2
|
||||||
dest: "{{ (service_path, 'service.env') | path_join }}"
|
dest: "{{ (service_path, 'service.env') | path_join }}"
|
||||||
|
mode: "0600"
|
||||||
|
|
||||||
- name: Template {{ svc.name }} caddy config
|
- name: Template caddy config for {{ svc.name }}
|
||||||
ansible.builtin.template:
|
ansible.builtin.template:
|
||||||
src: caddy_site.conf.j2
|
src: caddy_site.conf.j2
|
||||||
dest: "{{ (caddy_config_path, svc.domain + '.conf') | path_join }}"
|
dest: "{{ (caddy_config_path, svc.domain + '.conf') | path_join }}"
|
||||||
|
mode: "0644"
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
{% set compose_file = compose_file | default({}) %}
|
{% set compose_file = compose.file | default({}) %}
|
||||||
{% set compose_file = compose_default_file | combine(compose_file, recursive=True) %}
|
{% set compose_file = compose_default_file | combine(compose_file, recursive=True) %}
|
||||||
{% if compose.env | default(False) %}
|
{% if compose.env | default(False) %}
|
||||||
{% set compose_file = compose_file | combine(compose_env_file, recursive=True) %}
|
{% set compose_file = compose_file | combine(compose_env_file, recursive=True) %}
|
||||||
|
|
7
shell.nix
Normal file
7
shell.nix
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
with import <nixpkgs> {};
|
||||||
|
mkShell {
|
||||||
|
nativeBuildInputs = [
|
||||||
|
ansible
|
||||||
|
ansible-lint
|
||||||
|
];
|
||||||
|
}
|
Reference in a new issue