From 424e59805f4e871cfe11b5a1a05eb43c37aaf1c6 Mon Sep 17 00:00:00 2001 From: MarkusTeufelberger Date: Wed, 24 Apr 2019 07:18:00 +0200 Subject: [PATCH] ansible-lint: Fix commands that are also available as module (#4619) --- .ansible-lint | 1 - .../container-engine/docker/handlers/main.yml | 3 +- .../container-engine/docker/tasks/systemd.yml | 1 + roles/etcd/handlers/main.yml | 3 +- roles/etcd/tasks/configure.yml | 3 +- .../helm/tasks/gen_helm_tiller_certs.yml | 1 + roles/kubernetes/master/handlers/main.yml | 3 +- roles/kubernetes/node/handlers/main.yml | 3 +- .../preinstall/tasks/0070-system-packages.yml | 38 ------------------- .../calico/rr/handlers/main.yml | 3 +- roles/network_plugin/cilium/handlers/main.yml | 3 +- .../network_plugin/flannel/handlers/main.yml | 3 +- roles/reset/tasks/main.yml | 3 +- 13 files changed, 20 insertions(+), 48 deletions(-) diff --git a/.ansible-lint b/.ansible-lint index 7f1c3a16a..d622584ae 100644 --- a/.ansible-lint +++ b/.ansible-lint @@ -10,7 +10,6 @@ skip_list: - '206' - '301' - '302' - - '303' - '305' - '306' - '404' diff --git a/roles/container-engine/docker/handlers/main.yml b/roles/container-engine/docker/handlers/main.yml index a43d843ee..2847088e1 100644 --- a/roles/container-engine/docker/handlers/main.yml +++ b/roles/container-engine/docker/handlers/main.yml @@ -9,7 +9,8 @@ - Docker | wait for docker - name: Docker | reload systemd - shell: systemctl daemon-reload + systemd: + daemon_reload: true - name: Docker | reload docker.socket service: diff --git a/roles/container-engine/docker/tasks/systemd.yml b/roles/container-engine/docker/tasks/systemd.yml index e37d7cc47..25b4ad942 100644 --- a/roles/container-engine/docker/tasks/systemd.yml +++ b/roles/container-engine/docker/tasks/systemd.yml @@ -12,6 +12,7 @@ when: http_proxy is defined or https_proxy is defined - name: get systemd version + # noqa 303 - systemctl is called intentionally here shell: systemctl --version | head -n 1 | cut -d " " -f 2 register: systemd_version when: not is_atomic diff --git a/roles/etcd/handlers/main.yml b/roles/etcd/handlers/main.yml index 3a46978a6..d9709fd56 100644 --- a/roles/etcd/handlers/main.yml +++ b/roles/etcd/handlers/main.yml @@ -17,7 +17,8 @@ - import_tasks: backup.yml - name: etcd | reload systemd - command: systemctl daemon-reload + systemd: + daemon_reload: true - name: reload etcd service: diff --git a/roles/etcd/tasks/configure.yml b/roles/etcd/tasks/configure.yml index ded28fc60..2470217bc 100644 --- a/roles/etcd/tasks/configure.yml +++ b/roles/etcd/tasks/configure.yml @@ -45,7 +45,8 @@ when: is_etcd_master and etcd_events_cluster_setup - name: Configure | reload systemd - command: systemctl daemon-reload + systemd: + daemon_reload: true when: is_etcd_master - name: Configure | Ensure etcd is running diff --git a/roles/kubernetes-apps/helm/tasks/gen_helm_tiller_certs.yml b/roles/kubernetes-apps/helm/tasks/gen_helm_tiller_certs.yml index 8c755e3b4..69d0cd2f9 100644 --- a/roles/kubernetes-apps/helm/tasks/gen_helm_tiller_certs.yml +++ b/roles/kubernetes-apps/helm/tasks/gen_helm_tiller_certs.yml @@ -57,6 +57,7 @@ - "{{ helm_client_certs }}" - name: Gen_helm_tiller_certs | Gather helm client certs + # noqa 303 - tar is called intentionally here, but maybe this should be done with the slurp module shell: "tar cfz - -C {{ helm_home_dir }} -T /dev/stdin <<< {{ helm_client_certs|join(' ') }} | base64 --wrap=0" args: executable: /bin/bash diff --git a/roles/kubernetes/master/handlers/main.yml b/roles/kubernetes/master/handlers/main.yml index a2df028c6..8e753e56a 100644 --- a/roles/kubernetes/master/handlers/main.yml +++ b/roles/kubernetes/master/handlers/main.yml @@ -32,7 +32,8 @@ - Master | wait for kube-controller-manager - name: Master | reload systemd - command: systemctl daemon-reload + systemd: + daemon_reload: true - name: Master | reload kubelet service: diff --git a/roles/kubernetes/node/handlers/main.yml b/roles/kubernetes/node/handlers/main.yml index 00525b995..352a5a652 100644 --- a/roles/kubernetes/node/handlers/main.yml +++ b/roles/kubernetes/node/handlers/main.yml @@ -6,7 +6,8 @@ - Kubelet | reload kubelet - name: Kubelet | reload systemd - command: systemctl daemon-reload + systemd: + daemon_reload: true - name: Kubelet | reload kubelet service: diff --git a/roles/kubernetes/preinstall/tasks/0070-system-packages.yml b/roles/kubernetes/preinstall/tasks/0070-system-packages.yml index c8ab5d1c2..65cacc656 100644 --- a/roles/kubernetes/preinstall/tasks/0070-system-packages.yml +++ b/roles/kubernetes/preinstall/tasks/0070-system-packages.yml @@ -1,42 +1,4 @@ --- -- name: Update package management cache (YUM) - yum: - update_cache: yes - name: '*' - register: yum_task_result - until: yum_task_result is succeeded - retries: 4 - delay: "{{ retry_stagger | random + 3 }}" - when: - - ansible_pkg_mgr == 'yum' - - ansible_distribution != 'RedHat' - - not is_atomic - -- name: Expire management cache (YUM) for Updation - Redhat - shell: yum clean expire-cache - register: expire_cache_output - until: expire_cache_output is succeeded - retries: 4 - delay: "{{ retry_stagger | random + 3 }}" - when: - - ansible_pkg_mgr == 'yum' - - ansible_distribution == 'RedHat' - - not is_atomic - tags: bootstrap-os - -- name: Update package management cache (YUM) - Redhat - shell: yum makecache - register: make_cache_output - until: make_cache_output is succeeded - retries: 4 - delay: "{{ retry_stagger | random + 3 }}" - when: - - ansible_pkg_mgr == 'yum' - - ansible_distribution == 'RedHat' - - expire_cache_output.rc == 0 - - not is_atomic - tags: bootstrap-os - - name: Update package management cache (zypper) - SUSE shell: zypper -n --gpg-auto-import-keys ref register: make_cache_output diff --git a/roles/network_plugin/calico/rr/handlers/main.yml b/roles/network_plugin/calico/rr/handlers/main.yml index cb166bda1..1436649e3 100644 --- a/roles/network_plugin/calico/rr/handlers/main.yml +++ b/roles/network_plugin/calico/rr/handlers/main.yml @@ -6,7 +6,8 @@ - Calico-rr | reload calico-rr - name: Calico-rr | reload systemd - shell: systemctl daemon-reload + systemd: + daemon_reload: true - name: Calico-rr | reload calico-rr service: diff --git a/roles/network_plugin/cilium/handlers/main.yml b/roles/network_plugin/cilium/handlers/main.yml index 00525b995..352a5a652 100644 --- a/roles/network_plugin/cilium/handlers/main.yml +++ b/roles/network_plugin/cilium/handlers/main.yml @@ -6,7 +6,8 @@ - Kubelet | reload kubelet - name: Kubelet | reload systemd - command: systemctl daemon-reload + systemd: + daemon_reload: true - name: Kubelet | reload kubelet service: diff --git a/roles/network_plugin/flannel/handlers/main.yml b/roles/network_plugin/flannel/handlers/main.yml index 00c5667b0..a66cdadbc 100644 --- a/roles/network_plugin/flannel/handlers/main.yml +++ b/roles/network_plugin/flannel/handlers/main.yml @@ -23,7 +23,8 @@ - Flannel | wait for docker - name: Flannel | reload systemd - shell: systemctl daemon-reload + systemd: + daemon_reload: true - name: Flannel | reload docker.socket service: diff --git a/roles/reset/tasks/main.yml b/roles/reset/tasks/main.yml index 98f3b51a3..072ce27dc 100644 --- a/roles/reset/tasks/main.yml +++ b/roles/reset/tasks/main.yml @@ -47,7 +47,8 @@ - docker - name: reset | systemctl daemon-reload - command: systemctl daemon-reload + systemd: + daemon_reload: true when: services_removed.changed or docker_dropins_removed.changed - name: reset | remove all containers