-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathlinuxbrew.yml
137 lines (121 loc) · 3.85 KB
/
linuxbrew.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
130
131
132
133
134
135
136
137
---
#
# Ansible playbook: install Linuxbrew v201503180724
# Louis T. Getterman IV (@LTGIV)
# www.GotGetLLC.com / www.opensour.cc/ggcom/ansible/playbooks/linuxbrew
#
# Example Usage:
# [user@host ~$] ansible-playbook ~/ggcom/ggcom-ansible-playbooks/linuxbrew.yml --extra-vars 'target=nameFromHostsFile user=nameOfUserUsingLinuxbrew'
#
# Skip the prerequisites and go straight for the meat and potatoes:
# [user@host ~$] ansible-playbook ~/ggcom/ggcom-ansible-playbooks/linuxbrew.yml --extra-vars 'target=nameFromHostsFile user=nameOfUserUsingLinuxbrew' --tags skipprereq
# TODO: ACTION (DEFAULT IS INSTALL, BUT SHOULD ALSO HAVE UPDATE AND REMOVE)
- hosts: '{{ target }}'
sudo: yes
tasks:
- name: Install Linuxbrew prerequisites for Debian or Ubuntu
apt: >
update_cache=yes
pkg={{ item }}
state=installed
with_items:
- build-essential
- curl
- git
- m4
- ruby
- texinfo
- libbz2-dev
- libcurl4-openssl-dev
- libexpat-dev
- libncurses-dev
- zlib1g-dev
when: ansible_distribution == 'Debian' or ansible_distribution == 'Ubuntu'
- name: Install Development Tools for Red Hat or CentOS
shell: "sudo yum -y groupinstall 'Development Tools'"
when: ansible_distribution == 'Red Hat Enterprise Linux' or ansible_distribution == 'CentOS' or ansible_distribution == 'SHMZ'
- name: Install Linuxbrew prerequisites for Red Hat or CentOS
yum: >
update_cache=yes
pkg={{ item }}
state=present
with_items:
- bzip2-devel
- curl
- curl-devel
- expat-devel
- git
- irb
- m4
- ncurses-devel
- ruby
- texinfo
- zlib-devel
when: ansible_distribution == 'Red Hat Enterprise Linux' or ansible_distribution == 'CentOS' or ansible_distribution == 'SHMZ'
- name: Create temporary directory inside of user
file: >
path='~{{ user }}/tmp'
state=directory
sudo_user: '{{ user }}'
tags:
- skipprereq
- name: Creating launchpad for Linuxbrew installer
shell: "mktemp ~{{ user }}/tmp/linuxbrew.XXXXXXXX"
register: lbil
sudo_user: '{{ user }}'
tags:
- skipprereq
- name: Build launchpad
lineinfile: >
dest='{{ lbil.stdout }}'
line='cat <(echo "") | ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/linuxbrew/go/install)"'
state=present
sudo_user: '{{ user }}'
tags:
- skipprereq
- name: Running Linuxbrew installer
shell: 'bash {{ lbil.stdout }}'
args:
creates: '~/.linuxbrew/'
sudo_user: '{{ user }}'
register: retout
tags:
- skipprereq
- debug: var=retout.stdout_lines
tags:
- skipprereq
- name: Demolishing launchpad
file: >
path='{{ lbil.stdout }}'
state=absent
tags:
- skipprereq
# other choice is ~/.profile?
- name: Load Linuxbrew automatically in ~/.bash_profile
lineinfile: >
dest='~/.bash_profile'
line='{{ item }}'
create=yes
state=present
with_items:
- '# Linuxbrew functionality (installed by ggcom-ansible-playbooks/linuxbrew.yml)'
- 'export PATH="$HOME/.linuxbrew/bin:$PATH"'
sudo_user: '{{ user }}'
tags:
- skipprereq
- name: Reloading ~/.bash_profile
shell: 'source ~/.bash_profile'
sudo_user: '{{ user }}'
tags:
- skipprereq
# args:
# creates: '~/.linuxbrew/'
- name: Running Linuxbrew Doctor
shell: 'brew doctor'
sudo_user: '{{ user }}'
register: retout
tags:
- skipprereq
- debug: var=retout.stdout_lines
tags:
- skipprereq