- 浏览: 446452 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (369)
- javascript html (20)
- java (31)
- jquery (15)
- jcrop (0)
- JEECG (1)
- ajax (3)
- 反射 (3)
- VI (1)
- mysql (48)
- easyui (1)
- svn (2)
- MD5 加密 (1)
- spring (14)
- ORACLE (8)
- 经验总结 (1)
- TCP/IP协议 (1)
- ICMP协议 (1)
- eclipse (1)
- Reflect (1)
- linux (21)
- android (5)
- excel 操作 (1)
- java tree (1)
- html (1)
- plupload (1)
- mongodb (9)
- aes (1)
- python (1)
- java relax (1)
- highcharts (2)
- json (2)
- java 多线程 (30)
- maven (2)
- 设计模式 (1)
- jsp+js (2)
- 面向对象 (1)
- jvm (16)
- 缓存 (1)
- proxy (1)
- 聊侃 (1)
- 面经 (1)
- java 字节 (1)
- java 类加载器 (2)
- java 基础 (2)
- java 语法糖 (1)
- java 位运算 (1)
- 排序 (3)
- java 服务器性能优化 (19)
- 网络编程 (2)
- jvm 参数设置 (0)
- jersey (1)
- webservice (2)
- nginx+多tomcat 集成 (5)
- nginx (16)
- squid (3)
- memcached (5)
- 正则表达式 (1)
- 常用免费接口 (1)
- jpa (1)
- win7 (1)
- java处理大文件 (1)
- js正则表达式 (1)
- tomcat (1)
- java 敏感字 (1)
- 系统架构优化 (4)
- 学习 (1)
- 本地测试QQ微博第三方登陆 (1)
- java 错误 (1)
- 微信支付 (1)
- https (1)
- httpclient (1)
- awk (2)
- loadrunner (1)
- sql server 2008 (3)
- git (4)
- sql server2008 (1)
- solr (2)
- centos (1)
- 数据存储架构 (3)
- log4j (1)
- weboffice (1)
- 并发编程 (1)
- postgreSQL (0)
- ssl (1)
- openssl (1)
- activeMQ (2)
- IDEA (1)
- shell (1)
- ansible (4)
- docker (2)
- grafana (1)
- jmeter (1)
- TLS (1)
- 将博客搬至CSDN (1)
最新评论
-
dida1990:
啊喔,过去了这么久,不过还是评一个。谁说uuid的hashCo ...
高并发生成订单号(二) -
annan211:
yclovesun 写道使用了uuid,为什么还要machin ...
高并发生成订单号(二) -
yclovesun:
使用了uuid,为什么还要machineId?uuid已经可以 ...
高并发生成订单号(二) -
u013280917:
太深奥,看不懂
mysql优化特定类型的查询
python jinja2 generator two or more template file
- 博客分类:
- ansible
task
- name: create manifest directory file: state: directory path: "{{pushgateway_manifest_dir}}" - name: generator pushgateway manifest template: src: "pushgateway-scale.json.j2" dest: "{{pushgateway_manifest_dir}}/pushgateway-scale-{{item}}.json" when: '"pushgateway" in groups and env_list is defined' with_items: "{{ env_list }}" ## 必须数组 vars: current_env: "{{ item }}" - name: generator pushgateway test manifest template: src: "pushgateway-test.json.j2" dest: "{{pushgateway_manifest_dir}}/pushgateway-test-{{item}}.json" when: '"pushgateway" in groups and env_list is defined' with_items: "{{ env_list }}" vars: current_env: "{{ item }}"
host inventry
prometheus: children: prom_group_1: hosts: 192.168.99.4: prometheus_external_domain: http://192.168.99.4:9090 192.168.99.15: prometheus_external_domain: http://192.168.99.15:9090 vars: vm: - prometheus - alertmanager - cassandra - kafka vm_env: - qa - test1 pushgateway: - uvp - am pushgateway_env: - qa - test1 prom_group_2: hosts: 192.168.99.18: prometheus_external_domain: http://192.168.99.18:9090 192.168.99.16: prometheus_external_domain: http://192.168.99.16:9090 vars: vm: - prometheus - alertmanager - cassandra - kafka vm_env: - test1 pushgateway: - uvp - am pushgateway_env: - test1 pushgateway: vars: env_list: - qa - test children: pgw-group-1: hosts: pushgateway1: expose_ports: push: 12001 scrape: 13001 pushgateway2: expose_ports: push: 12002 scrape: 13002 pushgateway3: expose_ports: push: 12003 scrape: 13003 vars: env: qa host_ip: 192.168.101.6 cluster_url: cluster.com pgw-group-2: hosts: pushgateway4: expose_ports: scrape: 12004 push: 13004 pushgateway5: expose_ports: scrape: 12005 push: 13005 vars: env: test host_ip: 192.168.101.6 cluster_url: cluster.com alertmanager: children: am_ha_g1: hosts: 192.168.99.6: alertmanager_cluster_listen_address: 192.168.99.6:8001 alertmanager_external_domain: http://192.168.99.6:9093 192.168.99.17: alertmanager_cluster_listen_address: 192.168.99.17:8001 alertmanager_peers: 192.168.99.17:8001 alertmanager_external_domain: http://192.168.99.17:9093 vars: listen_port: 9093 alertmanager_cluster_port: 8001
template1
{% set counter = [] %} {% set job_counter = [] %} {% for pgw in groups['pushgateway'] %} {% if hostvars[pgw]['env'] == current_env%} {% if counter.append(1) %}{% endif %} {% endif %} {% endfor %} {"services": { {% if groups['pushgateway'] is defined%} {% set index = 0 %} {% for host in groups['pushgateway'] %} {% if hostvars[host]['env'] == current_env%} {% set push_groups_last = loop.last%} "service::${APCERA_DEPLOY_NAMESPACE}::nginx-{{hostvars[host]['host_ip']}}-{{hostvars[host]['expose_ports']['scrape']}}-service": { "description": "Nginx-{{host}} Generic Service http://{{hostvars[host]['host_ip']}}:{{hostvars[host]['expose_ports']['scrape']}}", "type": "generic", "params": { "url": "http://{{hostvars[host]['host_ip']}}:{{hostvars[host]['expose_ports']['scrape']}}" } } {% if index < counter|length %}, {% set index = index + 1 %}{% endif %} {% endif %} {%endfor%} {% endif %} "service::${APCERA_DEPLOY_NAMESPACE}::pushgateway-cluster-apcera-service": { "description": "pushgateway-cluster-apcera-service", "type": "generic", "params": { "url": "http://{%if ENV=='AWS' %}{{aws.pushgateway_cluster_service}}{%else%}{{cvc.pushgateway_cluster_service}}{%endif%}" } }}, "jobs":{ {% set job_index = 0 %} {% for host in groups['pushgateway'] %} {% if hostvars[host]['env'] == current_env%} "job::${APCERA_DEPLOY_NAMESPACE}::vas-pm-prometheus-pushgateway-node-{{hostvars[host]['host_ip']}}-{{hostvars[host]['expose_ports']['scrape']}}": { "docker": { "image": "${GLOBALENV_DOCKER_REGISTRY_BASE_URL}${IMAGE_NAME_TAG_VAS_PM_PROMETHEUS_PUSHGATEWAY}", "password": "${GLOBALENV_DOCKER_REGISTRY_PASSWORD}", "username": "${GLOBALENV_DOCKER_REGISTRY_USERNAME}" }, "exposed_ports": [ 80, 9091 ], "state": "started", "env": { "CLEANUP_INTERVAL_SECONDS": "60", "PUSHGATEWAY_URL": "http://pushgateway-node-{{hostvars[host]['host_ip']}}-{{hostvars[host]['expose_ports']['scrape']}}-{%if ENV=='AWS' %}{{aws.pushgateway_node_endpoint}}{%else%}{{cvc.pushgateway_node_endpoint}}{%endif%}", "METRIC_TIMEOUT_SECONDS": "{{metric_timeout}}", "NGINX_SERVER_LIST":"{% for nginx_host in groups['pushgateway'] %}{% if hostvars[nginx_host]['env'] == current_env%}server {{hostvars[nginx_host]['host_ip']}}:{{hostvars[nginx_host]['expose_ports']['push']}};{%endif%}{% endfor %}" }, "routes": [{ "type": "http", "endpoint": "pushgateway-node-{{hostvars[host]['host_ip']}}-{{hostvars[host]['expose_ports']['scrape']}}-{%if ENV=='AWS' %}{{aws.pushgateway_node_endpoint}}{%else%}{{cvc.pushgateway_node_endpoint}}{%endif%}", "config": { "/": [{ "port": 9091 }] } }, { "type": "http", "endpoint": "{{hostvars[host]['cluster_url']}}", "config": { "/": [{ "port": 9091 }] } }, { "type": "tcp", "endpoint": "{{hostvars[host]['host_ip']}}:{{hostvars[host]['expose_ports']['scrape']}}", "config": [{ "port": 9091 }] }, { "type": "tcp", "endpoint": "{{hostvars[host]['host_ip']}}:{{hostvars[host]['expose_ports']['push']}}", "config": [{ "port": 80 }] } ], "services": { {% set service_index = 1 %} {% for service_host in groups['pushgateway'] %} {% if hostvars[service_host]['env'] == current_env%} "NGINX-{{hostvars[service_host]['host_ip']}}-{{hostvars[service_host]['expose_ports']['scrape']}}-SERVICE": { "fqn": "service::${APCERA_DEPLOY_NAMESPACE}::nginx-{{hostvars[service_host]['host_ip']}}-{{hostvars[service_host]['expose_ports']['scrape']}}-service" } {% if service_index < counter|length %}, {% set service_index = service_index + 1 %}{% endif %} {% endif %} {%endfor%} "CLUSTER-SERVICE": { "fqn": "service::${APCERA_DEPLOY_NAMESPACE}::pushgateway-cluster-apcera-service" } } , "restart_mode": "always", "ssh": true, "start": { "timeout": 30 } } {% if job_counter.append(1) %}{% endif %} {% if job_counter|length < counter|length %}, {% endif %} {% endif %} {%endfor%} } }
template2
{% set counter = [] %} {% set route_counter = [] %} {% for pgw in groups['pushgateway'] %} {% if hostvars[pgw]['env'] == current_env%} {% if counter.append(1) %}{% endif %} {% endif %} {% endfor %} { "jobs": { "job::${APCERA_DEPLOY_NAMESPACE}::pushgateway-docker-auto-test": { "docker": { "image": "${GLOBALENV_DOCKER_REGISTRY_BASE_URL}${IMAGE_NAME_TAG_PUSHGATEWAY_DOCKER_AUTO_TEST}", "password": "${GLOBALENV_DOCKER_REGISTRY_PASSWORD}", "username": "${GLOBALENV_DOCKER_REGISTRY_USERNAME}" }, "exposed_ports": [80, 9093], "state": "started", "env": { "PROMETHEUS_PM_URI": "{%if ENV=='AWS' %}{{aws.pushgateway_cluster_service}}{%else%}{{cvc.pushgateway_cluster_service}}{%endif%}", "PUSHGATEWAY_IPS": "{% for host in groups['pushgateway'] %}{% if hostvars[host]['env'] == current_env%}{% set push_groups_last = loop.last%}pushgateway-node-{{hostvars[host]['host_ip']}}-{{hostvars[host]['expose_ports']['scrape']}}-{%if ENV=='AWS' %}{{aws.pushgateway_node_endpoint}}{%else%}{{cvc.pushgateway_node_endpoint}}{%endif%}{% if ( push_groups_last==False) %},{% endif %}{% endif %}{%endfor%}" }, "routes": [ { "type": "http", {% for host in groups['pushgateway'] %} {% if hostvars[host]['env'] == current_env and loop.index <=1 %} "endpoint": "{{hostvars[host]['cluster_url']}}", {% endif %} {%endfor%} "config": { "/": [{ "port": 80 }] } }, {% for host in groups['pushgateway'] %} {% if hostvars[host]['env'] == current_env%} { "type": "tcp", "endpoint": "{{hostvars[host]['host_ip']}}:{{hostvars[host]['expose_ports']['scrape']}}", "config": [{ "port": 80 }] } {% if route_counter.append(1) %}{% endif %} {% if route_counter|length < counter|length %}, {% endif %} {% endif %} {%endfor%} ], "services":{ {% set service_index = 0 %} {% for host in groups['pushgateway'] %} {% if hostvars[host]['env'] == current_env%} "NGINX-{{hostvars[host]['host_ip']}}-{{hostvars[host]['expose_ports']['scrape']}}-SERVICE": { "fqn": "service::${APCERA_DEPLOY_NAMESPACE}::nginx-{{hostvars[host]['host_ip']}}-{{hostvars[host]['expose_ports']['scrape']}}-service" } {% set service_index = service_index + 1 %} {% if service_index < counter|length %}, {% endif %} {% endif %} {%endfor%} "CLUSTER-SERVICE": { "fqn": "service::${APCERA_DEPLOY_NAMESPACE}::pushgateway-cluster-apcera-service" } }, "restart_mode": "always", "ssh": true, "start": { "timeout": 30 } } } }
相关推荐
python-jinja2-26-2.6-3.el6.noarch.rpm
Jinja2 is a full featured template engine for Python. It has full unicode support, an optional integrated sandboxed execution environment, widely used and BSD licensed.
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
JinjaSQL:使用Jinja模板生成SQL,而不用担心SQL注入
主要介绍了python 利用jinja2模板生成html代码实例,文中通过示例代码介绍的非常详细,对大家的学习或者工作具有一定的参考学习价值,需要的朋友可以参考下
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
python jinja2简单示例 css效果 多级菜单实现效果 学习python
在windows下编译px4固件出错,下载此文件cd到此文件目录,然后python setup.py install即可。
python库,解压后可用。 资源全名:jinja2_ospath-0.1.0-py2.py3-none-any.whl
官方离线安装包,亲测可用。使用rpm -ivh [rpm完整包名] 进行安装
Jinja2 是一个 Python 的功能齐全的模板引擎。它有完整的 unicode 支持,一个可选 的集成沙箱执行环境,被广泛使用,以 BSD 许可证授权。
python库。 资源全名:pyramid_jinja2-1.9.zip
Jinja2是纯Python的模板引擎,它提供了Django启发的非XML语法,但支持内联表达式和可选的沙盒环境。
官方离线安装包,测试可用。使用rpm -ivh [rpm完整包名] 进行安装
资源分类:Python库 所属语言:Python 资源全名:aiohttp_jinja2-0.3.0.tar.gz 资源来源:官方 安装方法:https://lanzao.blog.csdn.net/article/details/101784059
Jinja2 Extension for Python导入关键字 因此,我们不必只为简单功能编写新的jinja2过滤器。 它暴露出了一种强大的武器,可以射杀您的脚,使用风险自负! 用法 执行“ echo hello” shell命令并获取输出 from ...
使用docx作为jinja2模板 介绍 该软件包使用2个主要软件包: 用于读取,编写和创建子文档的python-docx jinja2用于管理插入到模板docx中的标签 之所以创建python-docx-template,是因为python-docx具有创建文档但...
使用Python和Jinja的Cisco配置模板启动python config_generator . py
主要介绍了python+jinja2实现接口数据批量生成工具的操作方法,本文给大家介绍的非常详细,具有一定的参考借鉴价值,需要的朋友可以参考下