diff --git a/training/practica-3-jinja2/apache2/files/hosts.conf b/training/practica-3-jinja2/apache2/files/hosts.conf deleted file mode 100644 index bf91612..0000000 --- a/training/practica-3-jinja2/apache2/files/hosts.conf +++ /dev/null @@ -1,16 +0,0 @@ - - ServerAdmin webmaster@ansible.local - ServerName ansible.local - ServerAlias www.ansible.local - - DocumentRoot /var/www/html - - ErrorLog ${APACHE_LOG_DIR}/ansible.local_error.log - CustomLog ${APACHE_LOG_DIR}/ansible.local_access.log combined - - - Options Indexes FollowSymLinks - AllowOverride All - Require all granted - - \ No newline at end of file diff --git a/training/practica-3-jinja2/apache2/tasks/main.yml b/training/practica-3-jinja2/apache2/tasks/main.yml index 285df95..4fcd9c3 100644 --- a/training/practica-3-jinja2/apache2/tasks/main.yml +++ b/training/practica-3-jinja2/apache2/tasks/main.yml @@ -30,7 +30,7 @@ #Copia el archivo de configuración hosts de Apache2 al directorio correspondiente - name: Copiar archivo de configuración de hosts de Apache2 ansible.builtin.copy: - src: ../files/hosts.conf #Ruta al archivo de configuración local + src: ../templates/hosts.con.j2 #Ruta al archivo de configuración local dest: /etc/apache2/sites-available/000-default.conf #Ruta de destino en el servidor owner: www-data #Propietario del archivo group: www-data #Grupo del archivo diff --git a/training/practica-3-jinja2/apache2/templates/hosts.conf.j2 b/training/practica-3-jinja2/apache2/templates/hosts.conf.j2 new file mode 100644 index 0000000..59e0f63 --- /dev/null +++ b/training/practica-3-jinja2/apache2/templates/hosts.conf.j2 @@ -0,0 +1,16 @@ + + ServerAdmin {{ ansible_hostname }}@{{ ansible_domain }} + ServerName {{ ansible_hostname }}.{{ ansible_domain }} + ServerAlias {{ ansible_hostname }}.{{ ansible_domain }} + + DocumentRoot /var/www/html + + ErrorLog ${APACHE_LOG_DIR}/{{ ansible_hostname }}_error.log + CustomLog ${APACHE_LOG_DIR}/{{ ansible_hostname }}.log combined + + + Options Indexes FollowSymLinks + AllowOverride All + Require all granted + + \ No newline at end of file