diff --git a/group_vars/matrix_servers b/group_vars/matrix_servers index 92a05507d..38ca74bfe 100755 --- a/group_vars/matrix_servers +++ b/group_vars/matrix_servers @@ -2898,7 +2898,7 @@ matrix_bot_honoroit_systemd_required_services_list_auto: | ([postgres_identifier ~ '.service'] if postgres_enabled and matrix_bot_honoroit_database_hostname == postgres_connection_hostname else []) }} -matrix_bot_honoroit_docker_image_registry_prefix_upstream: "{{ matrix_container_global_registry_prefix_override if matrix_container_global_registry_prefix_override else matrix_bot_honoroit_docker_image_registry_prefix_upstream_default }}" +matrix_bot_honoroit_container_image_registry_prefix_upstream: "{{ matrix_container_global_registry_prefix_override if matrix_container_global_registry_prefix_override else matrix_bot_honoroit_container_image_registry_prefix_upstream_default }}" matrix_bot_honoroit_container_network: "{{ matrix_addons_container_network }}" diff --git a/roles/custom/matrix-bot-honoroit/defaults/main.yml b/roles/custom/matrix-bot-honoroit/defaults/main.yml index 637242b95..8678cd7fb 100644 --- a/roles/custom/matrix-bot-honoroit/defaults/main.yml +++ b/roles/custom/matrix-bot-honoroit/defaults/main.yml @@ -25,17 +25,17 @@ matrix_bot_honoroit_path_prefix: / matrix_bot_honoroit_metrics_path: /metrics matrix_bot_honoroit_container_image_self_build: false -matrix_bot_honoroit_docker_repo: "https://github.com/etkecc/honoroit.git" -matrix_bot_honoroit_docker_repo_version: "{{ matrix_bot_honoroit_version }}" -matrix_bot_honoroit_docker_src_files_path: "{{ matrix_base_data_path }}/honoroit/docker-src" +matrix_bot_honoroit_container_repo: "https://github.com/etkecc/honoroit.git" +matrix_bot_honoroit_container_repo_version: "{{ matrix_bot_honoroit_version }}" +matrix_bot_honoroit_container_src_files_path: "{{ matrix_base_data_path }}/honoroit/docker-src" # renovate: datasource=docker depName=ghcr.io/etkecc/honoroit matrix_bot_honoroit_version: v0.9.29 -matrix_bot_honoroit_docker_image: "{{ matrix_bot_honoroit_docker_image_registry_prefix }}etkecc/honoroit:{{ matrix_bot_honoroit_version }}" -matrix_bot_honoroit_docker_image_registry_prefix: "{{ 'localhost/' if matrix_bot_honoroit_container_image_self_build else matrix_bot_honoroit_docker_image_registry_prefix_upstream }}" -matrix_bot_honoroit_docker_image_registry_prefix_upstream: "{{ matrix_bot_honoroit_docker_image_registry_prefix_upstream_default }}" -matrix_bot_honoroit_docker_image_registry_prefix_upstream_default: "ghcr.io/" -matrix_bot_honoroit_docker_image_force_pull: "{{ matrix_bot_honoroit_docker_image.endswith(':latest') }}" +matrix_bot_honoroit_container_image: "{{ matrix_bot_honoroit_container_image_registry_prefix }}etkecc/honoroit:{{ matrix_bot_honoroit_version }}" +matrix_bot_honoroit_container_image_registry_prefix: "{{ 'localhost/' if matrix_bot_honoroit_container_image_self_build else matrix_bot_honoroit_container_image_registry_prefix_upstream }}" +matrix_bot_honoroit_container_image_registry_prefix_upstream: "{{ matrix_bot_honoroit_container_image_registry_prefix_upstream_default }}" +matrix_bot_honoroit_container_image_registry_prefix_upstream_default: "ghcr.io/" +matrix_bot_honoroit_container_image_force_pull: "{{ matrix_bot_honoroit_container_image.endswith(':latest') }}" matrix_bot_honoroit_base_path: "{{ matrix_base_data_path }}/honoroit" matrix_bot_honoroit_config_path: "{{ matrix_bot_honoroit_base_path }}/config" diff --git a/roles/custom/matrix-bot-honoroit/tasks/setup_install.yml b/roles/custom/matrix-bot-honoroit/tasks/setup_install.yml index 048341512..7bbfb66da 100644 --- a/roles/custom/matrix-bot-honoroit/tasks/setup_install.yml +++ b/roles/custom/matrix-bot-honoroit/tasks/setup_install.yml @@ -47,7 +47,7 @@ - {path: "{{ matrix_bot_honoroit_config_path }}", when: true} - {path: "{{ matrix_bot_honoroit_data_path }}", when: true} - {path: "{{ matrix_bot_honoroit_data_store_path }}", when: true} - - {path: "{{ matrix_bot_honoroit_docker_src_files_path }}", when: true} + - {path: "{{ matrix_bot_honoroit_container_src_files_path }}", when: true} when: "item.when | bool" - name: Ensure Honoroit support files installed @@ -64,10 +64,10 @@ - name: Ensure Honoroit image is pulled community.docker.docker_image: - name: "{{ matrix_bot_honoroit_docker_image }}" + name: "{{ matrix_bot_honoroit_container_image }}" source: "{{ 'pull' if ansible_version.major > 2 or ansible_version.minor > 7 else omit }}" - force_source: "{{ matrix_bot_honoroit_docker_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" - force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_bot_honoroit_docker_image_force_pull }}" + force_source: "{{ matrix_bot_honoroit_container_image_force_pull if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" + force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_bot_honoroit_container_image_force_pull }}" when: "not matrix_bot_honoroit_container_image_self_build | bool" register: matrix_bot_honoroit_container_image_pull_result retries: "{{ devture_playbook_help_container_retries_count }}" @@ -76,9 +76,9 @@ - name: Ensure Honoroit repository is present on self-build ansible.builtin.git: - repo: "{{ matrix_bot_honoroit_docker_repo }}" - version: "{{ matrix_bot_honoroit_docker_repo_version }}" - dest: "{{ matrix_bot_honoroit_docker_src_files_path }}" + repo: "{{ matrix_bot_honoroit_container_repo }}" + version: "{{ matrix_bot_honoroit_container_repo_version }}" + dest: "{{ matrix_bot_honoroit_container_src_files_path }}" force: "yes" become: true become_user: "{{ matrix_user_name }}" @@ -87,13 +87,13 @@ - name: Ensure Honoroit image is built community.docker.docker_image: - name: "{{ matrix_bot_honoroit_docker_image }}" + name: "{{ matrix_bot_honoroit_container_image }}" source: build force_source: "{{ matrix_bot_honoroit_git_pull_results.changed if ansible_version.major > 2 or ansible_version.minor >= 8 else omit }}" force: "{{ omit if ansible_version.major > 2 or ansible_version.minor >= 8 else matrix_bot_honoroit_container_image_self_build.changed }}" build: dockerfile: Dockerfile - path: "{{ matrix_bot_honoroit_docker_src_files_path }}" + path: "{{ matrix_bot_honoroit_container_src_files_path }}" pull: true when: "matrix_bot_honoroit_container_image_self_build | bool" diff --git a/roles/custom/matrix-bot-honoroit/tasks/validate_config.yml b/roles/custom/matrix-bot-honoroit/tasks/validate_config.yml index 6c0c12a19..e7d93f068 100644 --- a/roles/custom/matrix-bot-honoroit/tasks/validate_config.yml +++ b/roles/custom/matrix-bot-honoroit/tasks/validate_config.yml @@ -6,6 +6,23 @@ --- +- name: (Deprecation) Catch and report renamed Honoroit settings + ansible.builtin.fail: + msg: >- + Your configuration contains a variable, which now has a different name. + Please rename the variable (`{{ item.old }}` -> `{{ item.new }}`) on your configuration file (vars.yml). + when: "lookup('ansible.builtin.varnames', ('^' + item.old + '$'), wantlist=True) | length > 0" + with_items: + - {'old': 'matrix_bot_honoroit_container_image_name_prefix', 'new': 'matrix_bot_honoroit_container_image_registry_prefix'} + - {'old': 'matrix_bot_honoroit_docker_image', 'new': 'matrix_bot_honoroit_container_image'} + - {'old': 'matrix_bot_honoroit_docker_image_force_pull', 'new': 'matrix_bot_honoroit_container_image_force_pull'} + - {'old': 'matrix_bot_honoroit_docker_image_registry_prefix', 'new': 'matrix_bot_honoroit_container_image_registry_prefix'} + - {'old': 'matrix_bot_honoroit_docker_image_registry_prefix_upstream', 'new': 'matrix_bot_honoroit_container_image_registry_prefix_upstream'} + - {'old': 'matrix_bot_honoroit_docker_image_registry_prefix_upstream_default', 'new': 'matrix_bot_honoroit_container_image_registry_prefix_upstream_default'} + - {'old': 'matrix_bot_honoroit_docker_repo', 'new': 'matrix_bot_honoroit_container_repo'} + - {'old': 'matrix_bot_honoroit_docker_repo_version', 'new': 'matrix_bot_honoroit_container_repo_version'} + - {'old': 'matrix_bot_honoroit_docker_src_files_path', 'new': 'matrix_bot_honoroit_container_src_files_path'} + - name: Fail if required Honoroit settings not defined ansible.builtin.fail: msg: >- @@ -16,12 +33,3 @@ - {'name': 'matrix_bot_honoroit_password', when: true} - {'name': 'matrix_bot_honoroit_roomid', when: true} - {'name': 'matrix_bot_honoroit_database_hostname', when: "{{ matrix_bot_honoroit_database_engine == 'postgres' }}"} - -- name: (Deprecation) Catch and report renamed Honoroit settings - ansible.builtin.fail: - msg: >- - Your configuration contains a variable, which now has a different name. - Please rename the variable (`{{ item.old }}` -> `{{ item.new }}`) on your configuration file (vars.yml). - when: "lookup('ansible.builtin.varnames', ('^' + item.old + '$'), wantlist=True) | length > 0" - with_items: - - {'old': 'matrix_bot_honoroit_container_image_name_prefix', 'new': 'matrix_bot_honoroit_container_image_registry_prefix'} diff --git a/roles/custom/matrix-bot-honoroit/templates/systemd/matrix-bot-honoroit.service.j2 b/roles/custom/matrix-bot-honoroit/templates/systemd/matrix-bot-honoroit.service.j2 index 1fcbbb03c..7ffc8313a 100644 --- a/roles/custom/matrix-bot-honoroit/templates/systemd/matrix-bot-honoroit.service.j2 +++ b/roles/custom/matrix-bot-honoroit/templates/systemd/matrix-bot-honoroit.service.j2 @@ -30,7 +30,7 @@ ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} create \ {% for arg in matrix_bot_honoroit_container_extra_arguments %} {{ arg }} \ {% endfor %} - {{ matrix_bot_honoroit_docker_image }} + {{ matrix_bot_honoroit_container_image }} {% for network in matrix_bot_honoroit_container_additional_networks %} ExecStartPre={{ devture_systemd_docker_base_host_command_docker }} network connect {{ network }} matrix-bot-honoroit