foreman_discovery 1.3.0.rc3 → 1.3.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,60 +0,0 @@
1
- # vim: ts=8:sw=8:noet
2
- #
3
- # Copyright (C) 2013 Red Hat, Inc.
4
- #
5
- # This program is free software; you can redistribute it and/or modify
6
- # it under the terms of the GNU General Public License as published by
7
- # the Free Software Foundation; version 2 of the License.
8
- #
9
- # This program is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- # GNU General Public License for more details.
13
- #
14
- # You should have received a copy of the GNU General Public License
15
- # along with this program; if not, write to the Free Software
16
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17
- # MA 02110-1301, USA. A copy of the GNU General Public License is
18
- # also available at http://www.gnu.org/copyleft/gpl.html.
19
-
20
- OVIRT_CACHE_DIR ?= $(HOME)/ovirt-cache
21
-
22
- PYTHONSOURCES = \
23
- $(shell find scripts -name \*.py)
24
-
25
- SHELL := /bin/bash
26
-
27
- SUBDIRS = \
28
- conf \
29
- src \
30
- recipe
31
-
32
- EXTRA_DIST = \
33
- ovirt-node-plugin-foreman.spec \
34
- ovirt-node-plugin-foreman.spec.in
35
-
36
- DISTCLEANFILES = $(PACKAGE)-$(VERSION).tar.gz \
37
- aclocal.m4 \
38
- configure \
39
- install-sh \
40
- missing
41
-
42
- DISTCLEANDIRS = autom4te.cache
43
-
44
- rpms: dist
45
- rpmbuild $(RPM_FLAGS) -ta $(distdir).tar.gz
46
-
47
- srpms: dist
48
- rpmbuild $(RPM_FLAGS) -ts $(distdir).tar.gz
49
-
50
- publish: rpms
51
- mkdir -p $(OVIRT_CACHE_DIR)
52
- rsync -aq $(shell rpm --eval '%{_rpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/
53
- rsync -aq $(shell rpm --eval '%{_srcrpmdir}')/ $(OVIRT_CACHE_DIR)/ovirt/src
54
- createrepo $(OVIRT_CACHE_DIR)/ovirt
55
-
56
- iso: publish
57
- cd recipe
58
- make node
59
-
60
- .PHONY: rpms publish srpms
@@ -1,217 +0,0 @@
1
- Foreman Discovery oVirt Node Plugin
2
- ===================================
3
-
4
- There are couple of options how to get a oVirt Node Discovery image:
5
-
6
- * Downloading existing one is the easiest method, but the image does not
7
- provide site-specific options.
8
-
9
- * Downloading existing oVirt Node base image and injecting plugin into it.
10
- This is the recommended process of creating your own image. It is fast and
11
- still provides great flexibility of customization of the resulting image.
12
-
13
- * Building own oVirt Node base image and injecting the plugin into it. This
14
- option must be used if you want to play with latest and greatest base image.
15
-
16
- All three processes are described on this page.
17
-
18
- Downloading image
19
- -----------------
20
-
21
- We provide download links on the [Foreman Discovery plugin
22
- page](https://github.com/theforeman/foreman_discovery).
23
-
24
- Injecting into existing base image
25
- ----------------------------------
26
-
27
- Warning: This process will set SELinux to permissive mode during the build of
28
- new iso image. Since this can compromise security, it is highly recommended to
29
- use dedicated VM guest for building images.
30
-
31
- Although it is not possible to use stable version (3.0) for a base image,
32
- there are couple of [nightly
33
- builds](http://resources.ovirt.org/releases/node-base/nightly/iso/) that can
34
- be used. It seems any image from version 3.0.3 can be used.
35
-
36
- Discovery image 0.3.0 is built from 0.3.0-1.1.fc19 base iso image:
37
-
38
- wget http://resources.ovirt.org/releases/node-base/nightly/iso/ovirt-node-iso-3.0.3-1.1.fc19.iso
39
-
40
- We plan to release Fedora and RHEL based discovery images built from oVirt
41
- Node stable version 3.1.
42
-
43
- Building the base image from git
44
- --------------------------------
45
-
46
- Building the discovery image involves two main steps:
47
-
48
- * Building base oVirt Node ISO from git.
49
- * Building the discovery plugin and inserting it into the existing ISO.
50
-
51
- Follow instructions on [oVirt
52
- wiki](http://www.ovirt.org/Node_Building#From_Git) to build the base oVirt
53
- Node ISO. Before proceeding, check the instruction on the oVirt page as they
54
- may change in future. What we have here might be different when using master.
55
-
56
- We are using clean VM guest of Fedora 19 and directly from root account. If
57
- you want to build using different user, check out the building instructions
58
- above and setup sudo for some commands. Make sure you have at least 4 GB of
59
- free space on the partition you are building on.
60
-
61
- First of all, fetch ovirt-node utilities and image builder:
62
-
63
- git clone http://gerrit.ovirt.org/p/ovirt-node.git
64
- git clone http://gerrit.ovirt.org/p/ovirt-node-iso.git
65
-
66
- Build ovirt-node packages:
67
-
68
- export OVIRT_NODE_BASE=$PWD
69
- export OVIRT_CACHE_DIR=~/ovirt-cache
70
- export OVIRT_LOCAL_REPO=file://${OVIRT_CACHE_DIR}/ovirt
71
- mkdir -p $OVIRT_CACHE_DIR
72
- yum install livecd-tools appliance-tools-minimizer fedora-packager \
73
- python-devel rpm-build createrepo selinux-policy-doc checkpolicy \
74
- selinux-policy-devel autoconf automake python-mock python-lockfile
75
- cd $OVIRT_NODE_BASE
76
- cd ovirt-node
77
- export EXTRA_RELEASE=.foreman
78
- ./autogen.sh --with-image-minimizer
79
- make publish
80
-
81
- Build the base image and move it to the base directory:
82
-
83
- cd $OVIRT_NODE_BASE
84
- cd ovirt-node-iso
85
- ./autogen.sh --with-recipe=$OVIRT_NODE_BASE/ovirt-node/recipe
86
- make iso
87
- mv ovirt-node-iso-*.iso $OVIRT_NODE_BASE/
88
-
89
- Now we are ready to inject our plugin.
90
-
91
- *Troubleshooting*
92
-
93
- If you encounter any problem during build, check internet connection first
94
- and try again. Occasionally, package cannot be downloaded from a nearest
95
- mirror so the process can fail. If the problem persists, you can try with
96
- exact githash or tag we were building from:
97
-
98
- cd ovirt-node
99
- make distclean
100
- git checkout 2e54ec17b55e1ee80
101
- cd ../ovirt-node-iso
102
- make distclean
103
- git checkout 5ac5557fc5521d644
104
- cd ..
105
-
106
- Also note that *building EL6 image (even on EL6 guest builder) is not
107
- supported* right now.
108
-
109
- Building and injecting the discovery plugin
110
- -------------------------------------------
111
-
112
- This second phase must be done on the same machine where base image was built.
113
- Please do not clean ovirt-node and cache directory as it is being used here.
114
-
115
- Building the plugin is much faster than building the base ISO and you can
116
- repeat this step more times. The base (source) ISO file will not get modified
117
- so you do not need to create any backup.
118
-
119
- Whole process can be described:
120
-
121
- * Discovery plugin is build as an RPM and copied to `OVIRT_CACHE` directory.
122
- * Base ISO is unpacked, mounted.
123
- * Discovery RPM plugin is installed into the image making necessary changes.
124
- * Many packages are uninstalled from the image shrinking size down to 170MB.
125
- * Image is cleaned and wrapped back as ISO with ".foreman." version tag.
126
- * Kernel image and init ram disk is extracted from the ISO.
127
-
128
- First of all we build plugin RPMs. Before that, we are going to clear the
129
- RPMSDIR directory just to make sure it's clean and publish it to the cache repository.
130
-
131
- cd $OVIRT_NODE_BASE
132
- RPMSDIR=$(rpm --eval '%{_rpmdir}')
133
- rm -f $RPMSDIR/noarch/*rpm
134
- git clone https://github.com/theforeman/foreman_discovery.git
135
- cd foreman_discovery/extra/ovirt-node-plugin-foreman
136
- ./autogen.sh
137
- make rpms
138
-
139
- Now, let's modify the base ISO image and install the plugin there.
140
-
141
- cd $OVIRT_NODE_BASE
142
-
143
- Create a new repo file in this directory with the following contents.
144
-
145
- cat > ./foreman.repo <<'EOF'
146
- [fedora-edit-node]
147
- name=Fedora $releasever - $basearch
148
- failovermethod=priority
149
- baseurl=http://download.fedoraproject.org/pub/fedora/linux/releases/$releasever/Everything/$basearch/os/
150
- #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=fedora-$releasever&arch=$basearch
151
- enabled=1
152
- gpgcheck=1
153
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
154
-
155
- [updates-edit-node]
156
- name=Fedora $releasever - $basearch - Updates
157
- failovermethod=priority
158
- baseurl=http://download.fedoraproject.org/pub/fedora/linux/updates/$releasever/$basearch/
159
- #mirrorlist=https://mirrors.fedoraproject.org/metalink?repo=updates-released-f$releasever&arch=$basearch
160
- enabled=1
161
- gpgcheck=1
162
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-$basearch
163
-
164
- [foreman]
165
- name=Foreman nightly
166
- baseurl=http://yum.theforeman.org/nightly/f19/$basearch
167
- enabled=1
168
- gpgcheck=0
169
- gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-foreman
170
- EOF
171
-
172
- These three repositories will be used to install extra packages from Fedora 19
173
- and also Foreman Proxy from nightly repository. You can switch to Foreman 1.3+
174
- stable repository if you want. Injection is easy and quite fast:
175
-
176
- ovirt-node/tools/edit-node \
177
- --repo foreman.repo \
178
- --nogpgcheck \
179
- --install $RPMSDIR/noarch/ovirt-node-plugin-foreman-0*.rpm \
180
- --verbose \
181
- --debug \
182
- ovirt-node-iso-*.iso
183
- mv -f ovirt-node-iso-*.foreman.*.iso foreman.iso
184
- test -d tftpboot && rm -rf tftpboot
185
- livecd-iso-to-pxeboot foreman.iso
186
-
187
- Note we are renaming the target ISO to foreman.iso prior extracting kernel and
188
- initrd, otherwise you'd need to change kernel boot options.
189
-
190
- Finally, it's the time to copy those files to TFTP server:
191
-
192
- scp tftpboot/initrd0.img root@tftp_server:/var/lib/tftpboot/boot/discovery-initrd.img
193
- scp tftpboot/vmlinuz0 root@tftp_server:/var/lib/tftpboot/boot/discovery-vmlinuz
194
-
195
- Setup Foreman templates
196
- -----------------------
197
-
198
- Read instructions about how to setup Foreman and PXE on the following pages:
199
-
200
- * [Foreman Discovery oVirt Node instructions](../../README.ovirt_image.md)
201
- * [Foreman Discovery instructions](../../README.md)
202
-
203
- Development
204
- -----------
205
-
206
- The image is locked down, the root account is locked and there is no ssh
207
- daemon running on the image. But all of this can be enabled and few more
208
- command line utilities can be installed, if the plugin is configured with this
209
- option:
210
-
211
- make distclean
212
- ./autogen.sh --enable-debug
213
-
214
- The root password is set to "development" and ssh daemon is listening on the
215
- standard port. Also logging of discover-host and foreman-proxy services is
216
- increased to DEBUG level. See /tmp directory.
217
-
@@ -1,66 +0,0 @@
1
- #!/bin/sh
2
- # Run this to generate configure and Makefile
3
-
4
- srcdir=`dirname $0`
5
- test -z "$srcdir" && srcdir=.
6
-
7
- THEDIR=`pwd`
8
- (
9
- cd $srcdir
10
- die=0
11
-
12
- (autoconf --version) < /dev/null > /dev/null 2>&1 || {
13
- echo
14
- echo "You must have autoconf installed."
15
- echo "Download the appropriate package for your distribution,"
16
- echo "or see http://www.gnu.org/software/autoconf"
17
- die=1
18
- }
19
-
20
- # Require libtool only if one of of LT_INIT,
21
- # AC_PROG_LIBTOOL, AM_PROG_LIBTOOL is used in configure.ac.
22
- grep -E '^[[:blank:]]*(LT_INIT|A[CM]_PROG_LIBTOOL)' configure.ac >/dev/null \
23
- && {
24
- (libtool --version) < /dev/null > /dev/null 2>&1 || {
25
- echo
26
- echo "You must have libtool installed."
27
- echo "Download the appropriate package for your distribution,"
28
- echo "or see http://www.gnu.org/software/libtool"
29
- die=1
30
- }
31
- }
32
-
33
- (automake --version) < /dev/null > /dev/null 2>&1 || {
34
- echo
35
- die=1
36
- echo "You must have automake installed."
37
- echo "Download the appropriate package for your distribution,"
38
- echo "or see http://www.gnu.org/software/automake"
39
- }
40
-
41
- test $die = 1 && exit 1
42
-
43
- test -f ovirt-node-plugin-foreman.spec.in || {
44
- echo "You must run this script in the top-level directory"
45
- exit 1
46
- }
47
-
48
- if test -z "$*"; then
49
- echo "I am going to run ./configure with no arguments - if you wish "
50
- echo "to pass any to it, please specify them on the $0 command line."
51
- fi
52
-
53
- aclocal
54
-
55
- # Run autoheader only if needed
56
- grep '^[[:blank:]]*AC_CONFIG_HEADERS' configure.ac >/dev/null && autoheader
57
-
58
- automake --add-missing
59
- autoconf
60
- ./configure "$@"
61
- )
62
-
63
- if test "x$OBJ_DIR" != x; then
64
- mkdir -p "$OBJ_DIR"
65
- cd "$OBJ_DIR"
66
- fi
@@ -1,29 +0,0 @@
1
- # vim: ts=8:sw=8:noet
2
- #
3
- # Copyright (C) 2013 Red Hat, Inc.
4
- #
5
- # This program is free software; you can redistribute it and/or modify
6
- # it under the terms of the GNU General Public License as published by
7
- # the Free Software Foundation; version 2 of the License.
8
- #
9
- # This program is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- # GNU General Public License for more details.
13
- #
14
- # You should have received a copy of the GNU General Public License
15
- # along with this program; if not, write to the Free Software
16
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17
- # MA 02110-1301, USA. A copy of the GNU General Public License is
18
- # also available at http://www.gnu.org/copyleft/gpl.html.
19
- # Copyright (C) 2010, Red Hat, Inc.
20
- #
21
-
22
- EXTRA_DIST= \
23
- foreman-plugin.*
24
-
25
- pluginsdir = $(sysconfdir)/ovirt-plugins.d
26
-
27
- dist_plugins_DATA = \
28
- foreman-plugin.logs \
29
- foreman-plugin.firewall
@@ -1,4 +0,0 @@
1
- # Note that we uninstall ovirt-node so this is not effective, but we
2
- # keep this for completeness of the foreman plugin.
3
- 8443,tcp
4
- @EXTRA_FIREWALL_RULE@
@@ -1,2 +0,0 @@
1
- # no relevant log files for foreman
2
- # (we are logging everything in /tmp in development mode)
@@ -1,62 +0,0 @@
1
- # vim: ts=8:sw=8:noet
2
- #
3
- # Copyright (C) 2013 Red Hat, Inc.
4
- #
5
- # This program is free software; you can redistribute it and/or modify
6
- # it under the terms of the GNU General Public License as published by
7
- # the Free Software Foundation; version 2 of the License.
8
- #
9
- # This program is distributed in the hope that it will be useful,
10
- # but WITHOUT ANY WARRANTY; without even the implied warranty of
11
- # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12
- # GNU General Public License for more details.
13
- #
14
- # You should have received a copy of the GNU General Public License
15
- # along with this program; if not, write to the Free Software
16
- # Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
17
- # MA 02110-1301, USA. A copy of the GNU General Public License is
18
- # also available at http://www.gnu.org/copyleft/gpl.html.
19
-
20
- AC_INIT([ovirt-node-plugin-foreman], [0.3.1], [foreman-dev@googlegroups.com])
21
- AM_INIT_AUTOMAKE([-Wall -Werror foreign -Wno-portability tar-pax])
22
- AC_SUBST([ENGINENAME], ['Foreman Discovery'])
23
- PKG_PROG_PKG_CONFIG
24
-
25
- AC_MSG_CHECKING([whether to enable plugin debug support])
26
- AC_ARG_ENABLE(debug,
27
- AS_HELP_STRING([--enable-debug],
28
- [turn on debug support (starts ssh daemon and sets root password)]))
29
- if test x$enable_debug = xyes; then
30
- AC_MSG_RESULT([yes])
31
- AC_MSG_NOTICE([WARNING: ssh daemon enabled and root password set to 'development'])
32
- PLUGIN_DEBUG=1
33
- EXTRA_FIREWALL_RULE="22,tcp"
34
- else
35
- AC_MSG_RESULT([no])
36
- PLUGIN_DEBUG=0
37
- EXTRA_FIREWALL_RULE="#22,tcp"
38
- fi
39
- AC_SUBST(PLUGIN_DEBUG)
40
- AC_SUBST(EXTRA_FIREWALL_RULE)
41
-
42
- AC_MSG_CHECKING([for systemd unit directory])
43
- AC_ARG_WITH([systemdsystemunitdir],
44
- AS_HELP_STRING([--with-systemdsystemunitdir=DIR],
45
- [Directory for systemd service files]),
46
- [], [with_systemdsystemunitdir=$($PKG_CONFIG --variable=systemdsystemunitdir systemd)])
47
- if test "x$with_systemdsystemunitdir" != xno; then
48
- AC_SUBST([systemdsystemunitdir], [$with_systemdsystemunitdir])
49
- fi
50
- AM_CONDITIONAL(HAVE_SYSTEMD, [test -n "$with_systemdsystemunitdir" -a "x$with_systemdsystemunitdir" != xno ])
51
- AC_MSG_RESULT([done])
52
-
53
- AC_CONFIG_FILES([Makefile
54
- src/Makefile
55
- conf/Makefile
56
- recipe/Makefile
57
- src/discover-host.rb
58
- conf/foreman-plugin.firewall
59
- src/discovery-version-fact.rb
60
- ovirt-node-plugin-foreman.spec])
61
-
62
- AC_OUTPUT