From 43d65fb63ae15335f5eda92eef7ae6aa39a4415f Mon Sep 17 00:00:00 2001 From: yurihs Date: Thu, 23 May 2019 14:31:30 -0300 Subject: [PATCH 1/4] Add names to all tasks (ansible-lint E502) --- tasks/install.yml | 9 ++++++--- tasks/variables.yml | 24 ++++++++++++++++-------- 2 files changed, 22 insertions(+), 11 deletions(-) diff --git a/tasks/install.yml b/tasks/install.yml index cf4241d..dc52b62 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -23,15 +23,18 @@ - name: Install systemd service files block: - - template: + - name: Install service unit file + template: src: "{{ sshd_service_template_service }}" dest: "/etc/systemd/system/{{ sshd_service }}.service" notify: reload_sshd - - template: + - name: Install instanced service unit file + template: src: "{{ sshd_service_template_at_service }}" dest: "/etc/systemd/system/{{ sshd_service }}@.service" notify: reload_sshd - - template: + - name: Install socket unit file + template: src: "{{ sshd_service_template_socket }}" dest: "/etc/systemd/system/{{ sshd_service }}.socket" notify: reload_sshd diff --git a/tasks/variables.yml b/tasks/variables.yml index ccd71dd..f0a586f 100644 --- a/tasks/variables.yml +++ b/tasks/variables.yml @@ -23,27 +23,35 @@ - name: Override OS defaults block: - - set_fact: + - name: Define sshd_packages + set_fact: sshd_packages: "{{ __sshd_packages }}" when: sshd_packages is not defined - - set_fact: + - name: Define sshd_config_owner + set_fact: sshd_config_owner: "{{ __sshd_config_owner }}" when: sshd_config_owner is not defined - - set_fact: + - name: Define sshd_config_group + set_fact: sshd_config_group: "{{ __sshd_config_group }}" when: sshd_config_group is not defined - - set_fact: + - name: Define sshd_config_mode + set_fact: sshd_config_mode: "{{ __sshd_config_mode }}" when: sshd_config_mode is not defined - - set_fact: + - name: Define sshd_config_file + set_fact: sshd_config_file: "{{ __sshd_config_file }}" when: sshd_config_file is not defined - - set_fact: + - name: Define sshd_binary + set_fact: sshd_binary: "{{ __sshd_binary }}" when: sshd_binary is not defined - - set_fact: + - name: Define sshd_service + set_fact: sshd_service: "{{ __sshd_service }}" when: sshd_service is not defined - - set_fact: + - name: Define sshd_sftp_server + set_fact: sshd_sftp_server: "{{ __sshd_sftp_server }}" when: sshd_sftp_server is not defined From 775264a8b8349e2fe06493d9deb3b4be6888f1a8 Mon Sep 17 00:00:00 2001 From: yurihs Date: Thu, 23 May 2019 14:32:21 -0300 Subject: [PATCH 2/4] Make tags lowercase (ansible-lint E702) --- meta/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/meta/main.yml b/meta/main.yml index 87933d8..7b8e18c 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -32,8 +32,8 @@ galaxy_info: galaxy_tags: - networking - system - - SSH - - OpenSSH + - ssh + - openssh - sshd - server - ubuntu From 53218db597202e328d5d50466e766dc91dc109f7 Mon Sep 17 00:00:00 2001 From: yurihs Date: Thu, 23 May 2019 14:37:09 -0300 Subject: [PATCH 3/4] Use bool filter instead of bare variables or comparison to literal True (ansible-lint E601, ansible/ansible#51030) --- tasks/install.yml | 6 +++--- tasks/main.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/tasks/install.yml b/tasks/install.yml index dc52b62..0b740c6 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -2,7 +2,7 @@ - name: OS is supported assert: - that: __sshd_os_supported == True + that: __sshd_os_supported|bool - name: Install ssh packages package: @@ -38,7 +38,7 @@ src: "{{ sshd_service_template_socket }}" dest: "/etc/systemd/system/{{ sshd_service }}.socket" notify: reload_sshd - when: sshd_install_service + when: sshd_install_service|bool - name: Service enabled and running service: @@ -46,7 +46,7 @@ enabled: true state: started when: - - sshd_manage_service + - sshd_manage_service|bool - ansible_virtualization_type|default(None) != 'docker' - ansible_connection != 'chroot' diff --git a/tasks/main.yml b/tasks/main.yml index cea29a2..54b708e 100644 --- a/tasks/main.yml +++ b/tasks/main.yml @@ -1,4 +1,4 @@ --- - include_tasks: sshd.yml - when: sshd_enable + when: sshd_enable|bool From efc868edc25c822e57f9777d72105e09e776000b Mon Sep 17 00:00:00 2001 From: yurihs Date: Thu, 23 May 2019 14:37:58 -0300 Subject: [PATCH 4/4] Ignore ansible-lint E303, usage of systemctl command is unavoidable --- tasks/install.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tasks/install.yml b/tasks/install.yml index 0b740c6..030177a 100644 --- a/tasks/install.yml +++ b/tasks/install.yml @@ -52,7 +52,7 @@ # Due to ansible bug 21026, cannot use service module on RHEL 7 - name: Enable service in chroot - command: systemctl enable {{ sshd_service }} + command: systemctl enable {{ sshd_service }} # noqa 303 when: - ansible_connection == 'chroot' - ansible_os_family == 'RedHat'