• jenkins结合ansible发布


    1. yum安装的jenkins修改配置文件调用ansible
        vim /etc/sysconfig/jenkins
    
    2. 安装Jenkins Ansible插件
        Manage Jenkins--->Manage Plugins搜索Ansible
        配置Ansible
        Manage Jenkins--->Global Tool Configuration
    

     

    3. 新建一个自由风格ansible Ad-Hoc
        选择Invoke Ansible Ad-Hoc Command
    

    4. 查看运行结果
    

      

    5. 使用ansible-playbook
        mkdir -pv /etc/ansible/roles/tomcat/{tasks,files,templates,vars,meta,default,handlers}
        echo "Mlxg2234" > ./tomcat/files/a.txt
        编写task
        tasks/main.yml
        - name:  copy a.txt
           copy: src=a.txt dest=/usr/local/apache-tomcat-8.5.43/webapps/abc/
        - name: shutdown tomcat
          shell: kill -9 `ps -ef | grep tomcat-8.5.43 | grep -v grep | awk '{print $2}'`
                   或者sh /usr/local/apache-tomcat-8.5.43/bin/shutdown.sh
        - name: startup tomcat
          shell:  sh /usr/local/apache-tomcat-8.5.43/bin/startup.sh
    
        在roles下编写site.yml
        vim site.yml
        - name: tomcat
          remote_user: root
          hosts: all
          roles:
             - tomcat
    

      

      

     

  • 相关阅读:
    MySQL远程登陆
    一键安装LAMP wordpress
    编译安装httpd2.4.46
    RDB转化AOF 花式删库
    3周作业
    2周作业
    1周作业
    预习第三周作业
    预习第二周作业
    预习第一周作业
  • 原文地址:https://www.cnblogs.com/The-day-of-the-wind/p/12575580.html
Copyright © 2020-2023  润新知