Hello,
I have a template statement:
- name: Setup apache config for site
template: src=generic_site.j2 dest=/etc/apache2/sites-available/{{ item }} group=root owner=root
with_items: ${sites}
#where sites are: sites: [website1, website2]
This allows me to create the 2 site files /etc/apache2/sites-available/website1 and /etc/apache2/sites-available/website2
What I would really like to do is to be able to use the {{ item }} inside the generic_site.j2 for the configuration of the file.
Like this:
<VirtualHost *:80>
ServerName {{ item }}
ServerAlias {{ item }}
DocumentRoot /var/www/{{ item }}
Options FollowSymLinks AllowOverride None<Directory “/var/www/{{ item }}”>
Options Indexes FollowSymLinks MultiViews
AllowOverride None
Order allow,deny
allow from all
ScriptAlias /cgi-bin/ /usr/lib/cgi-bin/
<Directory “/usr/lib/cgi-bin”>
AllowOverride None
Options +ExecCGI -MultiViews +SymLinksIfOwnerMatch
Order allow,deny
Allow from all
ErrorLog ${APACHE_LOG_DIR}/{{ item }}/error.log
Possible values include: debug, info, notice, warn, error, crit,
alert, emerg.
LogLevel warn
CustomLog ${APACHE_LOG_DIR}/{{ item }}/access.log combined
But when I do this, the values are all empty. Any help would be greatly appreciated!!
Thanks,
Brent