Project

General

Profile

Actions

Bug #697

closed

Fix "Found variable using reserved name: port" (ansible-role-ssh role)

Added by Pierre-Louis Bonicoli almost 4 years ago. Updated over 3 years ago.

Status:
Resolved
Priority:
Normal
Category:
-
Start date:
2020-05-07
Due date:
% Done:

0%

Estimated time:
Patch Available:
Confirmed:
No
Branch:
dont_use_reserved_name_port
Entity:
DuckCorp
Security:
Help Needed:

Description

ansible-role-ssh: Don't use reserved name 'port'

Fix this warning:

[WARNING]: Found variable using reserved name: port

Once merged the following patch will be required on the main repository:

--- a/ansible/roles/dc-base/tasks/main.yml
+++ b/ansible/roles/dc-base/tasks/main.yml
@@ -52,7 +52,7 @@
   import_role:
     name: ssh
   vars:
-    port: "{{ ssh.port }}" 
+    sshd_port: "{{ ssh.port }}" 
     listen_addresses: "{{ ssh.listen_addresses }}" 
     # for GuiHome streaming
     enable_gatewayports: "{{ inventory_hostname == 'Toushirou' }}" 

Actions #1

Updated by Marc Dequènes almost 4 years ago

I agree this is an annoying message, but as far as I can read in the Ansible documentation this is not a reserved variable. So maybe it's a mistake but it needs to be clarified first.

If it happens to be a documentation mistake, then I'd like to understand what this variable is used for since I have no recollection of any base Ansible feature using it and never stumbled into any conflict.

I would also point out that this PR does not change all occurrences of port (for DC at least the coturn role is in the same situation); I know it's in the issue title and maybe you planned more updates, just to keep this in mind.

Actions #2

Updated by Pierre-Louis Bonicoli almost 4 years ago

It looks like this warning exists since Ansible 2.3.

I proposed this PR https://github.com/ansible/ansible/pull/69585 in order to document the current behavior.

Actions #3

Updated by Marc Dequènes over 3 years ago

Thanks for the explanation and Ansible PR, because it really looked like a mistake int he warning function. I had no idea play's parameters were like variables and I did not know there was a `port` parameter either. I honestly do not get why it conflicts with role variables, probably some internal mystery but having certain very handy word taken from us is really annoying.

Merge. I adapted `roles/dc-base/tasks/main.yml` accordingly.

I spotted at least one remaining case.

Actions #4

Updated by Marc Dequènes over 3 years ago

  • Status changed from In Progress to Resolved
Actions

Also available in: Atom PDF