ansible roles wordpress 业务安装
[root@m01 /etc/ansible/roles/webserver/tasks]#cat main.yml
- name: remove nginx default.conf
file:
path: /etc/nginx/conf.d/default.conf
state: absent
notify: Restart Nginx Server
- name: copy wordpress configure to conf.d
copy:
src: a_wordpress.conf
dest: /etc/nginx/conf.d/a_wordpress.conf
notify: Restart Nginx Server
- name: makdir /code
file:
path: /code
state: directory
- name: unarchive wordpress_code.tar
unarchive:
src: wordpress_1.tar.gz
dest: /code/
creates: /code/wordpress/
notify: mount nfs
- name : restart nginx
systemd:
name: nginx
state: restarted
[root@m01 /etc/ansible/roles/webserver/handlers]#cat main.yml
- name: Restart Nginx Server
systemd:
name: nginx
state: restarted
- name: mount nfs
mount:
src: 172.16.1.31:/code/blog/
path: /code/wordpress/wp-content/uploads/
fstype: nfs
state: mounted