From: nicoo Date: Wed, 13 Jun 2018 17:36:28 +0000 (+0200) Subject: vm/install: Handle non-22000 SSH ports X-Git-Url: https://git.realraum.at/?a=commitdiff_plain;h=6c8cf34665615f599a5717d9d97ccf322fda4473;p=noc.git vm/install: Handle non-22000 SSH ports --- diff --git a/ansible/hosts.ini b/ansible/hosts.ini index d67f69e..c165125 100644 --- a/ansible/hosts.ini +++ b/ansible/hosts.ini @@ -2,6 +2,8 @@ host_domain=realraum.at ansible_host={{ inventory_hostname }}.{{ host_domain }} ansible_user=root +ansible_port=22000 + [net-zone-mgmt] torwaechter diff --git a/ansible/roles/vm/install/templates/preseed_debian-stretch.cfg.j2 b/ansible/roles/vm/install/templates/preseed_debian-stretch.cfg.j2 index 6cf4b9b..d802418 100644 --- a/ansible/roles/vm/install/templates/preseed_debian-stretch.cfg.j2 +++ b/ansible/roles/vm/install/templates/preseed_debian-stretch.cfg.j2 @@ -105,4 +105,6 @@ d-i preseed/late_command string \ in-target bash -c "passwd -d root && passwd -l root"; \ mkdir -p -m 0700 /target/root/.ssh; \ cp /authorized_keys /target/root/.ssh/; \ - in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port 22000/' -i /etc/ssh/sshd_config" +{% if hostvars[vmname].ansible_port is defined %} + in-target bash -c "sed -e 's/^\(\s*#*\s*Port.*\)/Port {{ hostvars[vmname].ansible_port }}/' -i /etc/ssh/sshd_config" +{% endif %}