# ansible-play-book - hosts: all tasks: - name: Install Epel get_url: url: http://mirrors.aliyun.com/repo/epel-7.repo dest: /etc/yum.repos.d/epel.repo - name: SSHD Change copy: src: ../conf/sshd_config dest: /etc/ssh/sshd_config notify: restart sshd - name: Set hosts copy: src: ../conf/hosts dest: /etc/hosts - name: Create Group www group: name=www gid=888 - name: Create User www user: name=www uid=888 group=888 create_home=no shell=/sbin/nologin - name: Create Rsync_Client_Pass copy: content='1' dest=/etc/rsync.pass mode=600 - name: Create Scripts Directory file: path=/server/scripts recurse=yes state=directory - name: Create Directory file: path=/date recurse=yes state=directory owner=www group=www mode=755 - name: Push Script copy: src: ../scripts/test.sh dest: /server/scripts/ owner: www group: www mode: '0777' - name: Ensure a job cron: name: "check dirs" minute: "0" hour: "5,2" job: "ls -alh > /dev/null" handlers: - name: restart sshd service: name=sshd state=restarted