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..9016f72 --- /dev/null +++ b/files/docker-compose.yaml.j2 @@ -0,0 +1,24 @@ +version: "3" + +# More info at https://github.com/pi-hole/docker-pi-hole/ and https://docs.pi-hole.net/ +services: + pihole: + container_name: pihole + image: pihole/pihole:latest + # For DHCP it is recommended to remove these ports and instead add: network_mode: "host" + ports: + - "53:53/tcp" + - "53:53/udp" + - "67:67/udp" # Only required if you are using Pi-hole as your DHCP server + - "81:80/tcp" + environment: + TZ: 'Europe/Berlin' + WEBPASSWORD: 'supersecure' + # Volumes store your data between container upgrades + volumes: + - '{{ app_dir }}/data/etc-pihole:/etc/pihole' + - '{{ app_dir }}/data/etc-dnsmasq.d:/etc/dnsmasq.d' + # https://github.com/pi-hole/docker-pi-hole#note-on-capabilities + cap_add: + - NET_ADMIN # Required if you are using Pi-hole as your DHCP server, else not needed + restart: unless-stopped 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..3b2f509 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,47 @@ +galaxy_info: + author: Tim Unkrig + description: 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: "MIT" + + 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..be27d76 --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,29 @@ +--- +# tasks file for pi-hole + +- name: Create pi-hole directory + ansible.builtin.file: + path: "{{ app_dir }}" + state: directory + mode: '0755' + +- name: Create data directory + ansible.builtin.file: + path: "{{ app_dir }}/data" + state: directory + mode: '0755' + +- name: Templating docker-compose.yml + ansible.builtin.template: + src: files/docker-compose.yaml.j2 + dest: "{{ 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: "{{ 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..d502315 --- /dev/null +++ b/vars/main.yml @@ -0,0 +1,3 @@ +--- +# vars file for haup.gitea +app_dir: "/srv/pi-hole" \ No newline at end of file