forked from ashemsay/restic_ynh
-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathplaybook.yml
117 lines (117 loc) · 3.02 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
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
---
- name: upgrade
hosts: all
become: true
vars:
ansible_python_interpreter: python3
tasks:
- name: set timezone
community.general.timezone:
name: Europe/Paris
- name: upgrade
apt:
upgrade: true
update_cache: true
- name: stat reboot-required file
stat:
path: /var/run/reboot-required
register: _reboot_required_stat
- name: debug _reboot_required_stat
debug:
var: _reboot_required_stat
- name: reboot if required
reboot:
when: _reboot_required_stat.stat.exists
- name: get package checker
hosts: all
become: true
vars:
ansible_python_interpreter: python3
tasks:
- name: install git
apt:
name: git
state: present
- name: clone package checker
git:
repo: 'https://github.com/YunoHost/package_check.git'
dest: /package_check
- name: set vagrant as package check owner
file:
path: /package_check
owner: vagrant
group: vagrant
- name: install package checker requirements
hosts: all
become: true
vars:
ansible_python_interpreter: python3
tasks:
- name: install test env required apt packages
apt:
name:
- git
- snapd
state: present
- name: install snap core package
community.general.snap:
name:
- core
- name: install snap lxd package
community.general.snap:
name:
- lxd
- name: make vagrant user member of lxd group
user:
name: vagrant
groups: lxd
append: true
- name: add lxc and lxd to /usr/local/bin
file:
dest: /usr/local/bin/{{ item }}
src: /snap/bin/{{ item }}
state: link
loop:
- lxc
- lxd
- name: install test script required apt packages
apt:
name:
- python3-pexpect
- python3-pip
- lynx
- jq
- name: create ansible local facts directory
file:
path: /etc/ansible/facts.d
state: directory
- name: debug local facts
debug:
var: ansible_local
- name: initialize lxd
command: lxd init --auto
notify:
- update local facts
when: >
'provision' not in ansible_local
or 'lxd' not in ansible_local['provision']
or 'initialized' not in ansible_local['provision']['lxd']
or not ansible_local['provision']['lxd']['initialized']
- name: list lxc remotes
become_user: vagrant
command: lxc remote list
changed_when: "'yunohost' not in _lxc_remote_list.stdout"
register: _lxc_remote_list
notify:
- add lxc yunohost remote
handlers:
- name: update local facts
copy:
dest: /etc/ansible/facts.d/provision.fact
content: |
[lxd]
initialized=true
- name: add lxc yunohost remote
become_user: vagrant
command: lxc remote add yunohost https://devbaseimgs.yunohost.org --public --accept-certificate
changed_when: true