创建软链:file:
- name: create link
hosts: "{ {hosts_ip}}" tasks: - name: create linkfile: src={
{src_path}} dest={ {dest_link_path}} state=link
运行脚本:
- name: restart jetty
hosts: "{ {hosts_ip}}" tasks: - name: restart jetty shell: "{ {shell_message}}" register: ret- name: display variable
debug: msg="{ { ret.stdout_lines }}"
重启jt或者java:shell:
- name: restart jetty
hosts: "{ {hosts_ip}}" tasks: - name: restart jetty shell: "set -m && /opt/bin/jt 2" register: ret- name: display variable
debug: msg="{ { ret.stdout_lines }}"
同步目录synchronize 和建目录:
- name: rsync learning
hosts: "{ {hosts_ip}}" tasks: - name: mkdir dir file: path="{ {dest_path}}" state=directory mode=0755 owner=dev- name: rsync server dir
synchronize: src="{ {src_path}}" dest="{ {dest_path}}" recursive=yes rsync_opts=--exclude-from={ {src_path}}/exclude.txt register: ret - name: display variable debug: msg="{ { ret.stdout_lines }}"