diff --git a/playbook.yml b/playbook.yml index a0add139..f9f5cbc9 100644 --- a/playbook.yml +++ b/playbook.yml @@ -112,3 +112,11 @@ vars: domain: "elk.{{top_domain}}" http_port: 8008 +- name: setup akounting hosts + hosts: akounting_hosts + become: true + roles: + - role: docker-akounting + vars: + domain: akounting.{{top_domain}} + http_port: 8080 diff --git a/roles/docker-akounting/handlers/main.yml b/roles/docker-akounting/handlers/main.yml new file mode 100644 index 00000000..f3308d40 --- /dev/null +++ b/roles/docker-akounting/handlers/main.yml @@ -0,0 +1,7 @@ +--- +- name: setup akounting + command: + cmd: docker-compose up -d + chdir: /home/administrator/docker-compose/akounting/ + environment: + AKAUNTING_SETUP: true diff --git a/roles/docker-akounting/meta/main.yml b/roles/docker-akounting/meta/main.yml new file mode 100644 index 00000000..fb4d4f7b --- /dev/null +++ b/roles/docker-akounting/meta/main.yml @@ -0,0 +1,2 @@ +dependencies: +- native-docker-reverse-proxy diff --git a/roles/docker-akounting/tasks/main.yml b/roles/docker-akounting/tasks/main.yml new file mode 100644 index 00000000..73fae9e6 --- /dev/null +++ b/roles/docker-akounting/tasks/main.yml @@ -0,0 +1,21 @@ +--- +- name: recieve {{domain}} certificate + command: certbot certonly --agree-tos --email {{administrator_email}} --non-interactive --webroot -w /var/lib/letsencrypt/ -d {{domain}} + +- name: configure {{domain}}.conf + template: src=roles/native-docker-reverse-proxy/templates/domain.conf.j2 dest=/etc/nginx/conf.d/{{domain}}.conf + notify: restart nginx + +- name: pull docker repository + git: + repo: "https://github.com/akaunting/docker.git" + dest: "/home/administrator/docker-compose/akaunting/" + update: yes + +- name: configure db.env + template: src=db.env.j2 dest=/home/administrator/docker-compose/akaunting/env/db.env + notify: setup akounting + +- name: configure run.env + template: src=run.env.j2 dest=/home/administrator/docker-compose/akaunting/env/run.env + notify: setup akounting diff --git a/roles/docker-akounting/templates/db.env.j2 b/roles/docker-akounting/templates/db.env.j2 new file mode 100644 index 00000000..6212d9e9 --- /dev/null +++ b/roles/docker-akounting/templates/db.env.j2 @@ -0,0 +1,9 @@ +# These could be changed +MYSQL_DATABASE=akaunting +MYSQL_USER=admin + +# This should definitely be changed to something long and random +MYSQL_PASSWORD={{akaunting_database_password}} + +# You should probably leave this +MYSQL_RANDOM_ROOT_PASSWORD=yes diff --git a/roles/docker-akounting/templates/run.env.j2 b/roles/docker-akounting/templates/run.env.j2 new file mode 100644 index 00000000..afe5aaa0 --- /dev/null +++ b/roles/docker-akounting/templates/run.env.j2 @@ -0,0 +1,22 @@ +# You should change this to match your reverse proxy DNS name and protocol +APP_URL=https://akaunting.example.com +LOCALE=en-US + +# Don't change this unless you rename your database container or use rootless podman, in case of using rootless podman you should set it to 127.0.0.1 (NOT localhost) +DB_HOST=akaunting-db + +# Change these to match env/db.env +DB_DATABASE=akaunting +DB_USERNAME=admin +DB_PASSWORD={{akaunting_database_password}} + +# You should change this to a random string of three numbers or letters followed by an underscore +DB_PREFIX=asd_ + +# These define the first company to exist on this instance. They are only used during setup. +COMPANY_NAME={{akaunting_company_name}} +COMPANY_EMAIL={{akaunting_company_email}} + +# This will be the first administrative user created on setup. +ADMIN_EMAIL={{akaunting_admin_email}} +ADMIN_PASSWORD={{akaunting_setup_admin_password}}