-
-
Notifications
You must be signed in to change notification settings - Fork 139
Linuxbrew #130
Linuxbrew #130
Changes from 11 commits
a5d0d19
6013e32
25a6d03
2227501
f09949b
bee0e21
986652c
36f220a
23d037c
a50ee4e
f52fd52
acd2c4c
6bbe617
33cfad3
760601b
c4fb92d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -4,24 +4,11 @@ | |
homebrew_user: '{{ homebrew_user | default(ansible_user_id) }}' | ||
homebrew_group: '{{ homebrew_group | default(ansible_user_gid) }}' | ||
|
||
# Homebrew setup prerequisites. | ||
- name: Ensure Homebrew parent directory has correct permissions (MacOS >= 10.13). | ||
file: | ||
path: "{{ homebrew_prefix }}" | ||
owner: root | ||
state: directory | ||
become: yes | ||
when: "ansible_distribution_version is version('10.13', '>=')" | ||
- include_tasks: setup-Darwin.yml | ||
when: ansible_os_family == 'Darwin' | ||
|
||
- name: Ensure Homebrew parent directory has correct permissions (MacOS < 10.13). | ||
file: | ||
path: "{{ homebrew_prefix }}" | ||
owner: root | ||
group: admin | ||
state: directory | ||
mode: 0775 | ||
become: yes | ||
when: "ansible_distribution_version is version('10.13', '<')" | ||
- include_tasks: setup-Debian.yml | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This should work on other Linux flavors too, right? For example, CentOS or Ubuntu? Ideally, I want to get tests added for those platforms (though that requires restructuring the Travis CI tests a little so I can use base images like I do for my other roles like But doing this (naming the setup tasks There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. See below. |
||
when: ansible_os_family == 'Debian' | ||
|
||
- name: Ensure Homebrew directory exists. | ||
file: | ||
|
@@ -107,6 +94,7 @@ | |
- name: Ensure blacklisted cask applications are not installed. | ||
homebrew_cask: "name={{ item }} state=absent" | ||
loop: "{{ homebrew_cask_uninstalled_apps }}" | ||
when: ansible_os_family == 'Darwin' | ||
|
||
- name: Install configured cask applications. | ||
homebrew_cask: | ||
|
@@ -117,6 +105,7 @@ | |
loop: "{{ homebrew_cask_apps }}" | ||
notify: | ||
- Clear homebrew cache | ||
when: ansible_os_family == 'Darwin' | ||
|
||
# Brew. | ||
- name: Ensure blacklisted homebrew packages are not installed. | ||
|
@@ -152,3 +141,5 @@ | |
# the `homebrew_user` doesn't match the `ansible_user_id` | ||
become: "{{ (homebrew_user != ansible_user_id) | bool }}" | ||
become_user: "{{ homebrew_user }}" | ||
environment: | ||
PATH: "{{ ansible_env.PATH }}:{{ homebrew_brew_bin_path }}" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
--- | ||
# Homebrew setup prerequisites. | ||
- name: Ensure Homebrew parent directory has correct permissions (MacOS >= 10.13). | ||
file: | ||
path: "{{ homebrew_prefix }}" | ||
owner: root | ||
state: directory | ||
become: yes | ||
when: "ansible_distribution_version is version('10.13', '>=')" | ||
|
||
- name: Ensure Homebrew parent directory has correct permissions (MacOS < 10.13). | ||
file: | ||
path: "{{ homebrew_prefix }}" | ||
owner: root | ||
group: admin | ||
state: directory | ||
mode: 0775 | ||
become: yes | ||
when: "ansible_distribution_version is version('10.13', '<')" |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
--- | ||
- name: Ensure that gcc is available. | ||
apt: | ||
name: gcc | ||
state: present | ||
update_cache: yes | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I typically let playbooks set There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Done There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Maybe a better solution is to remove this step entirely. As I said at the top, this is the only step that is specific to Debian. Subject to testing/debugging. |
||
become: yes | ||
|
||
- name: Check if homebrew grandparent directory is already in place. | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Technically 'parent' (not grandparent) according to the registered var name? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. More context: - name: Check if homebrew grandparent directory is already in place.
stat:
path: "{{ homebrew_prefix | dirname }}"
register: homebrew_prefix_parent
check_mode: no In homebrew_install_path: "{{ homebrew_prefix }}/Homebrew" My thinking is that
so I do not think we want to replace "grandparent" with "parent" here. If you think this is confusing, then we can come up with something better. Or maybe I should just change |
||
stat: | ||
path: "{{ homebrew_prefix | dirname }}" | ||
register: homebrew_prefix_parent | ||
check_mode: no | ||
|
||
- name: Ensure Homebrew grandparent directory is in place. | ||
file: | ||
path: "{{ homebrew_prefix | dirname }}" | ||
owner: root | ||
group: root | ||
state: directory | ||
become: yes | ||
when: not homebrew_prefix_parent.stat.exists | ||
|
||
- name: Ensure Homebrew parent directory is in place. | ||
file: | ||
path: "{{ homebrew_prefix }}" | ||
owner: "{{ homebrew_user }}" | ||
group: "{{ homebrew_group }}" | ||
state: directory | ||
become: yes |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should also work on
Ubuntu
the way it's currently structured. And with a couple tweaks mentioned elsewhere in this review, it should also work onEL
(Red Hat / CentOS) andFedora
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I guess I assumed that the
platforms
in the meta file were the same asansible_os_family
.See below.