Changeset - fcf5abdd3ad5
[Not reviewed]
0 12 0
Branko Majic (branko) - 4 years ago 2020-01-05 23:29:57
branko@majic.rs
MAR-148: Fixing linting errors:

- Do not compare against booleans when value is already boolean in
"when" conditions.
- Use pipefail in conjunction with setting the shell to Bash when
extracting the backup encryption key IDs.
- Do not compare variables to empty strings in "when" conditions. This
change currently works only for complex variables (stuff can break
badly in case of simple variables in current default Ansible
configuration).
- Fix missing space in one of Jinja2 templates.
12 files changed with 27 insertions and 23 deletions:
0 comments (0 inline, 0 general)
roles/backup/tasks/main.yml
Show inline comments
 
@@ -12,6 +12,6 @@
 

	
 
- name: Explicitly run all handlers
 
  include: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool() == True"
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/backup_client/tasks/main.yml
Show inline comments
 
@@ -53,19 +53,23 @@
 
    - Import public keys
 

	
 
- name: Extract encryption key identifier (Duplicty requires key ID in hexadecimal format)
 
  shell: "{{ gnupg_binary }} --no-tty --list-packets /etc/duply/main/private_keys.asc | grep keyid: |
 
  shell: "set -o pipefail && {{ gnupg_binary }} --no-tty --list-packets /etc/duply/main/private_keys.asc | grep keyid: |
 
    head -n1 | sed -e 's/.*: //' | sed -re 's/^.{{ '{' + gnupg_key_cutoff + '}' }}//'"
 
  args:
 
    executable: /bin/bash
 
  register: backup_encryption_key_id
 
  changed_when: false
 
  failed_when: backup_encryption_key_id.stdout == ""
 
  failed_when: not backup_encryption_key_id.stdout
 

	
 
- name: Extract additional encryption keys identifiers (Duplicty requires key ID in hexadecimal format)
 
  shell: "{{ gnupg_binary }} --no-tty --list-packets /etc/duply/main/public_keys.asc | grep keyid: |
 
  shell: "set -o pipefail &&  {{ gnupg_binary }} --no-tty --list-packets /etc/duply/main/public_keys.asc | grep keyid: |
 
    sed -e 's/.*: //' | sort -u | sed -re 's/^.{{ '{' + gnupg_key_cutoff + '}' }}//' | tr '\n' ',' | sed -e 's/,$//'"
 
  args:
 
    executable: /bin/bash
 
  when: backup_additional_encryption_keys
 
  register: backup_additional_encryption_keys_ids
 
  changed_when: false
 
  failed_when: backup_additional_encryption_keys_ids.stdout == ""
 
  failed_when: not backup_additional_encryption_keys_ids.stdout
 

	
 
- name: Deploy private SSH key for logging-in into backup server
 
  copy:
 
@@ -137,6 +141,6 @@
 

	
 
- name: Explicitly run all handlers
 
  include: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool() == True"
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/bootstrap/tasks/main.yml
Show inline comments
 
@@ -38,6 +38,6 @@
 

	
 
- name: Explicitly run all handlers
 
  include: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool() == True"
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/common/tasks/main.yml
Show inline comments
 
@@ -237,7 +237,7 @@
 
- name: Enable ferm service on boot (workaround for systemctl broken handling of SysV)
 
  command: "rcconf -on ferm"
 
  register: result
 
  changed_when: result.stderr == ""
 
  changed_when: not result.stderr
 

	
 
- name: Enable ferm service
 
  service:
 
@@ -468,6 +468,6 @@
 

	
 
- name: Explicitly run all handlers
 
  include: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool() == True"
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/database/tasks/main.yml
Show inline comments
 
@@ -18,6 +18,6 @@
 

	
 
- name: Explicitly run all handlers
 
  include: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool() == True"
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/database_server/tasks/main.yml
Show inline comments
 
@@ -11,7 +11,7 @@
 
