-
-
Notifications
You must be signed in to change notification settings - Fork 606
/
Copy pathmain.yml
82 lines (67 loc) · 2.51 KB
/
main.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
---
- name: Validate Ansible version
fail:
msg: |
Your Ansible version is {{ ansible_version.full | default('unknown') }}.
Please install a version of Ansible that meets these requirements:
{% for item in ansible_requirements %}
{{ item.operator }} {{ item.version }}
{% endfor %}
when: ansible_version is not defined or false in [{% for item in ansible_requirements %}{{ ansible_version.full | version_compare(item.version, item.operator) }},{% endfor %}]
run_once: true
- name: Validate format of site_hosts
fail:
msg: "{{ lookup('template', 'site_hosts.j2') }}"
with_dict: "{{ wordpress_sites }}"
when: item.value.site_hosts | rejectattr('canonical', 'defined') | list | count
tags: [letsencrypt, wordpress]
- name: Validate Ubuntu version
debug:
msg: |
Trellis is built for Ubuntu 16.04 Xenial as of https://github.com/roots/trellis/pull/626
Your Ubuntu version is {{ ansible_distribution_version }} {{ ansible_distribution_release }}
We recommend you re-create your server to get the best experience.
Note: both of these methods will delete all your existing data. It's up to you to backup what's needed and restore it.
Development via Vagrant: `vagrant destroy && vagrant up`
Staging/Production: Create a new server with Ubuntu 16.04 and provision
when: ansible_distribution_release == 'trusty'
run_once: true
- name: Check whether passlib is needed
fail:
msg: |
Ansible on OS X requires python passlib module to create user password hashes
sudo easy_install pip
pip install passlib
when: env != 'development' and darwin_without_passlib | default(false)
run_once: true
- name: Update Apt
apt:
update_cache: yes
- name: Checking essentials
apt:
name: "{{ item }}"
state: present
with_items:
- python-software-properties
- python-pycurl
- build-essential
- python-mysqldb
- curl
- git-core
- dbus
- name: Validate timezone variable
stat:
path: /usr/share/zoneinfo/{{ default_timezone }}
register: timezone_path
changed_when: false
- name: Explain timezone error
fail:
msg: "{{ default_timezone }} is not a valid timezone. For a list of valid timezones, check https://php.net/manual/en/timezones.php"
when: not timezone_path.stat.exists
- name: Get current timezone
command: cat /etc/timezone
register: current_timezone
changed_when: false
- name: Set timezone
command: timedatectl set-timezone {{ default_timezone }}
when: current_timezone.stdout != default_timezone