jdauphant / ansible-role-nginx

Ansible role to install and manage nginx configuration
655 stars 302 forks source link

Adhere to ansible-lint rules #242

Closed bbaassssiiee closed 4 years ago

bbaassssiiee commented 4 years ago

Code style can be improved. This helps others that use ansible-lint for validation of IaC.

bbaassssiiee commented 4 years ago
[701] Role info should contain description
jdauphant.nginx/meta/main.yml:1
{'meta/main.yml': {'galaxy_info': {'author': 'DAUPHANT Julien', 'license': 'BSD', 'min_ansible_version': 2.4, 'platforms': [{'name': 'EL', 'versions': ['all'], '__line__': 7, '__file__': 'jdauphant.nginx/meta/main.yml'}, {'name': 'Fedora', 'versions': ['all'], '__line__': 10, '__file__': 'jdauphant.nginx/meta/main.yml'}, {'name': 'opensuse', 'versions': ['all'], '__line__': 13, '__file__': 'jdauphant.nginx/meta/main.yml'}, {'name': 'Ubuntu', 'versions': ['all'], '__line__': 16, '__file__': 'jdauphant.nginx/meta/main.yml'}, {'name': 'Debian', 'versions': ['all'], '__line__': 19, '__file__': 'jdauphant.nginx/meta/main.yml'}, {'name': 'FreeBSD', 'versions': [10.0, 10.1, 10.2, 10.3, 11.0, 11.1], '__line__': 22, '__file__': 'jdauphant.nginx/meta/main.yml'}, {'name': 'SmartOS', '__line__': 30, '__file__': 'jdauphant.nginx/meta/main.yml'}], 'galaxy_tags': ['web'], '__line__': 2, '__file__': 'jdauphant.nginx/meta/main.yml'}, 'allow_duplicates': True, 'dependencies': [], '__line__': 1, '__file__': 'jdauphant.nginx/meta/main.yml'}}

[601] Don't compare to literal True/False
jdauphant.nginx/tasks/amplify.yml:30
  when: amplify_agent_installed.failed == true

[403] Package installs should not use latest
jdauphant.nginx/tasks/amplify.yml:33
Task/Handler: Update Amplify Agent if already installed and update flag is enabled

[601] Don't compare to literal True/False
jdauphant.nginx/tasks/amplify.yml:37
  when: amplify_agent_installed.failed == false and nginx_amplify_update_agent == true

[601] Don't compare to literal True/False
jdauphant.nginx/tasks/configuration.yml:14
  when: nginx_mime_types_file.stat.exists == False

[201] Trailing whitespace
jdauphant.nginx/tasks/configuration.yml:17

[204] Lines should be no longer than 160 chars
jdauphant.nginx/tasks/configuration.yml:78
- name: Create configuration files in modules-available (only for nginx official repo or custom modules, Centos/RHEL/Debian/Ubuntu EPEL/APT repo packages have these config files already)

[206] Variables should have spaces before and after: {{ var_name }}
jdauphant.nginx/tasks/ensure-dirs.yml:4
    path: "{{nginx_conf_dir}}/{{ item }}"

[206] Variables should have spaces before and after: {{ var_name }}
jdauphant.nginx/tasks/ensure-dirs.yml:8
    mode: "{{nginx_dir_perm}}"

[206] Variables should have spaces before and after: {{ var_name }}
jdauphant.nginx/tasks/ensure-dirs.yml:23
    owner: "{{nginx_log_user}}"

[206] Variables should have spaces before and after: {{ var_name }}
jdauphant.nginx/tasks/ensure-dirs.yml:24
    group: "{{nginx_log_group}}"

[206] Variables should have spaces before and after: {{ var_name }}
jdauphant.nginx/tasks/ensure-dirs.yml:25
    mode: "{{nginx_log_perm}}"

[502] All tasks should be named
jdauphant.nginx/tasks/main.yml:3
Task/Handler: include_vars {{ item }}

[601] Don't compare to literal True/False
jdauphant.nginx/tasks/main.yml:15
  when: nginx_official_repo == True

[601] Don't compare to literal True/False
jdauphant.nginx/tasks/main.yml:40
  when: nginx_set_real_ip_from_cloudflare == True

[601] Don't compare to literal True/False
jdauphant.nginx/tasks/main.yml:44
  when: nginx_amplify == true and (ansible_distribution in ['RedHat', 'CentOS', 'Debian', 'Amazon', 'Ubuntu'])

[206] Variables should have spaces before and after: {{ var_name }}
jdauphant.nginx/tasks/main.yml:48
  service: name={{ nginx_service_name }} state={{nginx_start_service | ternary('started', 'stopped')}} enabled={{nginx_start_at_boot}}

[206] Variables should have spaces before and after: {{ var_name }}
jdauphant.nginx/tasks/remove-defaults.yml:4
    path: "{{nginx_conf_dir}}/sites-enabled/default"

[206] Variables should have spaces before and after: {{ var_name }}
jdauphant.nginx/tasks/remove-defaults.yml:11
    path: "{{nginx_conf_dir}}/sites-enabled/default.conf"

[206] Variables should have spaces before and after: {{ var_name }}
jdauphant.nginx/tasks/remove-defaults.yml:20
    path: "{{nginx_conf_dir}}/conf.d/default.conf"

[206] Variables should have spaces before and after: {{ var_name }}
jdauphant.nginx/tasks/remove-extras.yml:3
  shell: ls -1 {{nginx_conf_dir}}/sites-enabled || true

[206] Variables should have spaces before and after: {{ var_name }}
jdauphant.nginx/tasks/remove-extras.yml:9
    path: "{{nginx_conf_dir}}/sites-enabled/{{ item }}"

[206] Variables should have spaces before and after: {{ var_name }}
jdauphant.nginx/tasks/remove-extras.yml:18
  shell: find {{nginx_conf_dir}}/conf.d -maxdepth 1 -type f -name '*.conf' -exec basename {} \;

[206] Variables should have spaces before and after: {{ var_name }}
jdauphant.nginx/tasks/remove-extras.yml:24
    name: "{{nginx_conf_dir}}/conf.d/{{ item }}"

[206] Variables should have spaces before and after: {{ var_name }}
jdauphant.nginx/tasks/remove-unwanted.yml:4
    path: "{{nginx_conf_dir}}/{{ item[0] }}/{{ item[1] }}.conf"

[206] Variables should have spaces before and after: {{ var_name }}
jdauphant.nginx/tasks/remove-unwanted.yml:14
    path: "{{nginx_conf_dir}}/conf.d/{{ item }}.conf"

[206] Variables should have spaces before and after: {{ var_name }}
jdauphant.nginx/tasks/remove-unwanted.yml:30
    path: "{{nginx_conf_dir}}/auth_basic/{{ item }}"

[206] Variables should have spaces before and after: {{ var_name }}
jdauphant.nginx/tasks/selinux.yml:3
  package: name={{ nginx_python_selinux_pkgs | default(omit)}} state=present
jdauphant commented 4 years ago

fixed by #243