- name: Enable MariaDB service on boot (workaround for systemctl broken handling of SysV)
 
  command: rcconf -on mysql
 
  register: result
 
  changed_when: result.stderr == ""
 
  changed_when: not result.stderr
 

	
 
- name: Enable and start MariaDB
 
  service:
 
@@ -40,7 +40,7 @@
 

	
 
- name: Disable use of unix socket login on Debian Stretch (temporary workaround)
 
  command: "mysql -B -e \"update mysql.user set plugin='' where user='root' and plugin='unix_socket'; flush privileges;\""
 
  when: "ansible_distribution_release == 'stretch' and root_using_unix_socket_authentication.stdout != ''"
 
  when: "ansible_distribution_release == 'stretch' and root_using_unix_socket_authentication.stdout"
 

	
 
- name: Remove UTF-8 encoding configuration file from the old location on Debian Stretch
 
  file:
 
@@ -83,6 +83,6 @@
 

	
 
- name: Explicitly run all handlers
 
  include: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool() == True"
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/ldap_client/tasks/main.yml
Show inline comments
 
@@ -15,6 +15,6 @@
 

	
 
- name: Explicitly run all handlers
 
  include: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool() == True"
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/ldap_server/tasks/main.yml
Show inline comments
 
@@ -56,7 +56,7 @@
 
- name: Enable slapd service on boot (workaround for systemctl broken handling of SysV)
 
  command: "rcconf -on slapd"
 
  register: result
 
  changed_when: result.stderr == ""
 
  changed_when: not result.stderr
 

	
 
- name: Enable slapd service
 
  service:
 
@@ -95,7 +95,7 @@
 

	
 
- name: Deploy LDAP misc schema
 
  command: "ldapadd -H ldapi:/// -Q -Y EXTERNAL -f /etc/ldap/schema/misc.ldif"
 
  when: ldap_misc_schema_present.stdout == ""
 
  when: not ldap_misc_schema_present.stdout
 

	
 
- name: Deploy LDAP TLS private key
 
  template:
 
@@ -280,7 +280,7 @@
 
    dn: "{{ item.dn }}"
 
    objectClass: "{{ item.attributes.objectClass }}"
 
    attributes: "{{ item.attributes }}"
 
    state: "{{ item.state | default('present')}}"
 
    state: "{{ item.state | default('present') }}"
 
  with_items: "{{ ldap_entries }}"
 

	
 
- name: Deploy firewall configuration for LDAP
 
@@ -324,6 +324,6 @@
 

	
 
- name: Explicitly run all handlers
 
  include: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool() == True"
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/mail_forwarder/tasks/main.yml
Show inline comments
 
@@ -81,6 +81,6 @@
 

	
 
- name: Explicitly run all handlers
 
  include: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool() == True"
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/preseed/tasks/main.yml
Show inline comments
 
@@ -16,6 +16,6 @@
 

	
 
- name: Explicitly run all handlers
 
  include: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool() == True"
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/web_server/tasks/main.yml
Show inline comments
 
@@ -207,6 +207,6 @@
 

	
 
- name: Explicitly run all handlers
 
  include: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool() == True"
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
roles/xmpp_server/tasks/main.yml
Show inline comments
 
@@ -98,7 +98,7 @@
 
- name: Enable Prosody service on boot (workaround for systemctl broken handling of SysV)
 
  command: "rcconf -on prosody"
 
  register: result
 
  changed_when: result.stderr == ""
 
  changed_when: not result.stderr
 

	
 
- name: Enable and start Prosody service
 
  service:
 
@@ -117,6 +117,6 @@
 

	
 
- name: Explicitly run all handlers
 
  include: ../handlers/main.yml
 
  when: "run_handlers | default(False) | bool() == True"
 
  when: "run_handlers | default(False) | bool()"
 
  tags:
 
    - handlers
0 comments (0 inline, 0 general)