7 - name: Create Ansible Local Facts Directory
8 file: path=/etc/ansible/facts.d state=directory
10 - name: Initiate Build Numbering
12 content: '{ "release":"1" }'
13 dest: "/etc/ansible/facts.d/builder.fact"
16 - name: Set source directory for building
18 SOURCE: "/root/rpmbuild/SOURCES"
20 - name: Reload Ansible Local Facts
21 setup: filter=ansible_local
23 - name: Install "yum-utils", "rpmdevtools", "createrepo", "httpd", "git"
24 yum: update_cache=yes name={{item}} state=present
32 - name: Remove untracked files from Open vSwitch GIT repository
33 command: chdir=/git/ovs/ git clean -xdf
35 - name: Reset Open vSwitch GIT repository to last comitted state
36 command: chdir=/git/ovs/ git reset --hard
38 - name: Generate spec files for easy build dependency retrieval
39 shell: sed -e 's/@VERSION@/0.0.1/' {{item}}.in > /tmp/{{item}}
44 - kmod-openvswitch-rhel6.spec
46 - name: Install build dependencies specified from spec files
47 shell: echo "y" | yum-builddep /tmp/{{item}}
50 - kmod-openvswitch-rhel6.spec
52 - name: Create rpm dev tree
53 command: rpmdev-setuptree
55 - name: Run "./boot.sh"
56 command: chdir=/git/ovs/ ./boot.sh
58 - name: Run "./configure"
59 command: chdir=/git/ovs/ ./configure
61 - name: Run "make dist"
62 command: chdir=/git/ovs/ make dist
64 - name: Parse out Open vSwitch version from "configure.ac"
65 command: chdir=/git/ovs autoconf -t AC_INIT:'$2'
68 - name: Copy source tarball to rpm dev tree
69 command: cp /git/ovs/openvswitch-{{version.stdout}}.tar.gz {{SOURCE}}
71 - name: Unarchive openvswitch source tarball
73 src: "{{SOURCE}}/openvswitch-{{version.stdout}}.tar.gz"
77 - name: Update release number in spec files
79 path: "{{SOURCE}}/openvswitch-{{version.stdout}}/rhel/{{item}}"
81 line: "Release: {{ ansible_local.builder.release }}"
84 - kmod-openvswitch-rhel6.spec
86 - name: Build Open vSwitch user space rpms
87 command: rpmbuild -bb --without check rhel/openvswitch.spec
89 chdir: "{{SOURCE}}/openvswitch-{{version.stdout}}"
91 - name: Build Open vSwitch kmod rpms (only for currently loaded kernel)
92 command: rpmbuild -bb --without check rhel/kmod-openvswitch-rhel6.spec
94 chdir: "{{SOURCE}}/openvswitch-{{version.stdout}}"
96 - name: Copy RPM packages to /var/www/html
97 command: cp -r /root/rpmbuild/RPMS/ /var/www/html
99 - name: Create RPM Package index file for repository
100 command: chdir=/var/www/html createrepo /var/www/html
102 - name: Make sure Apache is running
103 systemd: state=started name=httpd
105 - name: Bump up Build Number
107 content: '{ "release":"{{ansible_local.builder.release|int+1}}" }'
108 dest: "/etc/ansible/facts.d/builder.fact"