@ -0,0 +1,5 @@ | |||||
--- | |||||
- name: restart {{ service_name }} | |||||
service: name={{ service_name }} state=restarted | |||||
- name: reload {{ service_name }} | |||||
service: name={{ service_name }} state=reloaded |
@ -0,0 +1,8 @@ | |||||
--- | |||||
- name: install apache | |||||
apt: name={{ item }} state=latest | |||||
with_items: | |||||
- apache2 | |||||
- name: start apache at boot | |||||
service: name=apache2 state=started enabled=yes | |||||
@ -0,0 +1,8 @@ | |||||
--- | |||||
- name: install mysql | |||||
apt: name={{ item }} state=latest | |||||
with_items: | |||||
- mysql | |||||
- name: start mysql at boot | |||||
service: name=mysql state=started enabled=yes | |||||
@ -1,10 +1,14 @@ | |||||
--- | --- | ||||
- name: restart nginx | |||||
service: name=nginx state=restarted | |||||
- include: service.yaml | |||||
service_name: nginx | |||||
- name: validate nginx configuration | - name: validate nginx configuration | ||||
command: nginx -t -c /etc/nginx/nginx.conf | command: nginx -t -c /etc/nginx/nginx.conf | ||||
changed_when: False | changed_when: False | ||||
- name: reload nginx | |||||
service: name=nginx state=reloaded | |||||
- name: enable nginx configuration | |||||
file: | |||||
src: "/etc/nginx/sites-available/{{ config_name }}" | |||||
dest: "/etc/nginx/sites-enabled/{{ config_name }}" | |||||
state: link | |||||
notify: restart nginx |
@ -1,8 +1,17 @@ | |||||
--- | --- | ||||
- name: install nginx | |||||
apt: pkg=nginx state=latest | |||||
- name: start nginx at boot | |||||
service: name=nginx state=started enabled=yes | |||||
# - name: copy nginx configuration | |||||
# template: src={{ configuration_file }} dest=/etc/nginx/sites-available/{{ dest }} | |||||
# notify: restart nginx | |||||
- include: service.yaml | |||||
service_name: nginx | |||||
service_packages: | |||||
- nginx | |||||
- name: disable nginx default configuration | |||||
file: path=/etc/nginx/sites-enabled/default state=absent | |||||
notify: restart nginx | |||||
- name: upload nginx proxy configuration | |||||
template: | |||||
src: proxy_config.j2 | |||||
dest: "/etc/nginx/sites-available/{{ config_name }}" | |||||
tags: | |||||
- proxy | |||||
notify: | |||||
- enable nginx configuration | |||||
- restart nginx |
@ -1,3 +0,0 @@ | |||||
--- | |||||
dependencies: | |||||
- nginx |
@ -1,15 +0,0 @@ | |||||
--- | |||||
- name: upload nginx proxy configuration | |||||
template: | |||||
src: site_config.j2 | |||||
dest: "/etc/nginx/sites-available/{{ config_name }}" | |||||
notify: restart nginx | |||||
- name: disable nginx default configuration | |||||
file: path=/etc/nginx/sites-enabled/default state=absent | |||||
notify: restart nginx | |||||
- name: enable nginx proxy configuration | |||||
file: | |||||
src: "/etc/nginx/sites-available/{{ config_name }}" | |||||
dest: "/etc/nginx/sites-enabled/{{ config_name }}" | |||||
state: link | |||||
notify: restart nginx |
@ -0,0 +1,3 @@ | |||||
--- | |||||
dependencies: | |||||
- role: apache |
@ -0,0 +1,5 @@ | |||||
--- | |||||
- name: install wordpress | |||||
apt: name={{ item }} state=latest | |||||
with_items: | |||||
- wordpress |
@ -0,0 +1,6 @@ | |||||
--- | |||||
- name: install {{ service_name }} | |||||
apt: name={{ item }} state=present | |||||
with_items: {{ service_packages }} | |||||
- name: start {{ service_name }} at boot | |||||
service: name={{ service_name }} state=started enabled=yes |