1. yum install jenkins modify the configuration file called ansible vim / etc / sysconfig / jenkins 2. Installation Jenkins Ansible plug Manage Jenkins ---> Manage Plugins search Ansible configuration Ansible the Manage Jenkins ---> the Configuration Tool, Ltd. Free Join
3. Create a free style ansible Ad-Hoc select Invoke Ansible Ad-Hoc Command
4. Check run results
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