diff --git a/roles/timetracking-bot/handlers/main.yml b/roles/timetracking-bot/handlers/main.yml deleted file mode 100644 index 4a8cc64..0000000 --- a/roles/timetracking-bot/handlers/main.yml +++ /dev/null @@ -1,7 +0,0 @@ ---- -# handlers file for timetracking-bot - - name: restart timetracking-bot - docker_container: - name: "timetracking-bot" - state: started - restart: yes diff --git a/roles/timetracking-bot/README.md b/roles/timetracking_bot/README.md similarity index 100% rename from roles/timetracking-bot/README.md rename to roles/timetracking_bot/README.md diff --git a/roles/timetracking-bot/defaults/main.yml b/roles/timetracking_bot/defaults/main.yml similarity index 84% rename from roles/timetracking-bot/defaults/main.yml rename to roles/timetracking_bot/defaults/main.yml index 71420d3..f20662f 100644 --- a/roles/timetracking-bot/defaults/main.yml +++ b/roles/timetracking_bot/defaults/main.yml @@ -14,7 +14,12 @@ timetracking_bot_pg_db: "matrix-timetracking" timetracking_bot_version: "0.4.4" timetracking_bot_container_image_tag: ~ timetracking_bot_container_image: "registry.gitlab.com/famedly/bots/timetracking" -timetracking_bot_container_image_ref: '{{ timetracking_bot_container_image }}:{{ timetracking_bot_container_image_tag | default("v" + timetracking_bot_version, true) }}' +timetracking_bot_container_image_ref: >- + {{ + timetracking_bot_container_image + ~ ':' + ~ timetracking_bot_container_image_tag | default("v" + timetracking_bot_version, true) + }} timetracking_bot_docker_ports: [] timetracking_bot_docker_env: {} diff --git a/roles/timetracking_bot/handlers/main.yml b/roles/timetracking_bot/handlers/main.yml new file mode 100644 index 0000000..d6402ca --- /dev/null +++ b/roles/timetracking_bot/handlers/main.yml @@ -0,0 +1,8 @@ +--- +# handlers file for timetracking-bot +- name: Restart timetracking-bot + community.docker.docker_container: + name: "timetracking-bot" + state: started + restart: true + listen: restart-timetracking-bot diff --git a/roles/timetracking-bot/meta/main.yml b/roles/timetracking_bot/meta/main.yml similarity index 74% rename from roles/timetracking-bot/meta/main.yml rename to roles/timetracking_bot/meta/main.yml index cedc989..e96b10b 100644 --- a/roles/timetracking-bot/meta/main.yml +++ b/roles/timetracking_bot/meta/main.yml @@ -1,7 +1,9 @@ +--- galaxy_info: author: Jan Christian Grünhage description: deploys a dockerized matrix timetracking bot company: Famedly GmbH - min_ansible_version: 2.9 + license: AGPL-3.0-only + min_ansible_version: "6" galaxy_tags: [] dependencies: [] diff --git a/roles/timetracking-bot/tasks/main.yml b/roles/timetracking_bot/tasks/main.yml similarity index 80% rename from roles/timetracking-bot/tasks/main.yml rename to roles/timetracking_bot/tasks/main.yml index fa2e872..222a7ff 100644 --- a/roles/timetracking-bot/tasks/main.yml +++ b/roles/timetracking_bot/tasks/main.yml @@ -1,16 +1,16 @@ --- # tasks file for timetracking-bot -- name: create timetracking bot user +- name: Create timetracking bot user user: name: matrix-timetracking state: present - system: yes + system: true register: timetracking_bot_user_res -- name: create application directories +- name: Create application directories file: path: "{{ item }}" - mode: 0750 + mode: "0755" owner: "{{ timetracking_bot_user_res.uid }}" group: "{{ timetracking_bot_user_res.group }}" state: directory @@ -19,20 +19,21 @@ - "{{ timetracking_bot_store_path }}" - "{{ timetracking_bot_session_path }}" -- name: template config +- name: Template config copy: + # default required to make linter happy content: | {{ 'Managed by ansible' | comment('plain', prefix='#####', postfix='#####') }} - {{ timetracking_bot_config | to_nice_yaml }} + {{ timetracking_bot_config | default({}) | to_nice_yaml }} dest: "{{ timetracking_bot_config_path }}" - mode: 0640 + mode: "0640" owner: "{{ timetracking_bot_user_res.uid }}" group: "{{ timetracking_bot_user_res.group }}" notify: - - restart timetracking-bot + - restart-timetracking-bot -- name: start container - docker_container: +- name: Start container + community.docker.docker_container: name: "timetracking-bot" image: "{{ timetracking_bot_container_image_ref }}" restart_policy: "unless-stopped" diff --git a/roles/timetracking-bot/vars/main.yml b/roles/timetracking_bot/vars/main.yml similarity index 100% rename from roles/timetracking-bot/vars/main.yml rename to roles/timetracking_bot/vars/main.yml