-
Notifications
You must be signed in to change notification settings - Fork 0
/
php-sury.yml
130 lines (117 loc) · 3.14 KB
/
php-sury.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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
---
- hosts: all
sudo: yes
remote_user: root
vars:
main_nodes_ips: "{% set IP_ARR=[] %}{% for host in groups['all'] %}{% if IP_ARR.insert(loop.index,hostvars[host]['ansible_default_ipv4']['address']) %}{% endif %}{% endfor %}{{IP_ARR|join(' ')}}"
main_nodes_ipc: "{% set IP_ARR=[] %}{% for host in groups['all'] %}{% if IP_ARR.insert(loop.index,hostvars[host]['ansible_default_ipv4']['address']) %}{% endif %}{% endfor %}{{IP_ARR|join(',')}}"
sury_apt_url: 'https://packages.sury.org/php'
vars_files:
- "{{ var_file }}"
tasks:
- name: Install sury dependencies
apt: name={{ item }} state=present
with_items:
- apt-transport-https
- ca-certificates
- lsb-release
- name: Install GPG key
apt_key: url='{{ sury_apt_url }}/apt.gpg' state=present
- name: Add APT repository
lineinfile:
dest: /etc/apt/sources.list
state: present
regexp: '{{ sury_apt_url }}'
line: "deb {{ sury_apt_url }} {{ ansible_distribution_release }} main"
- name: update apt
apt: update_cache=yes
- name: ensure packages installed
apt: pkg={{ item }} state=latest
with_items:
- php-apcu
- php-apcu-bc
- php-igbinary
- php-imagick
- php-memcached
- php-mongodb
- php-msgpack
- php-ssh2
- php5.6-cli
- php5.6-common
- php5.6-curl
- php5.6-fpm
- php5.6-gd
- php5.6-intl
- php5.6-json
- php5.6-ldap
- php5.6-mbstring
- php5.6-mysql
- php5.6-opcache
- php5.6-readline
- php5.6-xml
- php5.6-xsl
- php7.0-cli
- php7.0-common
- php7.0-curl
- php7.0-fpm
- php7.0-gd
- php7.0-intl
- php7.0-json
- php7.0-ldap
- php7.0-mbstring
- php7.0-mysql
- php7.0-opcache
- php7.0-readline
- php7.0-xml
- php7.0-xsl
- php7.1-cli
- php7.1-common
- php7.1-curl
- php7.1-fpm
- php7.1-gd
- php7.1-intl
- php7.1-json
- php7.1-ldap
- php7.1-mbstring
- php7.1-mysql
- php7.1-opcache
- php7.1-readline
- php7.1-xml
- php7.1-xsl
- php7.2-cli
- php7.2-common
- php7.2-curl
- php7.2-fpm
- php7.2-gd
- php7.2-intl
- php7.2-json
- php7.2-ldap
- php7.2-mbstring
- php7.2-mysql
- php7.2-opcache
- php7.2-readline
- php7.2-xml
- php7.2-xsl
- name: Create infra dirs
command: mkdir -p /infra/etc/{{cluster_name}}/php
- name : Remove node conf in /etc
shell : "test -d /infra/etc/{{cluster_name}}/php/{{item}} || mv /etc/php/{{item}} /infra/etc/{{cluster_name}}/php"
with_items:
- 5.6
- 7.0
- 7.1
- 7.2
- name : link from infra
shell: "test -h /etc/php/{{item}} || ln -s /infra/etc/{{ cluster_name }}/php/{{item}} /etc/php"
with_items:
- 5.6
- 7.0
- 7.1
- 7.2
- name: restart services
command: service php{{item}}-fpm restart
with_items:
- 5.6
- 7.0
- 7.1
- 7.2