-
Notifications
You must be signed in to change notification settings - Fork 4
/
Copy pathinstall.yml
104 lines (90 loc) · 2.58 KB
/
install.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
---
- hosts: all
tasks:
- name: Update and upgrade apt packages
become: true
apt:
upgrade: yes
update_cache: yes
- name: Add latest Python and Ansible PPAs
shell: "add-apt-repository {{ item }} -y"
become: true
with_items:
- ppa:jonathonf/python-3.6
- ppa:ansible/ansible
- name: install components
apt:
name: "{{ item }}"
state: present
update_cache: yes
with_items:
- python3.6
- python-pip
- python-dev
- python3-pip
- python3.6-dev
- python3.6-venv
- build-essential
- docker.io
become: true
- name: piping
pip:
name: "{{ item }}"
state: present
with_items:
- docker
become: true
- name: Add user to docker group
user:
name: "{{ ansible_user }}"
groups: docker
append: yes
become: true
- name: Set locales
blockinfile:
block: |
export LC_ALL="en_US.UTF-8"
export LC_CTYPE="en_US.UTF-8"
path: "{{ ansible_env.HOME }}/.bashrc"
- name: Copy wrapper functions
copy:
src: .bash_functions
dest: ~/.bash_functions
- name: Load wrapper functions
blockinfile:
block: |
#Add .bash_functions if it exists
if [ -f ~/.bash_functions ]; then
. ~/.bash_functions
fi
path: "{{ ansible_env.HOME }}/.bashrc"
- name: Check if git is configured
command: '{{ item }}'
register: git_status
failed_when: false
with_items:
- 'git config --global user.email'
- 'git config --global user.name'
- name: Configure git
command: '{{ item }}'
when: '{{ 0 not in (git_status.results | map(attribute="rc")) }}'
with_items:
- 'git config --global user.email "[email protected]"'
- 'git config --global user.name "Your Name"'
- name: check if on vm
shell: 'cut -d: -f1 /etc/passwd | grep vagrant'
register: vm_check
- when: "'vagrant' in vm_check.stdout"
block:
- name: run build.yml
shell: 'ansible-playbook -i inv.yml playbooks/build.yml'
args:
chdir: '/home/vagrant/warsztaty_sdn'
- name: run run.yml
shell: 'ansible-playbook -i inv.yml playbooks/run.yml'
args:
chdir: '/home/vagrant/warsztaty_sdn'
- name: run venv.yml
shell: 'ansible-playbook -i inv.yml playbooks/venv.yml'
args:
chdir: '/home/vagrant/warsztaty_sdn'