Answers: <pre><code>pip install --upgrade ansible-lint&gt;=4.1.0
  </code></pre>
  
  <p>Rule 405 has been dropped following the discussion in <a href="https://github.com/ansible/ansible-lint/issues/456" rel="nofollow noreferrer">https://github.com/ansible/ansible-lint/issues/456</a></p>
  
Answers: CC BY-SA 4.0
Answers: 2019-05-14T05:29:31.670Z
Answers: 2019-05-14T05:29:31.670Z
Answers: bbaassssiiee
Answers: <p><code>ansible-lint</code> warning <code>405</code> can be quite irritating as in certain cases, i.e. when running locally retrying is very unlikely to make any difference.  Actually resolving it is normally simply a case of adding the following:</p>
  
  <pre><code>register: task_result
  until: task_result is success
  retries: 10
  delay: 2
  </code></pre>
  
  <p>When this is added to task Ansible will retry ten times with a delay of two seconds between each retry until the <code>returncode</code> is <code>0</code>.</p>
  
Answers: CC BY-SA 4.0
Answers: 2019-02-04T15:41:38.943Z
Answers: 1% is a huge numer if you the numeber operations done during a deployment. Even 1/1000 would be high enough to request a retry logic. Do not forget the multiplication factor and the cost of a failure.
Answers: sorin
Answers: CC BY-SA 4.0
Answers: 2019-01-04T03:35:41.983Z
Answers: Seems like an extremely nitpicky rule to me... there are some cases where this would be nice to have, but in the real world I think I've seen this on package-related tasks maybe < 1% of the time. Which is why I've opened [405 Remote package tasks should have a retry - too nitpicky?](https://github.com/ansible/ansible-lint/issues/456)
Answers: geerlingguy
Answers: CC BY-SA 4.0
Answers: 2019-01-04T17:44:06.827Z
Answers: I don’t think it’s too nit picky - I find more often than not I add extra lines just to appease Ansible-lint rather than to deliver value, this seems wrong.  Retry by default seems sensible.
Answers: Richard Slater
Answers: CC BY-SA 4.0
Answers: 2018-12-27T15:13:55.397Z
Answers: 2018-12-28T14:44:21.980Z
Answers: 2018-12-28T14:44:21.980Z
Answers: Richard Slater
Body: <blockquote>
    <p><a href="https://github.com/ansible/ansible-lint/blob/master/docs/docsite/rst/rules/default_rules.rst" rel="noreferrer">E405</a> v4.0.0   Remote package tasks should have a retry    Package
    operations are unreliable as they require network communication and
    the availability of remote servers. To mitigate the potential
    problems, retries should be used via register: my_result and until:
    my_result | success</p>
  </blockquote>
  
  <p>This shows up when running <code>ansible-lint</code> as the following error:</p>
  
  <pre><code>[405] Remote package tasks should have a retry
  plays/sample.yml:31
  Task/Handler: Install list of packages
  </code></pre>
  
  <p>Given the sample code:</p>
  
  <pre><code>- name: Install list of packages
    apt:
      name: [jq, vim, curl, unzip, dnsutils]
      state: present
  </code></pre>
  
  <p>How to solve this?</p>
  
Tags: <ansible>
Title: How to solve "E405: Remote package tasks should have a retry" in Ansible?
UserDisplayName: 030
ThreadText: # How to solve "E405: Remote package tasks should have a retry" in Ansible?
  
  (Asked by: username_0 on 2018-12-26)
  
  > [E405](https://github.com/ansible/ansible-lint/blob/master/docs/docsite/rst/rules/default_rules.rst) v4.0.0 Remote package tasks should have a retry Package
  > operations are unreliable as they require network communication and
  > the availability of remote servers. To mitigate the potential
  > problems, retries should be used via register: my\_result and until:
  > my\_result | success
  
  This shows up when running `ansible-lint` as the following error:
  
  ```
  [405] Remote package tasks should have a retry
  plays/sample.yml:31
  Task/Handler: Install list of packages
  
  ```
  
  Given the sample code:
  
  ```
  - name: Install list of packages
    apt:
      name: [jq, vim, curl, unzip, dnsutils]
      state: present
  
  ```
  
  How to solve this?
  
  **Tags:** ansible
  
  
  ---
  
  ## 2 answers
  
  ### Answer by username_2 on 2018-12-27. Score: 8 | Accepted answer
  
  `ansible-lint` warning `405` can be quite irritating as in certain cases, i.e. when running locally retrying is very unlikely to make any difference. Actually resolving it is normally simply a case of adding the following:
  
  ```
  register: task_result
  until: task_result is success
  retries: 10
  delay: 2
  
  ```
  
  When this is added to task Ansible will retry ten times with a delay of two seconds between each retry until the `returncode` is `0`.
  
  > **Comments:**
  > **username_4**: Seems like an extremely nitpicky rule to me... there are some cases where this would be nice to have, but in the real world I think I've seen this on package-related tasks maybe < 1% of the time. Which is why I've opened [405 Remote package tasks should have a retry - too nitpicky?](https://github.com/ansible/ansible-lint/issues/456)  
  > **username_2**: I don’t think it’s too nit picky - I find more often than not I add extra lines just to appease Ansible-lint rather than to deliver value, this seems wrong.  Retry by default seems sensible.  
  > **username_3**: 1% is a huge numer if you the numeber operations done during a deployment. Even 1/1000 would be high enough to request a retry logic. Do not forget the multiplication factor and the cost of a failure.  
  
  ---
  
  ### Answer by username_1 on 2019-05-14. Score: 0
  
  ```
  pip install --upgrade ansible-lint>=4.1.0
  
  ```
  
  Rule 405 has been dropped following the discussion in <https://github.com/ansible/ansible-lint/issues/456>
  
  
  ---
  
  