You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
This repo is archived. You can view files and clone it, but cannot push or open issues/pull-requests.
ansible-role-nginx/molecule/default/converge.yml

62 lines
1.7 KiB

---
- name: Converge
hosts: all
remote_user: ansible
become: yes
vars:
nginx_use_ppa: true
nginx_remove_default_vhost: true
nginx_vhosts:
- server_names:
- "localhost"
upstream:
name: local
server: localhost:8000
template: django-vhost.j2
extra_snippets:
- location: "~* /static/(.*\\.)(js|css)"
expiries: 365d
alias: "/var/www/static/$1$2"
template: cache-snippet.j2
enable_https: true
filename: localhost-django.conf
static_root: /var/www/static/
media_root: /var/www/media/
certificate: /etc/nginx/ssl/fullchain.pem # selfsigned
private_key: /etc/nginx/ssl/privkey.pem # selfsigned
pre_tasks:
- name: Update apt cache
apt: update_cache=yes cache_valid_time=600
become: yes
when: ansible_os_family == 'Debian'
changed_when: false
- name: "Create directories"
file:
path: /var/www/{{ item }}
state: directory
loop:
- static
- media
- name: "Create test file"
copy:
dest: /var/www/{{ item.directory }}/{{ item.file }}
content: "{{ item.directory }}"
loop:
- directory: static
file: static.html
- directory: static
file: cache.js
- directory: static
file: cache.css
- directory: media
file: media.html
- debug: var=ansible_python
tags: xd
- name: Run simple python server
shell:
cmd: "nohup {{ ansible_python.executable }} -m {{ 'http.server' if ansible_python.version.major == 3 else 'SimpleHTTPServer'}} &"
chdir: /tmp
tags: xd
roles:
- role: nginx