|
18 | 18 | apt:
|
19 | 19 | state: present
|
20 | 20 | name:
|
21 |
| - - python-apt |
22 |
| - - python-pycurl |
| 21 | + - python3-apt |
| 22 | + - python3-pycurl |
23 | 23 |
|
24 | 24 | - name: Add ondrej repository for later versions of PHP.
|
25 | 25 | apt_repository: repo='ppa:ondrej/php' update_cache=yes
|
|
64 | 64 | apache2_module: name=rewrite state=present
|
65 | 65 | notify: restart apache
|
66 | 66 |
|
67 |
| - - name: Add Apache virtualhost for Drupal 8. |
| 67 | + - name: Add Apache virtualhost for Drupal. |
68 | 68 | template:
|
69 | 69 | src: "templates/drupal.test.conf.j2"
|
70 | 70 | dest: "/etc/apache2/sites-available/{{ domain }}.test.conf"
|
|
73 | 73 | mode: 0644
|
74 | 74 | notify: restart apache
|
75 | 75 |
|
76 |
| - - name: Symlink Drupal virtualhost to sites-enabled. |
77 |
| - file: |
78 |
| - src: "/etc/apache2/sites-available/{{ domain }}.test.conf" |
79 |
| - dest: "/etc/apache2/sites-enabled/{{ domain }}.test.conf" |
80 |
| - state: link |
| 76 | + - name: Enable the Drupal site. |
| 77 | + command: > |
| 78 | + a2ensite {{ domain }}.test |
| 79 | + creates=/etc/apache2/sites-enabled/{{ domain }}.test.conf |
81 | 80 | notify: restart apache
|
82 | 81 |
|
83 |
| - - name: Remove default virtualhost file. |
84 |
| - file: |
85 |
| - path: "/etc/apache2/sites-enabled/000-default.conf" |
86 |
| - state: absent |
| 82 | + - name: Disable the default site. |
| 83 | + command: > |
| 84 | + a2dissite 000-default |
| 85 | + removes=/etc/apache2/sites-enabled/000-default.conf |
87 | 86 | notify: restart apache
|
88 | 87 |
|
89 | 88 | - name: Adjust OpCache memory setting.
|
|
131 | 130 | mv /tmp/composer.phar /usr/local/bin/composer
|
132 | 131 | creates=/usr/local/bin/composer
|
133 | 132 |
|
134 |
| - - name: Check out drush 8.x branch. |
135 |
| - git: |
136 |
| - repo: https://github.com/drush-ops/drush.git |
137 |
| - version: 8.x |
138 |
| - dest: /opt/drush |
139 |
| - |
140 |
| - - name: Install Drush dependencies with Composer. |
141 |
| - command: > |
142 |
| - /usr/local/bin/composer install |
143 |
| - chdir=/opt/drush |
144 |
| - creates=/opt/drush/vendor/autoload.php |
145 |
| -
|
146 |
| - - name: Create drush bin symlink. |
147 |
| - file: |
148 |
| - src: /opt/drush/drush |
149 |
| - dest: /usr/local/bin/drush |
150 |
| - state: link |
151 |
| - |
152 |
| - - name: Check out Drupal Core to the Apache docroot. |
153 |
| - git: |
154 |
| - repo: https://git.drupal.org/project/drupal.git |
155 |
| - version: "{{ drupal_core_version }}" |
156 |
| - dest: "{{ drupal_core_path }}" |
157 |
| - register: git_checkout |
158 |
| - |
159 |
| - - name: Ensure Drupal codebase is owned by www-data. |
| 133 | + - name: Ensure Drupal docroot exists. |
160 | 134 | file:
|
161 | 135 | path: "{{ drupal_core_path }}"
|
| 136 | + state: directory |
162 | 137 | owner: www-data
|
163 | 138 | group: www-data
|
164 |
| - recurse: true |
165 |
| - when: git_checkout.changed | bool |
166 | 139 |
|
167 |
| - - name: Install Drupal dependencies with Composer. |
168 |
| - command: > |
169 |
| - /usr/local/bin/composer install |
170 |
| - chdir={{ drupal_core_path }} |
171 |
| - creates={{ drupal_core_path }}/vendor/autoload.php |
| 140 | + - name: Check if Drupal project already exists. |
| 141 | + stat: |
| 142 | + path: "{{ drupal_core_path }}/composer.json" |
| 143 | + register: drupal_composer_json |
| 144 | + |
| 145 | + - name: Create Drupal project. |
| 146 | + composer: |
| 147 | + command: create-project |
| 148 | + arguments: drupal/recommended-project "{{ drupal_core_path }}" |
| 149 | + working_dir: "{{ drupal_core_path }}" |
| 150 | + no_dev: true |
172 | 151 | become_user: www-data
|
| 152 | + when: not drupal_composer_json.stat.exists |
| 153 | + |
| 154 | + - name: Add drush to the Drupal site with Composer. |
| 155 | + composer: |
| 156 | + command: require |
| 157 | + arguments: drush/drush:10.* |
| 158 | + working_dir: "{{ drupal_core_path }}" |
| 159 | + become_user: www-data |
| 160 | + when: not drupal_composer_json.stat.exists |
173 | 161 |
|
174 | 162 | - name: Install Drupal.
|
175 | 163 | command: >
|
176 |
| - drush si -y --site-name="{{ drupal_site_name }}" |
| 164 | + vendor/bin/drush si -y --site-name="{{ drupal_site_name }}" |
177 | 165 | --account-name=admin
|
178 | 166 | --account-pass=admin
|
179 | 167 | --db-url=mysql://{{ domain }}:1234@localhost/{{ domain }}
|
180 |
| - --root={{ drupal_core_path }} |
181 |
| - creates={{ drupal_core_path }}/sites/default/settings.php |
| 168 | + --root={{ drupal_core_path }}/web |
| 169 | + chdir={{ drupal_core_path }} |
| 170 | + creates={{ drupal_core_path }}/web/sites/default/settings.php |
182 | 171 | notify: restart apache
|
183 | 172 | become_user: www-data
|
0 commit comments