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
95
box/provisioning/roles/geerlingguy.varnish/tasks/main.yml
Normal file
95
box/provisioning/roles/geerlingguy.varnish/tasks/main.yml
Normal file
|
@ -0,0 +1,95 @@
|
|||
---
|
||||
- name: Include OS-specific variables.
|
||||
include_vars: "{{ ansible_os_family }}.yml"
|
||||
|
||||
- name: Set the packagecloud repository name based on the version.
|
||||
set_fact:
|
||||
varnish_packagecloud_repo: "varnish{{ varnish_version|replace('.', '') }}"
|
||||
|
||||
- include: setup-RedHat.yml
|
||||
when: ansible_os_family == 'RedHat'
|
||||
|
||||
- include: setup-Debian.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
|
||||
- name: Ensure Varnish config path exists.
|
||||
file:
|
||||
path: "{{ varnish_config_path }}"
|
||||
state: directory
|
||||
|
||||
- name: Copy Varnish configuration (sysvinit).
|
||||
template:
|
||||
src: varnish.j2
|
||||
dest: "{{ varnish_sysvinit_config_path }}/varnish"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
when: >
|
||||
(ansible_os_family == 'RedHat' and ansible_distribution_major_version|int < 7) or
|
||||
(ansible_os_family == 'Debian' and ansible_distribution_release != "xenial")
|
||||
|
||||
- name: Copy Debian Jessie/Xenial specific Varnish configs (systemd).
|
||||
template:
|
||||
src: varnish.service.j2
|
||||
dest: "{{ varnish_systemd_config_path }}/varnish.service"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
when: >
|
||||
(ansible_distribution == 'Debian' and ansible_distribution_version|int >= 8) or
|
||||
(ansible_distribution == 'Ubuntu' and ansible_distribution_version.split(".")[0]|int >= 16)
|
||||
notify:
|
||||
- reload systemd
|
||||
- restart varnish
|
||||
|
||||
- name: Copy Varnish configuration (systemd).
|
||||
template:
|
||||
src: varnish.params.j2
|
||||
dest: "{{ varnish_config_path }}/varnish.params"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
when: >
|
||||
(ansible_os_family == 'RedHat' and ansible_distribution_major_version|int >= 7) or
|
||||
(ansible_os_family == 'Debian' and ansible_distribution_release == "xenial")
|
||||
|
||||
- name: Copy Varnish default VCL.
|
||||
template:
|
||||
src: "{{ varnish_default_vcl_template_path }}"
|
||||
dest: "{{ varnish_config_path }}/default.vcl"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
when: varnish_use_default_vcl
|
||||
notify: restart varnish
|
||||
|
||||
- name: Copy varnish secret.
|
||||
template:
|
||||
src: secret.j2
|
||||
dest: "{{ varnish_config_path }}/secret"
|
||||
owner: root
|
||||
group: root
|
||||
mode: 0644
|
||||
notify: restart varnish
|
||||
|
||||
- name: Ensure Varnish services are started and enabled on startup.
|
||||
service:
|
||||
name: "{{ item }}"
|
||||
state: started
|
||||
enabled: yes
|
||||
with_items: "{{ varnish_enabled_services | default([]) }}"
|
||||
when: >
|
||||
varnish_enabled_services and
|
||||
(ansible_os_family != 'Debian' and ansible_distribution_release != "xenial")
|
||||
|
||||
# See: https://github.com/ansible/ansible/issues/22303
|
||||
- name: Ensure Varnish services are started enabled on startup (Xenial specific)
|
||||
service:
|
||||
name: "{{ item }}"
|
||||
state: started
|
||||
enabled: yes
|
||||
use: "service"
|
||||
with_items: "{{ varnish_enabled_services | default([]) }}"
|
||||
when:
|
||||
- varnish_enabled_services
|
||||
- (ansible_os_family == 'Debian' and ansible_distribution_release == "xenial")
|
|
@ -0,0 +1,26 @@
|
|||
---
|
||||
- name: Ensure APT HTTPS Transport is installed.
|
||||
apt:
|
||||
name: apt-transport-https
|
||||
state: installed
|
||||
|
||||
- name: Add packagecloud.io Varnish apt key.
|
||||
apt_key:
|
||||
url: https://packagecloud.io/varnishcache/{{ varnish_packagecloud_repo }}/gpgkey
|
||||
state: present
|
||||
|
||||
- name: Add packagecloud.io Varnish apt repository.
|
||||
apt_repository:
|
||||
repo: "deb https://packagecloud.io/varnishcache/{{ varnish_packagecloud_repo }}/{{ ansible_distribution | lower }}/ {{ ansible_distribution_release }} main"
|
||||
state: present
|
||||
|
||||
- name: Ensure Varnish is installed.
|
||||
apt:
|
||||
name: "{{ varnish_package_name }}"
|
||||
state: present
|
||||
|
||||
- name: Ensure old role-managed Varnish systemd unit file is removed.
|
||||
file:
|
||||
path: /etc/systemd/system/varnish.service
|
||||
state: absent
|
||||
when: varnish_systemd_config_path != '/etc/systemd/system'
|
|
@ -0,0 +1,30 @@
|
|||
---
|
||||
- name: Ensure Varnish dependencies are installed.
|
||||
yum: name={{ item }} state=present
|
||||
with_items:
|
||||
- yum-utils
|
||||
- pygpgme
|
||||
|
||||
- name: Add Varnish packagecloud.io yum repo.
|
||||
yum_repository:
|
||||
name: varnishcache_{{ varnish_packagecloud_repo }}
|
||||
description: Varnish Cache packagecloud.io repository.
|
||||
baseurl: https://packagecloud.io/varnishcache/{{ varnish_packagecloud_repo }}/el/{{ ansible_distribution_major_version|int }}/$basearch
|
||||
repo_gpgcheck: no
|
||||
gpgcheck: no
|
||||
enabled: yes
|
||||
gpgkey: https://packagecloud.io/varnishcache/{{ varnish_packagecloud_repo }}/gpgkey
|
||||
sslverify: 1
|
||||
sslcacert: /etc/pki/tls/certs/ca-bundle.crt
|
||||
register: varnish_packagecloud_repo_addition
|
||||
|
||||
- name: Refresh yum metadata cache if repo changed.
|
||||
command: >
|
||||
yum clean metadata
|
||||
warn=no
|
||||
when: varnish_packagecloud_repo_addition.changed
|
||||
|
||||
- name: Ensure Varnish is installed.
|
||||
yum:
|
||||
name: "{{ varnish_package_name }}"
|
||||
state: installed
|
Loading…
Add table
Add a link
Reference in a new issue