Use jenkins+saltstack+sh to modify the nginx configuration file and reload

The configuration of jenkins (the role here is only used as an interface, use it to manage the execution of the salt command)

1. Build operations to execute shell scripts (pillar can be configured with flexible parameters)

sls file writing of saltstack

nginx.sls

nginx:
  file.managed:
    - source: salt://nginx/{{pillar['project']}}.conf
    - name: /usr/local/nginx/conf/vhost/{{pillar['project']}}.conf
    - user: root
    - group: root
    - mode: 644

  cmd.run:
    - name: nginx -s reload

source is the source file, and name is the target file pushed to the remote minion server 

 

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324734677&siteId=291194637