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