From 8a8a08269379b901e5992235d56a2dbe3e2e89bf Mon Sep 17 00:00:00 2001 From: Guillaume Abrioux Date: Fri, 2 Oct 2020 13:43:47 +0200 Subject: [PATCH] lint: do not use 'local_action' Fix ansible-lint 504 error: [504] Do not use 'local_action', use 'delegate_to: localhost' Signed-off-by: Guillaume Abrioux (cherry picked from commit c948b668ebe7cf7af61090ac6f9b93e0a16e14ee) --- infrastructure-playbooks/gather-ceph-logs.yml | 4 ++-- infrastructure-playbooks/purge-cluster.yml | 14 ++++++-------- 2 files changed, 8 insertions(+), 10 deletions(-) diff --git a/infrastructure-playbooks/gather-ceph-logs.yml b/infrastructure-playbooks/gather-ceph-logs.yml index dbfb1688a..7d1b84072 100644 --- a/infrastructure-playbooks/gather-ceph-logs.yml +++ b/infrastructure-playbooks/gather-ceph-logs.yml @@ -15,13 +15,13 @@ tasks: - name: create a temp directory - local_action: - module: tempfile + tempfile: state: directory prefix: ceph_ansible run_once: true register: localtempfile become: false + delegate_to: localhost - name: set_fact lookup_ceph_config - lookup keys, conf and logs find: diff --git a/infrastructure-playbooks/purge-cluster.yml b/infrastructure-playbooks/purge-cluster.yml index f77bab475..d8c625bec 100644 --- a/infrastructure-playbooks/purge-cluster.yml +++ b/infrastructure-playbooks/purge-cluster.yml @@ -366,13 +366,13 @@ - name: wait for server to boot become: false - local_action: - module: wait_for + wait_for: port: 22 host: "{{ hostvars[inventory_hostname]['ansible_default_ipv4']['address'] }}" state: started delay: 10 timeout: 500 + delegate_to: localhost - name: remove data shell: rm -rf /var/lib/ceph/* @@ -444,9 +444,8 @@ ignore_errors: true - name: is reboot needed - local_action: - module: command - echo requesting reboot + command: echo requesting reboot + delegate_to: localhost become: false notify: - restart machine @@ -824,10 +823,9 @@ state: absent - name: request data removal - local_action: - module: command - echo requesting data removal # noqa 301 + command: echo requesting data removal # noqa 301 become: false + delegate_to: localhost notify: remove data - name: purge dnf cache