-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathansible.yml
98 lines (84 loc) · 2.38 KB
/
ansible.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
---
- hosts: need_swap
tasks:
- name: set swap_file variable
set_fact:
swap_file: /mnt/{{ swap_space }}.swap
- name: check if swap file exists
stat:
path: "{{ swap_file }}"
register: swap_file_check
- name: create swap file
become: true
command: fallocate -l {{ swap_space }} {{ swap_file }}
when: not swap_file_check.stat.exists
- name: set permissions on swap file
become: true
file:
path: "{{ swap_file }}"
mode: 0600
- name: format swap file
become: true
command: mkswap {{ swap_file }}
when: not swap_file_check.stat.exists
- name: add to fstab
become: true
lineinfile:
dest: /etc/fstab
regexp: "{{ swap_file }}"
line: "{{ swap_file }} none swap sw 0 0"
- name: turn on swap
become: true
command: swapon -a
- name: set swapiness
become: true
sysctl:
name: vm.swappiness
value: "1"
- hosts: all
tasks:
- name: add gcc-arm-embedded
become: true
apt_repository: repo='ppa:team-gcc-arm-embedded/ppa'
- name: Installs packages
become: true
apt:
pkg:
- git-core
- g++
- subversion
- libncurses-dev
- libssl-dev
- unzip
- gettext
- gcc-arm-none-eabi
state: present
update_cache: true
cache_valid_time: 86400
- name: Git configuration
copy:
dest: ~/.gitconfig
content: |
[user]
name = T2 Builder
email = [email protected]
- name: ensure github.com is a known host
lineinfile:
dest: ~/.ssh/known_hosts
create: yes
state: present
line: "{{ lookup('pipe', 'ssh-keyscan -t rsa github.com') }}"
regexp: "^github\\.com"
- name: ensure bitbucket.org is a known host
lineinfile:
dest: ~/.ssh/known_hosts
create: yes
state: present
line: "{{ lookup('pipe', 'ssh-keyscan -t rsa bitbucket.org') }}"
regexp: "^bitbucket\\.org"
- name: create build dir
become: true
# option to override build_dir_owner (currently used by vagrant)
file: path=/work state=directory mode=0755 owner={{build_dir_owner | default('ubuntu')}}
- name: start in build dir
lineinfile: dest=~/.bashrc line="cd /work"