Hi,
I'm using a simple template to generate sshd_config. It works well for
a single operating system, but when I try to add a second it breaks.
It appears that the jinja2 template is not pulling in the group_vars
for the operating system group.
Here's a playbook snippet:
- name: sshd configuration file update
template: src=/home/ansible/crossplatform/etc/ssh/common-sshd_config.j2
dest=/etc/ssh/sshd_config
backup=yes
owner=0 group=0 mode=0644
validate='/usr/sbin/sshd -T -f %s'
notify:
- restart sshd
When I run this task, I get:
TASK: [sshd configuration file update] ****************************************
fatal: [mwltest3.lodden.com] => {'msg': "unsupported operand type(s) for -: 'StrictUndefined' and 'StrictUndefined'", 'failed': True}
fatal: [mwltest3.lodden.com] => {'msg': "unsupported operand type(s) for -: 'StrictUndefined' and 'StrictUndefined'", 'failed': True}
FATAL: all hosts have already failed -- aborting
As far as I can see, this means that some variable is undefined in the
template.
The template is:
#$Id$
#{{ ansible_managed }}
ListenAddress {{ ansible_ssh_host }}
AuthorizedKeysFile /etc/ssh/authorized_keys/%u
PasswordAuthentication no
ChallengeResponseAuthentication no
UsePAM yes
Subsystem sftp {{ program-sftp-server }}
I have group_vars/freebsd and group_vars/ubuntu files, and these files
define the program-sftp-server variable like so