From 5af51ed535500395909bcf956a196183e98418ff Mon Sep 17 00:00:00 2001 From: Tim Unkrig Date: Fri, 10 May 2024 12:33:32 +0200 Subject: [PATCH] added role to repo --- LICENSE copy | 9 +++++++ defaults/main.yml | 2 ++ files/docker-compose.yaml.j2 | 22 +++++++++++++++++ handlers/main.yml | 2 ++ meta/.galaxy_install_info | 2 ++ meta/main.yml | 47 ++++++++++++++++++++++++++++++++++++ tasks/main.yml | 29 ++++++++++++++++++++++ tests/inventory | 2 ++ tests/test.yml | 5 ++++ vars/main.yml | 4 +++ 10 files changed, 124 insertions(+) create mode 100644 LICENSE copy create mode 100644 defaults/main.yml create mode 100644 files/docker-compose.yaml.j2 create mode 100644 handlers/main.yml create mode 100644 meta/.galaxy_install_info create mode 100644 meta/main.yml create mode 100644 tasks/main.yml create mode 100644 tests/inventory create mode 100644 tests/test.yml create mode 100644 vars/main.yml diff --git a/LICENSE copy b/LICENSE copy new file mode 100644 index 0000000..2ffcc8d --- /dev/null +++ b/LICENSE copy @@ -0,0 +1,9 @@ +MIT License + +Copyright (c) 2023 ansible-roles + +Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..9d263e3 --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,2 @@ +--- +# defaults file for haup.gitea diff --git a/files/docker-compose.yaml.j2 b/files/docker-compose.yaml.j2 new file mode 100644 index 0000000..9c4ec7a --- /dev/null +++ b/files/docker-compose.yaml.j2 @@ -0,0 +1,22 @@ +version: "3" +services: + app: + image: 'jc21/nginx-proxy-manager:latest' + restart: unless-stopped + ports: + - '80:80' + - '443:443' + - '8181:81' + # Add any other Stream poOrt you want to expose + - '2222:2222' # gitea SSH + environment: + X_FRAME_OPTIONS: "sameorigin" + DB_SQLITE_FILE: "/data/database.sqlite" + DISABLE_IPV6: "true" + volumes: + - {{ npm_app_dir }}:/data + - {{ letsencrypt_dir }}:/etc/letsencrypt + healthcheck: + test: ["CMD", "/bin/check-health"] + interval: 10s + timeout: 3s \ No newline at end of file diff --git a/handlers/main.yml b/handlers/main.yml new file mode 100644 index 0000000..c6fb973 --- /dev/null +++ b/handlers/main.yml @@ -0,0 +1,2 @@ +--- +# handlers file for haup.gitea diff --git a/meta/.galaxy_install_info b/meta/.galaxy_install_info new file mode 100644 index 0000000..797f145 --- /dev/null +++ b/meta/.galaxy_install_info @@ -0,0 +1,2 @@ +install_date: Mon Oct 23 14:05:36 2023 +version: '' diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..c4c064c --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,47 @@ +galaxy_info: + author: Tim Unkrig + description: docker install homelab + + # If the issue tracker for your role is not on github, uncomment the + # next line and provide a value + # issue_tracker_url: http://example.com/issue/tracker + + # Choose a valid license ID from https://spdx.org - some suggested licenses: + # - BSD-3-Clause (default) + # - MIT + # - GPL-2.0-or-later + # - GPL-3.0-only + # - Apache-2.0 + # - CC-BY-4.0 + license: license (GPL-2.0-or-later, MIT, etc) + + min_ansible_version: "2.8" + + # If this a Container Enabled role, provide the minimum Ansible Container version. + # min_ansible_container_version: + + # + # Provide a list of supported platforms, and for each platform a list of versions. + # If you don't wish to enumerate all versions for a particular platform, use 'all'. + # To view available platforms and versions (or releases), visit: + # https://galaxy.ansible.com/api/v1/platforms/ + # + platforms: + - name: Debian + versions: + - "bookworm" + - name: Ubuntu + versions: + - "jammy" + + galaxy_tags: [] + # List tags for your role here, one per line. A tag is a keyword that describes + # and categorizes the role. Users find roles by searching for tags. Be sure to + # remove the '[]' above, if you add tags to this list. + # + # NOTE: A tag is limited to a single word comprised of alphanumeric characters. + # Maximum 20 tags per role. + +dependencies: [] + # List your role dependencies here, one per line. Be sure to remove the '[]' above, + # if you add dependencies to this list. diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..7a50864 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,29 @@ +--- +# tasks file for pi-hole + +- name: Create npm-hole directory + ansible.builtin.file: + path: "{{ npm_app_dir }}" + state: directory + mode: '0755' + +- name: Create data directory + ansible.builtin.file: + path: "{{ npm_app_dir }}/data" + state: directory + mode: '0755' + +- name: Templating docker-compose.yml + ansible.builtin.template: + src: files/docker-compose.yaml.j2 + dest: "{{ npm_app_dir }}/docker-compose.yaml" + owner: root + group: root + mode: '0660' + validate: docker-compose config --quiet --file %s + backup: true + +- name: Start docker-compose + community.docker.docker_compose: + project_src: "{{ npm_app_dir }}" + state: present diff --git a/tests/inventory b/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/tests/test.yml b/tests/test.yml new file mode 100644 index 0000000..fd095ef --- /dev/null +++ b/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - haup.gitea diff --git a/vars/main.yml b/vars/main.yml new file mode 100644 index 0000000..1b7f17f --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,4 @@ +--- +# vars file for haup.gitea +npm_app_dir: "/srv/npm" +letsencrypt_dir: "/srv/npm/certs"