Changeset - 0c330b88956a
[Not reviewed]
0 16 0
Branko Majic (branko) - 15 months ago 2024-09-09 16:42:51
branko@majic.rs
MAR-218: Switch to using task imports instead of includes:

- Should result in somewhat faster run, except the includes happen
during planning phase. None of the changed includes will have
problem with this.
- Solves the issue of (included) imported tasks not being tagged
properly, particularly in relation to the mechanism for explicitly
running all handlers.
16 files changed with 18 insertions and 18 deletions:
0 comments (0 inline, 0 general)
roles/backup/tasks/main.yml
Show inline comments
 
@@ -2,16 +2,16 @@
 

	
 
- name: Configure backup patterns
 
  ansible.builtin.template:
 
    src: "backup_patterns.j2"
 
    dest: "/etc/duply/main/patterns/{{ backup_patterns_filename }}"
 
    owner: root
 
    group: root
 
    mode: "0600"
 
  notify:
 
    - Assemble Duply include patterns
 

	
 
- name: Explicitly run all handlers
 
  ansible.builtin.include_tasks: ../handlers/main.yml
 
  ansible.builtin.import_tasks: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/backup_client/tasks/main.yml
Show inline comments
 
@@ -128,16 +128,16 @@
 
    user: root
 

	
 
- name: Ensure the file with include patterns exists (but do not overwrite)
 
  ansible.builtin.copy:
 
    content: ""
 
    dest: /etc/duply/main/include
 
    force: false
 
    group: root
 
    owner: root
 
    mode: "0600"
 

	
 
- name: Explicitly run all handlers
 
  ansible.builtin.include_tasks: ../handlers/main.yml
 
  ansible.builtin.import_tasks: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/backup_server/tasks/main.yml
Show inline comments
 
@@ -145,16 +145,16 @@
 

	
 
- name: Deploy firewall configuration for backup server
 
  ansible.builtin.template:
 
    src: "ferm_backup.conf.j2"
 
    dest: "/etc/ferm/conf.d/40-backup.conf"
 
    owner: root
 
    group: root
 
    mode: "0640"
 
  notify:
 
    - Restart ferm
 

	
 
- name: Explicitly run all handlers
 
  ansible.builtin.include_tasks: ../handlers/main.yml
 
  ansible.builtin.import_tasks: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/bootstrap/tasks/main.yml
Show inline comments
 
@@ -28,16 +28,16 @@
 
    dest: "/etc/sudoers.d/ansible"
 
    mode: "0640"
 
    owner: root
 
    group: root
 

	
 
- name: Revoke rights for Ansible user to log-in as root to server via ssh
 
  ansible.posix.authorized_key:
 
    user: root
 
    key: "{{ ansible_key }}"
 
    state: absent
 

	
 
- name: Explicitly run all handlers
 
  ansible.builtin.include_tasks: ../handlers/main.yml
 
  ansible.builtin.import_tasks: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/common/tasks/main.yml
Show inline comments
 
@@ -525,16 +525,16 @@
 
- name: Deploy NTP configuration
 
  ansible.builtin.template:
 
    src: "ntp.conf.j2"
 
    dest: "/etc/ntpsec/ntp.conf"
 
    owner: root
 
    group: root
 
    mode: "0644"
 
  when: ntp_pools | length > 0
 
  notify:
 
    - Restart NTP server
 

	
 
- name: Explicitly run all handlers
 
  ansible.builtin.include_tasks: ../handlers/main.yml
 
  ansible.builtin.import_tasks: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/database/tasks/main.yml
Show inline comments
 
@@ -7,20 +7,20 @@
 
    login_unix_socket: "/var/run/mysqld/mysqld.sock"
 

	
 
- name: "Create database user {{ db_name }}"
 
  community.mysql.mysql_user:
 
    name: "{{ db_name }}"
 
    password: "{{ db_password }}"
 
    priv: "{{ db_name }}.*:ALL"
 
    state: present
 
    login_unix_socket: "/var/run/mysqld/mysqld.sock"
 
    column_case_sensitive: true
 

	
 
- name: Enable backup
 
  ansible.builtin.include_tasks: backup.yml
 
  ansible.builtin.import_tasks: backup.yml
 
  when: enable_backup
 

	
 
- name: Explicitly run all handlers
 
  ansible.builtin.include_tasks: ../handlers/main.yml
 
  ansible.builtin.import_tasks: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/database_server/tasks/main.yml
Show inline comments
 
@@ -25,16 +25,16 @@
 

	
 
- name: Restart MariaDB in order to use UTF-8 as default character set  # noqa no-handler
 
  # [no-handler] Tasks that run when changed should likely be handlers
 
  #   UTF-8 configuration must be applied immediatelly in order to ensure that
 
  #   subsequent tasks that create databases will end-up with correct (UTF-8)
 
  #   encoding. Otherwise they will be created using default latin1.
 
  ansible.builtin.service:
 
    name: mysql
 
    state: restarted
 
  when: mariadb_utf8_configuration.changed
 

	
 
- name: Explicitly run all handlers
 
  ansible.builtin.include_tasks: ../handlers/main.yml
 
  ansible.builtin.import_tasks: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/ldap_client/tasks/main.yml
Show inline comments
 
@@ -13,16 +13,16 @@
 
    group: root
 
    mode: "0755"
 

	
 
- name: Deploy LDAP client configuration file
 
  ansible.builtin.template:
 
    src: ldap.conf.j2
 
    dest: /etc/ldap/ldap.conf
 
    owner: root
 
    group: root
 
    mode: "0644"
 

	
 
