-
Notifications
You must be signed in to change notification settings - Fork 0
/
playbook.yml
75 lines (65 loc) · 1.97 KB
/
playbook.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
---
- hosts: onos-controllers
become: true
vars_files:
- vars/default.yml
tasks:
- name: Add the user 'sdn' with a specific uid and a primary group of 'admin'
user:
name: "{{ user }}"
comment: user for onos
state: present
system: yes
- name: Add apt repository java 11
apt_repository:
repo: ppa:openjdk-r/ppa
- name: Check if packages are installed
shell: dpkg-query -W -f='${Status}' {{ packages }} | grep 'install ok installed'
register: app_installed
failed_when: no
changed_when: no
- name: Install {{ item }}
apt: name="{{ item }}" state=latest update_cache=yes
loop: "{{ packages }}"
when: app_installed.rc == 0
- name: Download and extract package ONOS-{{ version }}
unarchive:
src: "https://repo1.maven.org/maven2/org/onosproject/onos-releases/{{ version }}/onos-{{ version }}.tar.gz"
dest: "/home"
owner: "{{ user }}"
group: "{{ user }}"
mode: 0755
remote_src: yes
- name: Copy file to ONOS directory
copy:
src: /home/onos-{{ version }}
dst: /opt/onos
owner: "{{ user }}"
group: "{{ user }}"
mode: 0755
- name: Copy startup options onos
template:
src: "files/options.j2"
dest: "/opt/onos/options"
owner: "{{ user }}"
group: "{{ user }}"
- name: Copy onos.initd
copy:
src: "/opt/onos/init/onos.initd"
dest: "/etc/init.d/onos"
mode: 0755
remote_src: yes
- name: Copy onos.service
copy:
src: "/opt/onos/init/onos.service"
dest: "/etc/systemd/system/"
remote_src: yes
mode: 0755
notify: start onos
handlers:
- name: start onos
service:
name: onos
enabled: yes
state: started
daemon_reload: yes