- 浏览: 446482 次
- 性别:
- 来自: 广州
文章分类
- 全部博客 (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优化特定类型的查询
Ansible 根据主机的不同,有时候需要处理不同的场景,例如存在如下场景,配置多台VM的Compoment 不同的 TLS证书和Password。
inventory 文件
configure.yml 文件
vars 变量文件
common/connector-mqtt-tls-enable.yml
common/connector-http-tls-enable.yml
Result
第二种方式
inventory 文件
vars 变量文件
configure.yml文件
common/connector-mqtt-tls-enable.yml
common/connector-http-tls-enable.yml
结果是一样的
inventory 文件
[dispatcher-connector] 192.168.99.17 192.168.99.5 [dispatcher-manager] 192.168.99.17 [dispatcher-tools] 192.168.99.17
configure.yml 文件
--- - name: tls enable for connector hosts: dispatcher-connector vars_files: - ./vars/dispatcher.yml vars: certs_store_path: "{{ connector_certs_dir }}" configure_file: "{{ dispatcher_installation_home }}/dispatcher/dispatcher-connector/conf/connector.properties" become: yes become_user: root tasks: - debug: var=hostvars[inventory_hostname]['ansible_default_ipv4']['address'] - debug: var=connector_mqtt[hostvars[inventory_hostname]['ansible_default_ipv4']['address']]['ssl.keystore.location'] - debug: var={{connector_mqtt_key_store_password_base64[inventory_hostname]}} - name: add mqtt configure tls config include: "{{ playbook_dir }}/common/connector-mqtt-tls-enable.yml" when: connector_mqtt_tls_enable - name: add http configure tls config include: "{{ playbook_dir }}/common/connector-http-tls-enable.yml" when: connector_http_tls_enable tags: dispatcher-connector
vars 变量文件
############################## Dispatcher Installation Basic Info ############### latest_version: 4.1.1 origin_version: 4.1.1 dispatcher_installation_home: /opt/ddi/dispatcher dispatcher_user_name: dispatcher dispatcher_group_name: dispatcher dispatcher_user_home: /home/dispatcher dispatcher_connector_http_host: "{{ groups['dispatcher-connector'][0] }}" ############################## Dispatcher EP Installation Info ################# connector_ep_list: manager_ep_list: connector_lib_dir: "{{ dispatcher_installation_home }}/dispatcher-{{ latest_version }}/dispatcher-connector/lib" manager_lib_dir: "{{ dispatcher_installation_home }}/dispatcher-{{ latest_version }}/dispatcher-manager/webapps/WEB-INF/lib" certs_from_path: "{{ playbook_dir }}/files" connector_certs_dir: "{{ dispatcher_installation_home }}/dispatcher-{{ latest_version }}/dispatcher-connector/conf/certs" manager_certs_dir: "{{ dispatcher_installation_home }}/dispatcher-{{ latest_version }}/dispatcher-manager/conf/certs" tools_certs_dir: "{{ dispatcher_installation_home }}/dispatcher-{{ latest_version }}/dispatcher-tools/cli/conf/certs" ############################## tls setting for dispatcher ###################### connector_mqtt_tls_enable: true connector_mqtt: 192.168.99.17: key_store_password_base64: MTEyMjMz key_manager_password_base64: MTEyMjMz trust_store_password_base64: Y2hhbmdlaXQ= ssl.keystore.location: "/opt/connector-mqtt.server.keystore.jks" ssl.truststore.location: "/opt/connector-mqtt.server.truststore.jks" 192.168.99.5: key_store_password_base64: MTEyMjMz key_manager_password_base64: MTEyMjMz trust_store_password_base64: Y2hhbmdlaXQ= ssl.keystore.location: "/opt/connector-mqtt.server.keystore.jks" ssl.truststore.location: "/opt/connector-mqtt.server.truststore.jks" connector_http_tls_enable: true connector_http: 192.168.99.17: key_store_password_base64: MTEyMjMz key_manager_password_base64: MTEyMjMz trust_store_password_base64: Y2hhbmdlaXQ= ssl.keystore.location: "{{ playbook_dir }}/files/192.168.99.17/connector-mqtt.server.keystore.jks" ssl.truststore.location: "{{ playbook_dir }}/files/192.168.99.17/connector-mqtt.server.truststore.jks" 192.168.99.5: key_store_password_base64: MTEyMjMz key_manager_password_base64: MTEyMjMz trust_store_password_base64: Y2hhbmdlaXQ= ssl.keystore.location: "{{ playbook_dir }}/files/192.168.99.5/connector-mqtt.server.keystore.jks" ssl.truststore.location: "{{ playbook_dir }}/files/192.168.99.5/connector-mqtt.server.truststore.jks" #connector_mqtt_key_store_password_base64: MTEyMjMz #connector_mqtt_key_manager_password_base64: MTEyMjMz #connector_mqtt_trust_store_password_base64: Y2hhbmdlaXQ= #connector_http_key_store_password_base64: MTEyMjMz #connector_http_key_manager_password_base64: MTEyMjMz #connector_http_trust_store_password_base64: Y2hhbmdlaXQ= connectivity_https_port: 8443 monitor_https_port: 8444 connectivity_http_port: 8080 monitor_http_port: 8161
common/connector-mqtt-tls-enable.yml
--- - name: create certs store directory file: path: "{{ certs_store_path }}" owner: dispatcher group: dispatcher state: directory - name: copy dispatcher-connector keystore certs copy: src: "{{ connector_mqtt[hostvars[inventory_hostname]['ansible_default_ipv4']['address']]['ssl.keystore.location'] }}" dest: "{{ certs_store_path }}/connector-mqtt.server.keystore.jks" mode: 0644 - name: copy dispatcher-connector truststore certs copy: src: "{{ connector_mqtt[hostvars[inventory_hostname]['ansible_default_ipv4']['address']]['ssl.truststore.location'] }}" dest: "{{ certs_store_path }}/connector-mqtt.server.truststore.jks" mode: 0644 - name: modify connector keystore path if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.key.store.path=\s*/?\w+' line: 'mqtt.ssl.key.store.path={{ certs_store_path }}/connector-mqtt.server.keystore.jks' backrefs: yes backup: yes state: present - name: add connector keystore path if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.key.store.path=\s*/?\w+' line: 'mqtt.ssl.key.store.path={{ certs_store_path }}/connector-mqtt.server.keystore.jks' insertafter: '^mqtt.authentication.certificate.deviceId.key' state: present - name: modify connector keystore password if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.key.store.password=\s*/?\w+' line: "mqtt.ssl.key.store.password={{ connector_mqtt[hostvars[inventory_hostname]['ansible_default_ipv4']['address']]['key_store_password_base64'] }}" backrefs: yes backup: yes state: present - name: add connector keystore password if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.key.store.password=\s*/?\w+' line: "mqtt.ssl.key.store.password={{ connector_mqtt[hostvars[inventory_hostname]['ansible_default_ipv4']['address']]['key_store_password_base64'] }}" insertafter: '^mqtt.ssl.key.store.path' state: present - name: modify connector key manager password if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.key.manager.password=\s*/?\w+' line: "mqtt.ssl.key.manager.password={{ connector_mqtt[hostvars[inventory_hostname]['ansible_default_ipv4']['address']]['key_manager_password_base64'] }}" backrefs: yes backup: yes state: present - name: add connector keystore password if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.key.manager.password=\s*/?\w+' line: "mqtt.ssl.key.manager.password={{ connector_mqtt[hostvars[inventory_hostname]['ansible_default_ipv4']['address']]['key_manager_password_base64'] }}" insertafter: '^mqtt.ssl.key.store.password' state: present - name: modify connector truststore path if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.trust.store.path=\s*/?\w+' line: 'mqtt.ssl.trust.store.path={{ certs_store_path }}/connector-mqtt.server.truststore.jks' backrefs: yes backup: yes state: present - name: add connector truststore path if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.trust.store.path=\s*/?\w+' line: 'mqtt.ssl.trust.store.path={{ certs_store_path }}/connector-mqtt.server.truststore.jks' insertafter: '^mqtt.ssl.key.manager.password' state: present - name: modify connector truststore password if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.trust.store.password=\s*/?\w+' line: "mqtt.ssl.trust.store.password={{ connector_mqtt[hostvars[inventory_hostname]['ansible_default_ipv4']['address']]['trust_store_password_base64'] }}" backrefs: yes backup: yes state: present - name: add connector truststore password if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.trust.store.password=\s*/?\w+' line: "mqtt.ssl.trust.store.password={{ connector_mqtt[hostvars[inventory_hostname]['ansible_default_ipv4']['address']]['trust_store_password_base64'] }}" insertafter: '^mqtt.ssl.trust.store.path' state: present
common/connector-http-tls-enable.yml
--- - name: create certs store directory file: path: "{{ certs_store_path }}" owner: dispatcher group: dispatcher state: directory - name: copy dispatcher-connector keystore certs copy: src: "{{ connector_http[hostvars[inventory_hostname]['ansible_default_ipv4']['address']]['ssl.keystore.location'] }}" dest: "{{ certs_store_path }}/connector-http.server.keystore.jks" mode: 0644 - name: copy dispatcher-connector truststore certs copy: src: "{{ connector_http[hostvars[inventory_hostname]['ansible_default_ipv4']['address']]['ssl.truststore.location'] }}" dest: "{{ certs_store_path }}/connector-http.server.truststore.jks" mode: 0644 - name: modify connector keystore path if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.key.store.path=\s*/?\w+' line: 'http.ssl.key.store.path={{ certs_store_path }}/connector-http.server.keystore.jks' backrefs: yes backup: yes state: present - name: add connector keystore path if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.key.store.path=\s*/?\w+' line: 'http.ssl.key.store.path={{ certs_store_path }}/connector-http.server.keystore.jks' insertafter: '^mqtt.ssl.trust.store.password' state: present - name: modify connector keystore password if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.key.store.password=\s*/?\w+' line: "http.ssl.key.store.password={{ connector_http[hostvars[inventory_hostname]['ansible_default_ipv4']['address']]['key_store_password_base64'] }}" backrefs: yes backup: yes state: present - name: add connector keystore password for http if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.key.store.password=\s*/?\w+' line: "http.ssl.key.store.password={{ connector_http[hostvars[inventory_hostname]['ansible_default_ipv4']['address']]['key_store_password_base64'] }}" insertafter: '^http.ssl.key.store.path' state: present - name: modify connector key manager password for http if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.key.manager.password=\s*/?\w+' line: "http.ssl.key.manager.password={{ connector_http[hostvars[inventory_hostname]['ansible_default_ipv4']['address']]['key_manager_password_base64'] }}" backrefs: yes backup: yes state: present - name: add connector key manager password for http if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.key.manager.password=\s*/?\w+' line: "http.ssl.key.manager.password={{ connector_http[hostvars[inventory_hostname]['ansible_default_ipv4']['address']]['key_manager_password_base64'] }}" insertafter: '^http.ssl.key.store.password' state: present - name: modify connector truststore path for http if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.trust.store.path=\s*/?\w+' line: 'http.ssl.trust.store.path={{ certs_store_path }}/connector-http.server.truststore.jks' backrefs: yes backup: yes state: present - name: add connector truststore path for http if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.trust.store.path=\s*/?\w+' line: 'http.ssl.trust.store.path={{ certs_store_path }}/connector-http.server.truststore.jks' insertafter: '^http.ssl.key.manager.password' state: present - name: modify connector truststore password for http if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.trust.store.password=\s*/?\w+' line: "http.ssl.trust.store.password={{ connector_http[hostvars[inventory_hostname]['ansible_default_ipv4']['address']]['trust_store_password_base64'] }}" backrefs: yes backup: yes state: present - name: add connector truststore password for http if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.trust.store.password=\s*/?\w+' line: "http.ssl.trust.store.password={{ connector_http[hostvars[inventory_hostname]['ansible_default_ipv4']['address']]['trust_store_password_base64'] }}" insertafter: '^http.ssl.trust.store.path' state: present
Result
第二种方式
inventory 文件
[dispatcher-connector] 192.168.99.17 192.168.99.5 [dispatcher-manager] 192.168.99.17 [dispatcher-tools] 192.168.99.17
vars 变量文件
--- ############################## Dispatcher Installation Basic Info ############### latest_version: 4.1.1 origin_version: 4.1.1 dispatcher_installation_home: /opt/ddi/dispatcher dispatcher_user_name: dispatcher dispatcher_group_name: dispatcher dispatcher_user_home: /home/dispatcher dispatcher_connector_http_host: "{{ groups['dispatcher-connector'][0] }}" ############################## Dispatcher EP Installation Info ################# connector_ep_list: manager_ep_list: connector_lib_dir: "{{ dispatcher_installation_home }}/dispatcher-{{ latest_version }}/dispatcher-connector/lib" manager_lib_dir: "{{ dispatcher_installation_home }}/dispatcher-{{ latest_version }}/dispatcher-manager/webapps/WEB-INF/lib" certs_from_path: "{{ playbook_dir }}/files" connector_certs_dir: "{{ dispatcher_installation_home }}/dispatcher-{{ latest_version }}/dispatcher-connector/conf/certs" manager_certs_dir: "{{ dispatcher_installation_home }}/dispatcher-{{ latest_version }}/dispatcher-manager/conf/certs" tools_certs_dir: "{{ dispatcher_installation_home }}/dispatcher-{{ latest_version }}/dispatcher-tools/cli/conf/certs" ############################## tls setting for dispatcher ###################### connector_mqtt_tls_enable: true connector_http_tls_enable: true connector_mqtt_key_store_password_base64: host1: MTEyMjMz1 host2: MTEyMjMz2 connector_mqtt_key_manager_password_base64: host1: MTEyMjMz1 host2: MTEyMjMz2 connector_mqtt_trust_store_password_base64: host1: Y2hhbmdlaXQ=1 host2: Y2hhbmdlaXQ=2 connector_mqtt_ssl_keystore_location: host1: /opt/ssl/connector-mqtt.server.keystore1.jks host2: /opt/ssl/connector-mqtt.server.keystore2.jks connector_mqtt_ssl_truststore_location: host1: /opt/ssl/connector-mqtt.server.truststore1.jks host2: /opt/ssl/connector-mqtt.server.truststore2.jks connector_http_key_store_password_base64: host1: MTEyMjMz1 host2: MTEyMjMz2 connector_http_key_manager_password_base64: host1: MTEyMjMz1 host2: MTEyMjMz2 connector_http_trust_store_password_base64: host1: Y2hhbmdlaXQ=1 host2: Y2hhbmdlaXQ=2 connector_http_ssl_keystore_location: host1: /opt/ssl/connector-http.server.keystore1.jks host2: /opt/ssl/connector-http.server.keystore2.jks connector_http_ssl_truststore_location: host1: /opt/ssl/connector-http.server.truststore1.jks host2: /opt/ssl/connector-http.server.truststore2.jks
configure.yml文件
--- - name: tls enable for connector hosts: dispatcher-connector vars_files: - ./vars/dispatcher.yml vars: certs_store_path: "{{ connector_certs_dir }}" configure_file: "{{ dispatcher_installation_home }}/dispatcher/dispatcher-connector/conf/connector.properties" become: yes become_user: root tasks: - name: add kafka tls config include: "{{ playbook_dir }}/common/kafka-tls-enable.yml" when: kafka_tls_enable - name: add cassandra tls config include: "{{ playbook_dir }}/common/cassandra-tls-enable.yml" when: cassandra_tls_enable - name: add mqtt configure tls config include: "{{ playbook_dir }}/common/connector-mqtt-tls-enable.yml" when: connector_mqtt_tls_enable - name: add http configure tls config include: "{{ playbook_dir }}/common/connector-http-tls-enable.yml" when: connector_http_tls_enable tags: dispatcher-connector - name: tls enable for manager hosts: dispatcher-manager vars_files: - ./vars/dispatcher.yml vars: certs_store_path: "{{ manager_certs_dir }}" configure_file: "{{ dispatcher_installation_home }}/dispatcher/dispatcher-manager/conf/manager.properties" become: yes become_user: root tasks: - name: add kafka tls config include: "{{ playbook_dir }}/common/kafka-tls-enable.yml" when: kafka_tls_enable - name: add cassandra tls config include: "{{ playbook_dir }}/common/cassandra-tls-enable.yml" when: cassandra_tls_enable tags: dispatcher-manager - name: tls enable for tools hosts: dispatcher-tools vars_files: - ./vars/dispatcher.yml vars: certs_store_path: "{{ tools_certs_dir }}" configure_file: "{{ dispatcher_installation_home }}/dispatcher/dispatcher-tools/cli/conf/cli.conf" become: yes become_user: root tasks: - name: add cassandra tls config include: "{{ playbook_dir }}/common/cassandra-tls-enable.yml" when: cassandra_tls_enable tags: dispatcher-tools
common/connector-mqtt-tls-enable.yml
--- - name: create certs store directory file: path: "{{ certs_store_path }}" owner: dispatcher group: dispatcher state: directory - name: copy dispatcher-connector keystore certs copy: src: "{{ connector_mqtt_ssl_keystore_location[inventory_hostname] }}" dest: "{{ certs_store_path }}/connector-mqtt.server.keystore.jks" mode: 0644 - name: copy dispatcher-connector truststore certs copy: src: "{{ connector_mqtt_ssl_truststore_location[inventory_hostname] }}" dest: "{{ certs_store_path }}/connector-mqtt.server.truststore.jks" mode: 0644 - name: modify connector keystore path if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.key.store.path=\s*/?\w+' line: 'mqtt.ssl.key.store.path={{ certs_store_path }}/connector-mqtt.server.keystore.jks' backrefs: yes backup: yes state: present - name: add connector keystore path if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.key.store.path=\s*/?\w+' line: 'mqtt.ssl.key.store.path={{ certs_store_path }}/connector-mqtt.server.keystore.jks' insertafter: '^mqtt.authentication.certificate.deviceId.key' state: present - name: modify connector keystore password if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.key.store.password=\s*/?\w+' line: "mqtt.ssl.key.store.password={{ connector_mqtt_key_store_password_base64[inventory_hostname] }}" backrefs: yes backup: yes state: present - name: add connector keystore password if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.key.store.password=\s*/?\w+' line: "mqtt.ssl.key.store.password={{ connector_mqtt_key_store_password_base64[inventory_hostname] }}" insertafter: '^mqtt.ssl.key.store.path' state: present - name: modify connector key manager password if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.key.manager.password=\s*/?\w+' line: "mqtt.ssl.key.manager.password={{ connector_mqtt_key_manager_password_base64[inventory_hostname] }}" backrefs: yes backup: yes state: present - name: add connector key manager password if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.key.manager.password=\s*/?\w+' line: "mqtt.ssl.key.manager.password={{ connector_mqtt_key_manager_password_base64[inventory_hostname] }}" insertafter: '^mqtt.ssl.key.store.password' state: present - name: modify connector truststore path if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.trust.store.path=\s*/?\w+' line: 'mqtt.ssl.trust.store.path={{ certs_store_path }}/connector-mqtt.server.truststore.jks' backrefs: yes backup: yes state: present - name: add connector truststore path if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.trust.store.path=\s*/?\w+' line: 'mqtt.ssl.trust.store.path={{ certs_store_path }}/connector-mqtt.server.truststore.jks' insertafter: '^mqtt.ssl.key.manager.password' state: present - name: modify connector truststore password if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.trust.store.password=\s*/?\w+' line: "mqtt.ssl.trust.store.password={{ connector_mqtt_trust_store_password_base64[inventory_hostname] }}" backrefs: yes backup: yes state: present - name: add connector truststore password if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*mqtt.ssl.trust.store.password=\s*/?\w+' line: "mqtt.ssl.trust.store.password={{ connector_mqtt_trust_store_password_base64[inventory_hostname] }}" insertafter: '^mqtt.ssl.trust.store.path' state: present
common/connector-http-tls-enable.yml
--- - name: create certs store directory file: path: "{{ certs_store_path }}" owner: dispatcher group: dispatcher state: directory - name: copy dispatcher-connector keystore certs copy: src: "{{ connector_http_ssl_keystore_location[inventory_hostname] }}" dest: "{{ certs_store_path }}/connector-http.server.keystore.jks" mode: 0644 - name: copy dispatcher-connector truststore certs copy: src: "{{ connector_http_ssl_truststore_location[inventory_hostname] }}" dest: "{{ certs_store_path }}/connector-http.server.truststore.jks" mode: 0644 - name: modify connector keystore path if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.key.store.path=\s*/?\w+' line: 'http.ssl.key.store.path={{ certs_store_path }}/connector-http.server.keystore.jks' backrefs: yes backup: yes state: present - name: add connector keystore path if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.key.store.path=\s*/?\w+' line: 'http.ssl.key.store.path={{ certs_store_path }}/connector-http.server.keystore.jks' insertafter: '^mqtt.ssl.trust.store.password' state: present - name: modify connector keystore password if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.key.store.password=\s*/?\w+' line: "http.ssl.key.store.password={{ connector_http_key_store_password_base64[inventory_hostname] }}" backrefs: yes backup: yes state: present - name: add connector keystore password for http if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.key.store.password=\s*/?\w+' line: "http.ssl.key.store.password={{ connector_http_key_store_password_base64[inventory_hostname] }}" insertafter: '^http.ssl.key.store.path' state: present - name: modify connector key manager password for http if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.key.manager.password=\s*/?\w+' line: "http.ssl.key.manager.password={{ connector_http_key_manager_password_base64[inventory_hostname] }}" backrefs: yes backup: yes state: present - name: add connector key manager password for http if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.key.manager.password=\s*/?\w+' line: "http.ssl.key.manager.password={{ connector_http_key_manager_password_base64[inventory_hostname] }}" insertafter: '^http.ssl.key.store.password' state: present - name: modify connector truststore path for http if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.trust.store.path=\s*/?\w+' line: 'http.ssl.trust.store.path={{ certs_store_path }}/connector-http.server.truststore.jks' backrefs: yes backup: yes state: present - name: add connector truststore path for http if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.trust.store.path=\s*/?\w+' line: 'http.ssl.trust.store.path={{ certs_store_path }}/connector-http.server.truststore.jks' insertafter: '^http.ssl.key.manager.password' state: present - name: modify connector truststore password for http if exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.trust.store.password=\s*/?\w+' line: "http.ssl.trust.store.password={{ connector_http_trust_store_password_base64[inventory_hostname] }}" backrefs: yes backup: yes state: present - name: add connector truststore password for http if not exists lineinfile: path: "{{ configure_file }}" regexp: '^\s*http.ssl.trust.store.password=\s*/?\w+' line: "http.ssl.trust.store.password={{ connector_http_trust_store_password_base64[inventory_hostname] }}" insertafter: '^http.ssl.trust.store.path' state: present
结果是一样的
相关推荐
本文实例讲述了Python自动化运维之Ansible定义主机与组规则操作。分享给大家供大家参考,具体如下: 一 点睛 Ansible通过定义好的主机与组规则(Inventory)对匹配的目标主机进行远程操作,配置规则文件默认是/etc/...
Ansible 主机: 10.4.0.57 Mysql Master: 10.4.0.17 Mysql Slave: 10.4.0.22 所有操作都在Ansible主机上进行 执行步骤: 1. 安装ansible 2.9 pip install ansible==2.9 2. 配置 Ansible到Master和Slave主机免密...
Rancher-Ansible, 使用Ansible运行Rancher平台和 register 主机 rancher-ansible这个playbook使用Rancher自动安装平台和 register 主机,这个playbook可以使用cloudformation自动在AWS上创建主机,或者使用 static ...
Ansible-ansible-ssh.zip,使用ansible inventory和config.ansible-ssh连接到托管主机的脚本,ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。
Ansible-40ansible.zip,使用rest api40ansible的fortinet产品的ansible模块和示例,ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。
离线安装ansible 把安装包放到/data目录并解压 tar xvf ansible_packages.tar.gz rpm -ivh deltarpm-3.6-3.el7.x86_64.rpm rpm -ivh python-deltarpm-3.6-3.el7.x86_64.rpm rpm -ivh createrepo-0.9.9-28.el7....
Ansible-Ansible-roles.zip,责任角色责任角色?,ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。
Ansible-Ansible-WSL.zip,通过ansibleansible wsl从wsl内部设置窗口,ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。
Ansible-ansible-haproxy.zip,统一OpenStack安装程序的Ansible Haproxy角色Ansible Haproxy(OpenStack就绪),ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。
Ansible-intellij-ansible.zip,支持janja2标签的yaml/ansible/intellij ideayaml/ansible in intellij idea,ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。
Ansible-ansible-snippets.zip,ansible vim片段sansible片段,ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。
ansible-2.8.0-1.el8ae.noarch.rpm python3-jmespath-0.9.0-11.el8.noarch.rpm sshpass-1.06-3.el8ae.x86_64.rpm 若RHEL 8版本的离线本地镜像中无法安装ansible,可使用以上压缩包中的rpm包安装; 安装后可直接使用...
Ansible-k3s-ansible.zip,ansible playbook部署k3s-kubernetes集群通过ansibe使用k3s构建kubernetes集群。,ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。
Ansible-ansible-makefile.zip,makefile用作ansiblemakefile对ansible用户的简单接口,ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。
Ansible-ansible-nagios.zip,Ansible Playbook,用于设置Nagios监视系统和客户端。,ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。
ansible部署gpmall商城 云计算
Ansible-wordpress-ansible.zip,在digitalocean.com上使用ansible在ubuntu 16.04上安装wordpress...wordpress ansible,ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。
Ansible-ansible-mac-install.zip,通过Ansible.Ansible Playbook for Mac安装和配置,ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。
Ansible-ansible-rclone.zip,RClone的职责:https://galaxy.ansible.com/stefangweichinger/rcloneansible-rclone,ansible是一个简单而强大的自动化引擎。它用于帮助配置管理、应用程序部署和任务自动化。