diff --git a/roles/os_update/meta/argument_specs.yml b/roles/os_update/meta/argument_specs.yml new file mode 100644 index 0000000..85a4c03 --- /dev/null +++ b/roles/os_update/meta/argument_specs.yml @@ -0,0 +1,6 @@ +--- +argument_specs: + # roles/myapp/tasks/main.yml entry point + main: + short_description: Update all OS packages. + options: {} diff --git a/roles/os_update/meta/main.yml b/roles/os_update/meta/main.yml index b46e858..7c2f6f1 100644 --- a/roles/os_update/meta/main.yml +++ b/roles/os_update/meta/main.yml @@ -41,18 +41,6 @@ galaxy_info: version: - any - - # - name: Fedora - # versions: - # - all - # - 25 - # - name: SomePlatform - # versions: - # - all - # - 1.0 - # - 7 - # - 99.99 - 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 diff --git a/roles/radicale/README.md b/roles/radicale/README.md new file mode 100644 index 0000000..de0d35d --- /dev/null +++ b/roles/radicale/README.md @@ -0,0 +1,2 @@ +# radicale +Build a radicale docker image and run a radicale docker container. diff --git a/roles/radicale/files/Dockerfile b/roles/radicale/files/Dockerfile new file mode 100644 index 0000000..42deaeb --- /dev/null +++ b/roles/radicale/files/Dockerfile @@ -0,0 +1,13 @@ +FROM alpine + +RUN apk add --no-cache curl bash python3 py3-pip \ + && pip3 install 'radicale<3' passlib + +COPY radicale.conf /radicale.conf + +EXPOSE 5232/tcp +VOLUME ["/data"] + +CMD radicale -C /radicale.conf + +HEALTHCHECK CMD curl -f -L http://localhost:5232/ || exit 1 diff --git a/roles/radicale/files/radicale.conf b/roles/radicale/files/radicale.conf new file mode 100644 index 0000000..45586e8 --- /dev/null +++ b/roles/radicale/files/radicale.conf @@ -0,0 +1,27 @@ +[server] +hosts = 0.0.0.0:5232 +ssl = False +dns_lookup = False +realm = Password Required + +[encoding] +request = utf-8 +stock = utf-8 + +[auth] +type = htpasswd +htpasswd_filename = /data/users +htpasswd_encryption = md5 + +[rights] +type = owner_only + +[storage] +type = multifilesystem +filesystem_folder = /data/collections + +[logging] +#level=debug +debug=true + +[headers] diff --git a/roles/radicale/meta/argument_specs.yml b/roles/radicale/meta/argument_specs.yml new file mode 100644 index 0000000..ee38a4d --- /dev/null +++ b/roles/radicale/meta/argument_specs.yml @@ -0,0 +1,12 @@ +--- +argument_specs: + # roles/myapp/tasks/main.yml entry point + main: + short_description: Build a radicale docker image and run a radicale docker container. + options: {} + build: + short_description: Build a radicale docker image + options: {} + run: + short_description: Run a radicale docker container + options: {} diff --git a/roles/radicale/meta/main.yml b/roles/radicale/meta/main.yml new file mode 100644 index 0000000..53ad9b6 --- /dev/null +++ b/roles/radicale/meta/main.yml @@ -0,0 +1,40 @@ +galaxy_info: + author: Frank Adaemmer + description: Build and run a radicale container + + # 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: GPL-3.0-or-later + + min_ansible_version: '2.9' + + # 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: GenericLinux + version: + - any + + galaxy_tags: [docker] + # 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. diff --git a/roles/radicale/tasks/build.yml b/roles/radicale/tasks/build.yml new file mode 100644 index 0000000..e55aff1 --- /dev/null +++ b/roles/radicale/tasks/build.yml @@ -0,0 +1,17 @@ +--- +- name: Build radicale image + community.docker.docker_image: + name: radicale + tag: latest + build: + path: "{{ radicale_build_path | default('/srv/radicale') }}" + pull: true + nocache: "{{ force_recreate | default(false) }}" + source: build + force_source: true + state: present + become: true + register: imagebuild + retries: 3 + delay: 60 + until: imagebuild is not failed diff --git a/roles/radicale/tasks/main.yml b/roles/radicale/tasks/main.yml new file mode 100644 index 0000000..b50e295 --- /dev/null +++ b/roles/radicale/tasks/main.yml @@ -0,0 +1,7 @@ +--- +# tasks file for radicale +- name: Build radicale image + ansible.builtin.import_tasks: build.yml + +- name: Create radicale + ansible.builtin.import_tasks: run.yml diff --git a/roles/radicale/tasks/run.yml b/roles/radicale/tasks/run.yml new file mode 100644 index 0000000..0e53025 --- /dev/null +++ b/roles/radicale/tasks/run.yml @@ -0,0 +1,25 @@ +--- +- name: Create radicale + community.docker.docker_container: + name: radicale + detach: true + image: radicale + labels: + com.centurylinklabs.watchtower.enable: 'true' + networks: + - name: webnet + network_mode: default + recreate: "{{ imagebuild.changed or (force_recreate | default(false)) }}" + comparisons: + image: strict + env: strict + volumes: strict + restart_policy: always + state: started + volumes: + - "{{ radicale_data_volume | default('radicale') }}:/data" + become: true + retries: 3 + delay: 60 + until: current_task is not failed + register: current_task diff --git a/roles/radicale/tests/inventory b/roles/radicale/tests/inventory new file mode 100644 index 0000000..878877b --- /dev/null +++ b/roles/radicale/tests/inventory @@ -0,0 +1,2 @@ +localhost + diff --git a/roles/radicale/tests/test.yml b/roles/radicale/tests/test.yml new file mode 100644 index 0000000..eb88423 --- /dev/null +++ b/roles/radicale/tests/test.yml @@ -0,0 +1,5 @@ +--- +- hosts: localhost + remote_user: root + roles: + - radicale