]> git.proxmox.com Git - mirror_ovs.git/blame - poc/playbook-fedora-builder.yml
ofp-monitor: Make OFP_FLOW_REMOVED_REASON_BUFSIZE public.
[mirror_ovs.git] / poc / playbook-fedora-builder.yml
CommitLineData
3a2ceb01
AA
1---
2- hosts: all
3 become: true
4 name: builder
5
6 gather_facts: false
7 pre_tasks:
8
9 - name: Install python2 for Ansible
10 raw: bash -c "test -e /usr/bin/python || (dnf -y install python2)"
11 register: output
12 changed_when: output.stdout != ""
13
14 - name: Gathering Facts
15 setup:
16
17 tasks:
18 - name: Create Ansible Local Facts Directory
19 file: path=/etc/ansible/facts.d state=directory
20
21 - name: Install "yum-utils", "rpmdevtools", "createrepo", "httpd", "git"
22 dnf: name={{item}} state=present
23 with_items:
24 - yum-utils
25 - rpmdevtools
26 - createrepo
27 - httpd
28 - git
29 - libselinux-python
30
31 - name: Initiate Build Numbering
32 copy:
33 content: '{ "release":"1" }'
34 dest: "/etc/ansible/facts.d/builder.fact"
35 force: no
36
37 - name: Set source directory for building
38 set_fact:
39 SOURCE: "/root/rpmbuild/SOURCES"
40
41 - name: Reload Ansible Local Facts
42 setup: filter=ansible_local
43
44 - name: Remove untracked files from Open vSwitch GIT repository
45 command: chdir=/git/ovs/ git clean -xdf
46
47 - name: Reset Open vSwitch GIT repository to last comitted state
48 command: chdir=/git/ovs/ git reset --hard
49
50 - name: Generate spec files for easy build dependency retrieval
51 shell: sed -e 's/@VERSION@/0.0.1/' {{item}}.in > /tmp/{{item}}
52 args:
53 chdir: /git/ovs/rhel
54 with_items:
55 - openvswitch-fedora.spec
56 - openvswitch-kmod-fedora.spec
57 - openvswitch-dkms.spec
58
59 - name: Install build dependencies specified from spec files
60 shell: echo "y" | yum-builddep /tmp/{{item}}
61 with_items:
62 - openvswitch-fedora.spec
63 - openvswitch-kmod-fedora.spec
64 - openvswitch-dkms.spec
65
66 - name: Create rpm dev tree
67 command: rpmdev-setuptree
68
69 - name: Run "./boot.sh"
70 command: chdir=/git/ovs/ ./boot.sh
71
72 - name: Run "./configure"
73 command: chdir=/git/ovs/ ./configure
74
75 - name: Run "make dist"
76 command: chdir=/git/ovs/ make dist
77
78 - name: Parse out Open vSwitch version from "configure.ac"
79 command: chdir=/git/ovs autoconf -t AC_INIT:'$2'
80 register: version
81
82 - name: Copy source tarball to rpm dev tree
83 command: cp /git/ovs/openvswitch-{{version.stdout}}.tar.gz {{SOURCE}}
84
85 - name: Unarchive openvswitch source tarball
86 unarchive:
87 src: "{{SOURCE}}/openvswitch-{{version.stdout}}.tar.gz"
88 dest: "{{SOURCE}}"
89 remote_src: yes
90
91 - name: Update release number in spec files
92 lineinfile:
93 path: "{{SOURCE}}/openvswitch-{{version.stdout}}/rhel/{{item}}"
94 regexp: '^Release:'
95 line: "Release: {{ ansible_local.builder.release }}"
96 with_items:
97 - openvswitch-fedora.spec
98 - openvswitch-kmod-fedora.spec
99 - openvswitch-dkms.spec
100
101 - name: Build Open vSwitch user space rpms
102 command: rpmbuild -bb --without check rhel/openvswitch-fedora.spec
103 args:
104 chdir: "{{SOURCE}}/openvswitch-{{version.stdout}}"
105
106 - name: Build Open vSwitch kmod rpm
107 command: rpmbuild -bb --without check rhel/openvswitch-fedora.spec
108 args:
109 chdir: "{{SOURCE}}/openvswitch-{{version.stdout}}"
110
111 - name: Build Open vSwitch dkms rpm
112 command: rpmbuild -bb --without check rhel/openvswitch-dkms.spec
113 args:
114 chdir: "{{SOURCE}}/openvswitch-{{version.stdout}}"
115
116 - name: Copy RPM packages to /var/www/html
117 command: cp -r /root/rpmbuild/RPMS/ /var/www/html
118
119 - name: Create RPM Package index file for repository
120 command: chdir=/var/www/html createrepo /var/www/html
121
122 - name: Make sure Apache is running
123 systemd: state=started name=httpd
124
125 - name: Bump up Build Number
126 copy:
127 content: '{ "release":"{{ansible_local.builder.release|int+1}}" }'
128 dest: "/etc/ansible/facts.d/builder.fact"