Инструменты пользователя

Инструменты сайта


шаблонизатор_jinja2

**Это старая версия документа!**

пример использования генератора шаблонов

playbook


- name : install apache and upload web page

hosts: server1
become: yes 
vars:
 source_file: ./mysite2/index.j2
 dest_file : /var/www/html/index.html
tasks: 
- name: Install Apache 
  yum: name=httpd state=latest 
 
- name: Generate index.html for servers
  template: src={{ source_file }} dest={{dest_file}}
  notify: restart apache 
  1. name: start and enable httpd
service: name=httpd state=started enabled=yes 
handlers:
- name : restart apache
  service: name=httpd state=restarted 
                                       

<!DOCTYPE html> <head> <title>be1.ru</title> </head> <body> <p>Ansible deploy</p>   <p>Данная страница работает на сервере с ip адресом {{ansible_default_ipv4.address}}</p>   <p>На операционной системе linux {{ansible_os_family}}</p>   <p>&nbsp;</p> </body>

шаблонизатор_jinja2.1579776669.txt.gz · Последнее изменение: 2020/01/23 13:51 (внешнее изменение)

DokuWiki Appliance - Powered by TurnKey Linux