Skip to content
This repository was archived by the owner on Feb 13, 2023. It is now read-only.

Commit 75f9074

Browse files
committed
Fixes #1778: Remove Ansible 2.2 compatibility tasks.
1 parent c941110 commit 75f9074

File tree

1 file changed

+10
-44
lines changed
  • provisioning/roles/drupalvm.www/tasks

1 file changed

+10
-44
lines changed

provisioning/roles/drupalvm.www/tasks/main.yml

Lines changed: 10 additions & 44 deletions
Original file line numberDiff line numberDiff line change
@@ -18,59 +18,25 @@
1818
# machine, but the groupname will differ or not exist. For the latter case
1919
# we create a group called `vagrant_group`.
2020
#
21-
# In Ansible 2.3+ the gr_name will be set if the GID is mapped to an existing
22-
# group. If the GID doesn't exist, gr_name will be undefined.
23-
- name: Ensure a group with the same GID as used to sync directories exist (Ansible 2.3+).
21+
# The gr_name will be set if the GID is mapped to an existing group. If the GID
22+
# doesn't exist, gr_name will be undefined.
23+
- name: Ensure a group with the same GID as used to sync directories exist.
2424
group:
2525
gid: "{{ vagrant_directory.stat.gid }}"
2626
name: vagrant_group
2727
state: present
28-
when: >
29-
ansible_version.full | version_compare('2.3', '>=') and
30-
vagrant_directory.stat.exists and
31-
vagrant_directory.stat.gr_name is undefined
28+
when:
29+
- vagrant_directory.stat.exists
30+
- vagrant_directory.stat.gr_name is undefined
3231

33-
- name: Ensure the webserver user is in the same group as the owner of synced directories (Ansible 2.3+).
32+
- name: Ensure the webserver user is in the same group as the owner of synced directories.
3433
user:
3534
name: "{{ drupalvm_webserver_user }}"
3635
append: yes
3736
groups: "{{ vagrant_directory.stat.gr_name|default('vagrant_group') }}"
38-
when: >
39-
ansible_version.full | version_compare('2.3', '>=') and
40-
vagrant_directory.stat.exists and
41-
not (vagrant_directory.stat.gr_name is defined and vagrant_directory.stat.gr_name == 'root')
42-
43-
# With Ansible 2.2 or lower, the existance of gr_name is dependant on the
44-
# existance of UID as well, therefore we cannot rely on it.
45-
# TODO: Remove the version compares and the 2.2 tasks once we require Ansible
46-
# 2.3+
47-
- name: Detect if group used to sync directories already exist (Ansible 2.2).
48-
shell: "getent group {{ vagrant_directory.stat.gid }} | cut -d':' -f1"
49-
register: vagrant_directory_groupname
50-
changed_when: false
51-
when: >
52-
ansible_version.full | version_compare('2.3', '<') and
53-
vagrant_directory.stat.exists
54-
55-
- name: Ensure a group with the same GID as used to sync directories exist (Ansible 2.2).
56-
group:
57-
gid: "{{ vagrant_directory.stat.gid }}"
58-
name: vagrant_group
59-
state: present
60-
when: >
61-
ansible_version.full | version_compare('2.3', '<') and
62-
vagrant_directory.stat.exists and
63-
vagrant_directory_groupname.stdout == ''
64-
65-
- name: Ensure the webserver user is in the same group as the owner of synced directories (Ansible 2.2).
66-
user:
67-
name: "{{ drupalvm_webserver_user }}"
68-
append: yes
69-
groups: "{{ vagrant_directory_groupname.stdout|default('vagrant_group') }}"
70-
when: >
71-
ansible_version.full | version_compare('2.3', '<') and
72-
vagrant_directory.stat.exists and
73-
vagrant_directory_groupname.stdout != 'root'
37+
when:
38+
- vagrant_directory.stat.exists
39+
- not (vagrant_directory.stat.gr_name is defined and vagrant_directory.stat.gr_name == 'root')
7440

7541
- name: Ensure admin group exist.
7642
group: "name=admin state=present"

0 commit comments

Comments
 (0)