Merge "ansible-lint: fix error 504"

This commit is contained in:
Zuul 2020-09-01 08:56:41 +00:00 committed by Gerrit Code Review
commit 640f92743f
3 changed files with 12 additions and 5 deletions

View File

@ -3,7 +3,6 @@ skip_list:
- '208' # File permissions not mentioned
- '301' # Commands should not change things if nothing needs doing
- '502' # All tasks should be named
- '504' # Do not use 'local_action', use 'delegate_to: localhost'
- '601' # Don't compare to literal True/False
- '602' # Don't compare to empty string
- '701' # meta/main.yml should contain relevant info

View File

@ -13,13 +13,17 @@
# limitations under the License.
---
- name: "Defined ssh_public_key_path - Check to see if there is a file where the ssh_public_key_path is defined"
local_action: stat path={{ ssh_public_key_path }}
stat:
path: "{{ ssh_public_key_path }}"
register: test_ssh_public_key_path
when: ssh_public_key_path is defined
delegate_to: localhost
- name: "Defined ssh_public_key_path - Error if ssh_public_key_path is not valid"
local_action: fail msg="ssh_public_key_path is not valid."
fail:
msg: "ssh_public_key_path is not valid."
when: test_ssh_public_key_path.stat.exists == false
delegate_to: localhost
- name: "Defined ssh_public_key_path - Read SSH public key in"
set_fact: ssh_public_key="{{ lookup('file', ssh_public_key_path ) }}"

View File

@ -1,11 +1,15 @@
---
- name: "Defined ssh_private_key_path - Check to see if there is a file where the ssh_private_key_path is defined"
local_action: stat path={{ ssh_private_key_path }}
stat:
path: "{{ ssh_private_key_path }}"
register: test_ssh_private_key_path
delegate_to: localhost
- name: "Defined ssh_private_key_path - Error if ssh_private_key_path is not valid"
local_action: fail msg="ssh_private_key_path is not valid."
fail:
msg: "ssh_private_key_path is not valid."
when: test_ssh_private_key_path.stat.exists == false
delegate_to: localhost
- name: "Defined ssh_private_key_path - Read SSH private key in"
set_fact: ssh_private_key="{{ lookup('file', ssh_private_key_path ) }}"