[root@m01 /etc/ansible/roles/lbserver/tasks]#cat /root/ansible/lb.yml
- hosts: lbs
tasks:
- name: configre lbs
copy:
src: ./proxy/
dest: /etc/nginx/conf.d/
- name: copy params
copy:
src: ./proxy/proxy_params
dest: /etc/nginx/proxy_params
- name: restart nginx
systemd:
name: nginx
state: restarted
- hosts: webs
tasks:
- name: config nginx in webs
copy:
src: ./proxy/proxy_params
dest: /etc/nginx/proxy_params
- name: restart nginx
systemd:
name: nginx
state: restarted
|