51工具盒子

依楼听风雨
笑看云卷云舒,淡观潮起潮落

ansible roles wordpress 业务安装

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
赞(6)
未经允许不得转载:工具盒子 » ansible roles wordpress 业务安装