forked from ansible-community/ansible-bender
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrecipe.yml
92 lines (92 loc) · 2.41 KB
/
recipe.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
---
- name: Containerized ansible-bender
hosts: all
vars:
test_mode: no # yes - test in CI, no - build an image
project_dir: /src
with_tests: no # yes - run test suite
with_bender_install: yes
ansible_bender:
target_image:
workging_dir: /src
cmd: /entry.sh
working_container:
volumes:
- "{{ playbook_dir }}:/src"
tasks:
- name: upgrade all packages
dnf:
name: "*"
state: latest
when: with_tests == "yes"
- name: Install all packages needed to hack on ab.
dnf:
name:
- git
- make
- python3-pip
- python3-setuptools
- python3-setuptools_scm
- python3-setuptools_scm_git_archive
- python3-wheel # for bdist_wheel
- containers-common
- buildah
- podman
- ansible
- python3-pytest
- python3-pytest-cov
- python3-flexmock
- python3-ipdb
- python3-jsonschema
- docker # one test uses it
state: present
- name: Start dockerd
systemd:
name: docker
state: started
when: with_tests == "yes"
# - name: Change storage driver to vfs (ovl on ovl doesn't work)
# lineinfile:
# path: /etc/containers/storage.conf
# regexp: '^driver = '
# line: 'driver = "vfs"'
- name: Change storage driver graphroot to /tmp/containers
lineinfile:
path: /etc/containers/storage.conf
regexp: '^graphroot = '
line: 'graphroot = "/tmp/containers"'
when: with_tests == "no"
- name: stat /src
stat:
path: /src
register: src_path
when: test_mode == "no"
- name: Let's make sure /src is present
assert:
that:
- 'src_path.stat.isdir'
when: test_mode == "no"
- name: copy entrypoint script
copy:
src: contrib/entry.sh
dest: /entry.sh
when: test_mode == "no"
- name: copy libpod.conf
copy:
src: /usr/share/containers/libpod.conf
dest: /etc/containers/libpod.conf
remote_src: yes
when: with_tests == "no"
- name: Change cgroup driver to cgroupfs.
lineinfile:
path: /etc/containers/libpod.conf
regexp: '^cgroup_manager = '
line: 'cgroup_manager = "cgroupfs"'
when: with_tests == "no"
# this requires sources mounted inside at /src
- name: Install ansible-bender from the current working directory
pip:
name: '{{ project_dir }}'
tags:
- no-cache
when: with_bender_install == "yes"