Hi List,
I’m currently trying to roll out a default /etc/apt/sources.list and add “deb” lines to it for specific hosts.
The template sources.j2 looks like this:
#############################################################
################### OFFICIAL UBUNTU REPOS ###################
#############################################################
Ubuntu Main Repos
deb http://nl.archive.ubuntu.com/ubuntu/ {{ ansible_distribution_release }} main restricted universe multiverse
Ubuntu Update Repos
deb http://nl.archive.ubuntu.com/ubuntu/ {{ ansible_distribution_release }}-security main restricted universe multiverse
deb http://nl.archive.ubuntu.com/ubuntu/ {{ ansible_distribution_release }}-updates main restricted universe multiverse
Ubuntu Partner Repo
deb http://archive.canonical.com/ubuntu {{ ansible_distribution_release }} partner
deb-src http://archive.canonical.com/ubuntu {{ ansible_distribution_release }} partner
Ubuntu Opsview Repo
deb https://XXXXXX:XXXXXXXX@downloads.opsview.com/opsview-commercial/latest/apt {{ ansible_distribution_release }} main
{% for item in extra-apt-lines %}
{{ item }}
{% endfor %}
And one of the host_vars has this added to it:
extra-apt-lines:
- deb http://oss.oracle.com/debian unstable main non-free
The task itself, ofcourse:
- name: APT | Kopieer apt-sources config
action: template src=~/playbooks/templates/sources.j2 dest=/etc/apt/sources.list owner=root group=root mode=0644
notify:
- reload apt
tags:
- apt
When I run this, I get this error message:
fatal: [xmgtansible] => {‘msg’: “unsupported operand type(s) for -: ‘Undefined’ and ‘Undefined’”, ‘failed’: True}
I’m trying to base this of: http://jinja.pocoo.org/docs/templates/
Any suggestions?
Thanks!
Mark