Add all files needed to bring up VM and run agaric.com locally
This commit is contained in:
parent
52c8b60bac
commit
4d2bc0ee24
742 changed files with 24037 additions and 0 deletions
45
box/provisioning/roles/geerlingguy.nginx/tasks/main.yml
Normal file
45
box/provisioning/roles/geerlingguy.nginx/tasks/main.yml
Normal file
|
@ -0,0 +1,45 @@
|
|||
---
|
||||
# Variable setup.
|
||||
- name: Include OS-specific variables.
|
||||
include_vars: "{{ ansible_os_family }}.yml"
|
||||
|
||||
- name: Define nginx_user.
|
||||
set_fact:
|
||||
nginx_user: "{{ __nginx_user }}"
|
||||
when: nginx_user is not defined
|
||||
|
||||
# Setup/install tasks.
|
||||
- include: setup-RedHat.yml
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- include: setup-Ubuntu.yml
|
||||
when: ansible_distribution == 'Ubuntu'
|
||||
|
||||
- include: setup-Debian.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- include: setup-FreeBSD.yml
|
||||
when: ansible_os_family == 'FreeBSD'
|
||||
|
||||
- include: setup-OpenBSD.yml
|
||||
when: ansible_os_family == 'OpenBSD'
|
||||
|
||||
- include: setup-Archlinux.yml
|
||||
when: ansible_os_family == 'Archlinux'
|
||||
|
||||
# Vhost configuration.
|
||||
- include: vhosts.yml
|
||||
|
||||
# Nginx setup.
|
||||
- name: Copy nginx configuration in place.
|
||||
template:
|
||||
src: "{{ nginx_conf_template }}"
|
||||
dest: "{{ nginx_conf_file_path }}"
|
||||
owner: root
|
||||
group: "{{ root_group }}"
|
||||
mode: 0644
|
||||
notify:
|
||||
- reload nginx
|
||||
|
||||
- name: Ensure nginx is started and enabled to start at boot.
|
||||
service: name=nginx state=started enabled=yes
|
|
@ -0,0 +1,5 @@
|
|||
---
|
||||
- name: Ensure nginx is installed.
|
||||
pacman:
|
||||
name: "{{ nginx_package_name }}"
|
||||
state: installed
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
- name: Update apt cache.
|
||||
apt: update_cache=yes cache_valid_time=86400
|
||||
changed_when: false
|
||||
|
||||
- name: Ensure nginx is installed.
|
||||
apt:
|
||||
name: "{{ nginx_package_name }}"
|
||||
state: installed
|
||||
default_release: "{{ nginx_default_release }}"
|
|
@ -0,0 +1,13 @@
|
|||
---
|
||||
- name: Update pkg cache.
|
||||
shell: pkg update -f
|
||||
|
||||
- name: Ensure nginx is installed.
|
||||
pkgng:
|
||||
name: "{{ nginx_package_name }}"
|
||||
state: present
|
||||
|
||||
- name: Create logs directory.
|
||||
file:
|
||||
path: /var/log/nginx
|
||||
state: directory
|
|
@ -0,0 +1,10 @@
|
|||
---
|
||||
- name: Ensure nginx is installed.
|
||||
openbsd_pkg:
|
||||
name: "{{ nginx_package_name }}"
|
||||
state: present
|
||||
|
||||
- name: Create logs directory.
|
||||
file:
|
||||
path: /var/log/nginx
|
||||
state: directory
|
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
- name: Enable nginx repo.
|
||||
template:
|
||||
src: nginx.repo.j2
|
||||
dest: /etc/yum.repos.d/nginx.repo
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
when: nginx_yum_repo_enabled
|
||||
|
||||
- name: Ensure nginx is installed.
|
||||
yum:
|
||||
name: "{{ nginx_package_name }}"
|
||||
state: installed
|
|
@ -0,0 +1,14 @@
|
|||
---
|
||||
- name: Add PPA for Nginx.
|
||||
apt_repository:
|
||||
repo: 'ppa:nginx/{{ nginx_ppa_version }}'
|
||||
state: present
|
||||
update_cache: yes
|
||||
register: nginx_ppa_added
|
||||
when: nginx_ppa_use
|
||||
|
||||
- name: Ensure nginx will reinstall if the PPA was just added.
|
||||
apt:
|
||||
name: nginx
|
||||
state: absent
|
||||
when: nginx_ppa_added.changed
|
39
box/provisioning/roles/geerlingguy.nginx/tasks/vhosts.yml
Normal file
39
box/provisioning/roles/geerlingguy.nginx/tasks/vhosts.yml
Normal file
|
@ -0,0 +1,39 @@
|
|||
---
|
||||
- name: Remove default nginx vhost config file (if configured).
|
||||
file:
|
||||
path: "{{ nginx_default_vhost_path }}"
|
||||
state: absent
|
||||
when: nginx_remove_default_vhost
|
||||
notify: restart nginx
|
||||
|
||||
- name: Ensure nginx_vhost_path exists.
|
||||
file:
|
||||
path: "{{ nginx_vhost_path }}"
|
||||
state: directory
|
||||
notify: reload nginx
|
||||
|
||||
- name: Add managed vhost config files.
|
||||
template:
|
||||
src: "{{ item.template|default(nginx_vhost_template) }}"
|
||||
dest: "{{ nginx_vhost_path }}/{{ item.filename|default(item.server_name.split(' ')[0] ~ '.conf') }}"
|
||||
force: yes
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
when: item.state|default('present') != 'absent'
|
||||
with_items: "{{ nginx_vhosts }}"
|
||||
notify: reload nginx
|
||||
|
||||
- name: Remove managed vhost config files.
|
||||
file:
|
||||
path: "{{ nginx_vhost_path }}/{{ item.filename|default(item.server_name.split(' ')[0] ~ '.conf') }}"
|
||||
state: absent
|
||||
when: item.state|default('present') == 'absent'
|
||||
with_items: "{{ nginx_vhosts }}"
|
||||
notify: reload nginx
|
||||
|
||||
- name: Remove legacy vhosts.conf file.
|
||||
file:
|
||||
path: "{{ nginx_vhost_path }}/vhosts.conf"
|
||||
state: absent
|
||||
notify: reload nginx
|
Loading…
Add table
Add a link
Reference in a new issue