- name: Explicitly run all handlers
 
  ansible.builtin.include_tasks: ../handlers/main.yml
 
  ansible.builtin.import_tasks: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/ldap_server/tasks/main.yml
Show inline comments
 
@@ -269,20 +269,20 @@
 
    attributes:
 
      olcRootPW: "{{ ldap_admin_password | ldap_password_hash }}"
 
    state: exact
 
  when: ldap_admin_password_check.rc != 0
 

	
 
- name: Remove temporary file with LDAP admin password
 
  ansible.builtin.file:
 
    path: "/root/.ldap_admin_password"
 
    state: absent
 
  changed_when: false
 

	
 
- name: Enable backup
 
  ansible.builtin.include_tasks: backup.yml
 
  ansible.builtin.import_tasks: backup.yml
 
  when: enable_backup
 

	
 
- name: Explicitly run all handlers
 
  ansible.builtin.include_tasks: ../handlers/main.yml
 
  ansible.builtin.import_tasks: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/mail_forwarder/tasks/main.yml
Show inline comments
 
@@ -109,16 +109,16 @@
 
    owner: root
 
    group: root
 
    mode: "0640"
 
  notify:
 
    - Restart ferm
 

	
 
- name: Install SWAKS
 
  ansible.builtin.apt:
 
    name: swaks
 
    state: present
 

	
 
- name: Explicitly run all handlers
 
  ansible.builtin.include_tasks: ../handlers/main.yml
 
  ansible.builtin.import_tasks: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/mail_server/tasks/main.yml
Show inline comments
 
@@ -316,16 +316,16 @@
 

	
 
- name: Deploy firewall configuration for mail server
 
  ansible.builtin.copy:
 
    src: "ferm_mail.conf"
 
    dest: "/etc/ferm/conf.d/20-mail.conf"
 
    owner: root
 
    group: root
 
    mode: "0640"
 
  notify:
 
    - Restart ferm
 

	
 
- name: Explicitly run all handlers
 
  ansible.builtin.include_tasks: ../handlers/main.yml
 
  ansible.builtin.import_tasks: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/php_website/tasks/main.yml
Show inline comments
 
@@ -112,16 +112,16 @@
 
  notify:
 
    - Restart nginx
 

	
 
- name: Enable website
 
  ansible.builtin.file:
 
    src: "/etc/nginx/sites-available/{{ fqdn }}"
 
    dest: "/etc/nginx/sites-enabled/{{ fqdn }}"
 
    state: link
 
  notify:
 
    - Restart nginx
 

	
 
- name: Explicitly run all handlers
 
  ansible.builtin.include_tasks: ../handlers/main.yml
 
  ansible.builtin.import_tasks: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/preseed/tasks/main.yml
Show inline comments
 
@@ -6,16 +6,16 @@
 
    mode: "0750"
 
    state: directory
 

	
 
- name: Create preseed configuration file
 
  ansible.builtin.template:
 
    src: "preseed.cfg.j2"
 
    dest: "{{ preseed_directory }}/{{ item }}.cfg"
 
    mode: "0640"
 
  when: item != "localhost"
 
  with_items: "{{ groups['all'] }}"
 

	
 
- name: Explicitly run all handlers
 
  ansible.builtin.include_tasks: ../handlers/main.yml
 
  ansible.builtin.import_tasks: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/web_server/tasks/main.yml
Show inline comments
 
@@ -209,16 +209,16 @@
 
    src: "php_timezone.ini.j2"
 
    dest: "{{ item }}/30-timezone.ini"
 
    owner: root
 
    group: root
 
    mode: "0644"
 
  with_items:
 
    - "{{ php_base_config_dir }}/cli/conf.d/"
 
    - "{{ php_base_config_dir }}/fpm/conf.d/"
 
  notify:
 
    - Restart PHP-FPM
 

	
 
- name: Explicitly run all handlers
 
  ansible.builtin.include_tasks: ../handlers/main.yml
 
  ansible.builtin.import_tasks: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/wsgi_website/tasks/main.yml
Show inline comments
 
@@ -304,16 +304,16 @@
 
  when: |
 
    fqdn not in wsgi_services_to_restart and
 
    ((install_extra_packages is defined and install_extra_packages.changed) or
 
    (install_additional_packages_in_virtualenv is defined and install_additional_packages_in_virtualenv.changed) or
 
    (deploy_systemd_socket_configuration is defined and deploy_systemd_socket_configuration.changed) or
 
    (deploy_systemd_service_configuration is defined and deploy_systemd_service_configuration.changed) or
 
    (install_gunicorn_via_requirements is defined and install_gunicorn_via_requirements.changed) or
 
    (run_handlers | default(False) | bool()))
 
  tags:
 
    - handlers
 

	
 
- name: Explicitly run all handlers
 
  ansible.builtin.include_tasks: ../handlers/main.yml
 
  ansible.builtin.import_tasks: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/xmpp_server/tasks/main.yml
Show inline comments
 
@@ -126,16 +126,16 @@
 

	
 
- name: Deploy firewall configuration for XMPP server
 
  ansible.builtin.copy:
 
    src: "ferm_xmpp.conf"
 
    dest: "/etc/ferm/conf.d/30-xmpp.conf"
 
    owner: root
 
    group: root
 
    mode: "0640"
 
  notify:
 
    - Restart ferm
 

	
 
- name: Explicitly run all handlers
 
  ansible.builtin.include_tasks: ../handlers/main.yml
 
  ansible.builtin.import_tasks: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
0 comments (0 inline, 0 general)