首页 > 代码库 > ansible note

ansible note

[root@localhost ansible]# tree -hp
.
├── [-rw-r--r-- 7.0K] ansible.cfg
├── [-rw-r--r-- 1.2K] hosts
├── [drwxr-xr-x 4.0K] playbook
│   └── [-rw-r--r-- 424] hosts_deny.yaml
└── [drwxr-xr-x 4.0K] templates
└── [-rwxr-xr-x 286] hosts_deny.sh

 

hosts_deny.yaml

---- hosts: apache_servers  remote_user: root  vars:      local_doc: /etc/ansible/templates/hosts_deny.sh      remote_doc: /usr/local/sbin/hosts_deny.sh  tasks:  - name: upload file    copy: src={{local_doc}} dest={{remote_doc}} owner=root mode=0744  - name: execute sh    shell: /usr/local/sbin/hosts_deny.sh  - name: cron    cron: name="deny baleful ip" minute="0" hour="0" job="/usr/local/sbin/hosts_deny.sh"

 

ansible note