summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorOleksandr Berezovskyi <berezovskyi.oleksandr@gmail.com>2016-04-04 14:10:58 +0300
committerOleksandr Berezovskyi <berezovskyi.oleksandr@gmail.com>2016-04-11 15:20:41 +0300
commit22ca21bb1dee94114051ce74e20d6e2f671d0175 (patch)
treeff8cd80159df9ab15eefde9d70adced9e14b52a3
parentb7b8a49a43df32c7c8cf4fb47aaa02a36866839e (diff)
Initial commit
Notes
Notes (review): Code-Review+2: Aleksandr Gordeev <agordeev@mirantis.com> Code-Review+2: Evgeniy L <eli@mirantis.com> Workflow+1: Evgeniy L <eli@mirantis.com> Verified+2: Jenkins Submitted-by: Jenkins Submitted-at: Tue, 12 Apr 2016 11:27:26 +0000 Reviewed-on: https://review.openstack.org/301052 Project: openstack/bareon-image-elements Branch: refs/heads/master
-rw-r--r--centos-bareon/README.rst4
-rwxr-xr-xcentos-bareon/cleanup.d/10-remove-repos12
-rwxr-xr-xcentos-bareon/cleanup.d/99-ramdisk-create38
-rw-r--r--centos-bareon/element-deps2
-rw-r--r--centos-bareon/element-provides1
-rwxr-xr-xcentos-bareon/install.d/60-bareon-install44
-rw-r--r--centos-bareon/install.d/files.ironic/etc/bareon/bareon.conf211
-rw-r--r--centos-bareon/install.d/files.ironic/etc/network3
-rw-r--r--centos-bareon/install.d/files.ironic/etc/ssh/sshd_config20
-rw-r--r--centos-bareon/install.d/files.ironic/root/.ssh/authorized_keys1
-rw-r--r--centos-bareon/install.d/files.ironic/usr/lib/systemd/system/ironic-callback.service13
-rw-r--r--centos-bareon/package-installs.yaml21
-rw-r--r--centos-bareon/pkg-map2
-rwxr-xr-xcentos-bareon/post-install.d/10-disable-selinux15
-rwxr-xr-xcentos-bareon/post-install.d/10-disable-udev-iface-rename24
-rwxr-xr-xcentos-bareon/post-install.d/80-bareon9
-rwxr-xr-xcentos-bareon/root.d/10-create-repo14
-rwxr-xr-xcentos-bareon/root.d/60-bareon-src16
-rw-r--r--debian-bareon/README.rst8
-rwxr-xr-xdebian-bareon/cleanup.d/99-ramdisk-create38
-rw-r--r--debian-bareon/element-deps1
-rw-r--r--debian-bareon/element-provides2
-rwxr-xr-xdebian-bareon/install.d/60-bareon-install42
-rw-r--r--debian-bareon/install.d/files.ironic/etc/bareon/bareon.conf211
-rw-r--r--debian-bareon/install.d/files.ironic/etc/hostname1
-rw-r--r--debian-bareon/install.d/files.ironic/etc/modprobe.d/blacklist-i2c-piix4.conf1
-rw-r--r--debian-bareon/install.d/files.ironic/etc/modprobe.d/mlnx4_core.conf1
-rw-r--r--debian-bareon/install.d/files.ironic/etc/ssh/sshd_config20
-rw-r--r--debian-bareon/install.d/files.ironic/lib/systemd/system/ironic-callback.service11
-rw-r--r--debian-bareon/install.d/files.ironic/root/.ssh/authorized_keys1
-rwxr-xr-xdebian-bareon/post-install.d/80-bareon11
-rw-r--r--debian-bareon/source-repository-bareon1
32 files changed, 799 insertions, 0 deletions
diff --git a/centos-bareon/README.rst b/centos-bareon/README.rst
new file mode 100644
index 0000000..d80d5c9
--- /dev/null
+++ b/centos-bareon/README.rst
@@ -0,0 +1,4 @@
1======
2bareon
3======
4Builds a ramdisk with bareon. Centos element as OS is mandatory.
diff --git a/centos-bareon/cleanup.d/10-remove-repos b/centos-bareon/cleanup.d/10-remove-repos
new file mode 100755
index 0000000..14e4cab
--- /dev/null
+++ b/centos-bareon/cleanup.d/10-remove-repos
@@ -0,0 +1,12 @@
1#!/bin/bash
2
3if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
4 set -x
5fi
6
7set -e
8
9[[ -n "$TARGET_ROOT" ]] || exit 1
10
11sudo rm -f $TARGET_ROOT/etc/yum.repos.d/var_*.repo
12sudo rm -rf $TARGET_ROOT/var/cache/yum/*
diff --git a/centos-bareon/cleanup.d/99-ramdisk-create b/centos-bareon/cleanup.d/99-ramdisk-create
new file mode 100755
index 0000000..a13f949
--- /dev/null
+++ b/centos-bareon/cleanup.d/99-ramdisk-create
@@ -0,0 +1,38 @@
1#!/bin/bash
2
3if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
4 set -x
5fi
6set -e
7set -o pipefail
8
9
10[ -n "$TARGET_ROOT" ]
11
12source $_LIB/img-functions
13
14IMAGE_PATH=$(readlink -f $IMAGE_NAME)
15cd $TARGET_ROOT
16
17echo "#disabled" > ./tmp/fstab.new
18sudo mv ./tmp/fstab.new ./etc/fstab
19sudo ln -s ./sbin/init ./
20
21
22if [ ! -n ${DIB_MAKE_SQUASHFS-""} ] ; then
23 sudo find . -path './sys/*' -prune -o -path './proc/*' -prune -o -path './dev/*' -prune -o -path './tmp/*' -prune -o -path './usr/share/icons/*' -prune -o -path './usr/share/locale/*' -prune -o -print | sudo cpio -o -H newc | gzip > ${IMAGE_PATH}.initramfs
24
25 select_boot_kernel_initrd $TARGET_ROOT
26 sudo cp $BOOTDIR/$KERNEL ${IMAGE_PATH}.vmlinuz
27else
28 wget http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/initrd.img -O ${IMAGE_PATH}.initramfs
29 wget http://mirror.centos.org/centos/7/os/x86_64/images/pxeboot/vmlinuz -O ${IMAGE_PATH}.vmlinuz
30
31 sudo rm -f ./boot/initrd*
32 sudo rm -f ./boot/vmlinuz*
33
34 mkdir -p $TMP_BUILD_DIR/workdir/LiveOS
35 cp $TMP_IMAGE_PATH $TMP_BUILD_DIR/workdir/LiveOS/ext3fs.img
36 sudo mksquashfs $TMP_BUILD_DIR/workdir/ ${IMAGE_PATH}.squashfs
37fi
38
diff --git a/centos-bareon/element-deps b/centos-bareon/element-deps
new file mode 100644
index 0000000..d7b7e04
--- /dev/null
+++ b/centos-bareon/element-deps
@@ -0,0 +1,2 @@
1package-installs
2
diff --git a/centos-bareon/element-provides b/centos-bareon/element-provides
new file mode 100644
index 0000000..d28ec9b
--- /dev/null
+++ b/centos-bareon/element-provides
@@ -0,0 +1 @@
bareon
diff --git a/centos-bareon/install.d/60-bareon-install b/centos-bareon/install.d/60-bareon-install
new file mode 100755
index 0000000..6df323c
--- /dev/null
+++ b/centos-bareon/install.d/60-bareon-install
@@ -0,0 +1,44 @@
1#!/bin/bash
2
3if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
4 set -x
5fi
6set -eu
7set -o pipefail
8
9RELEASE_FILE=/etc/bareon-release
10
11SCRIPTDIR=$(dirname $0)
12install-packages python-setuptools python-pip python-dev
13
14if [ -n ${BAREON_SRC-""} ] ; then
15 cd /tmp/bareon
16 pip install --upgrade setuptools
17 pip install -r requirements.txt && python setup.py install
18
19 pip freeze | grep bareon > $RELEASE_FILE
20 echo "Source-based bareon installation. Git log:" >> $RELEASE_FILE
21 cat changelog >> $RELEASE_FILE
22
23 cd /
24else
25 install-packages bareon
26
27 pip freeze | grep bareon > $RELEASE_FILE
28 echo "RPM-based bareon installation. RPM info:" >> $RELEASE_FILE
29 rpm -qi bareon >> $RELEASE_FILE
30fi
31
32if [ ! -f /usr/bin/ironic_callback ]; then
33 ln -s /usr/local/bin/ironic_callback /usr/bin/ironic_callback
34fi
35
36# TODO(lobur): generate this key and publish together with image
37install -D -g root -o root -m 0600 ${SCRIPTDIR}/files.ironic/root/.ssh/authorized_keys /root/.ssh/authorized_keys
38chmod 0700 /root/.ssh/
39install -D -g root -o root -m 0600 ${SCRIPTDIR}/files.ironic/etc/ssh/sshd_config /etc/ssh/sshd_config
40install -D -g root -o root -m 0664 ${SCRIPTDIR}/files.ironic/etc/network /etc/sysconfig/network
41install -D -g root -o root -m 0755 ${SCRIPTDIR}/files.ironic/usr/lib/systemd/system/ironic-callback.service /usr/lib/systemd/system/ironic-callback.service
42install -D -g root -o root -m 0755 ${SCRIPTDIR}/files.ironic/etc/bareon/bareon.conf /etc/bareon/bareon.conf
43
44systemctl enable ironic-callback.service
diff --git a/centos-bareon/install.d/files.ironic/etc/bareon/bareon.conf b/centos-bareon/install.d/files.ironic/etc/bareon/bareon.conf
new file mode 100644
index 0000000..154d9c5
--- /dev/null
+++ b/centos-bareon/install.d/files.ironic/etc/bareon/bareon.conf
@@ -0,0 +1,211 @@
1[DEFAULT]
2
3#
4# Options defined in bareon.manager
5#
6
7# Data driver (string value)
8#data_driver=nailgun
9
10# Directory where the image is supposed to be built (string
11# value)
12#image_build_dir=/tmp
13
14# Path to directory with cloud init templates (string value)
15#nc_template_path=/usr/share/bareon/cloud-init-templates
16
17# Temporary directory for file manipulations (string value)
18#tmp_path=/tmp
19
20# Path where to store generated config drive image (string
21# value)
22#config_drive_path=/tmp/config-drive.img
23
24# Path where to store actual rules for udev daemon (string
25# value)
26#udev_rules_dir=/etc/udev/rules.d
27
28# Path where to store default rules for udev daemon (string
29# value)
30#udev_rules_lib_dir=/lib/udev/rules.d
31
32# Substring to which file extension .rules be renamed (string
33# value)
34#udev_rename_substr=.renamedrule
35
36# Correct empty rule for udev daemon (string value)
37#udev_empty_rule=empty_rule
38
39# Suffix which is used while creating temporary files (string
40# value)
41#image_build_suffix=.bareon-image
42
43# Timeout in secs for GRUB (integer value)
44#grub_timeout=5
45
46# Maximum allowed loop devices count to use (integer value)
47#max_loop_devices_count=255
48
49# Size of sparse file in MiBs (integer value)
50#sparse_file_size=8192
51
52# System-wide major number for loop device (integer value)
53#loop_device_major_number=7
54
55# Maximum allowed debootstrap/apt-get attempts to execute
56# (integer value)
57#fetch_packages_attempts=10
58
59# File where to store apt setting for unsigned packages
60# (string value)
61#allow_unsigned_file=allow_unsigned_packages
62
63# File where to store apt setting for forcing IPv4 usage
64# (string value)
65#force_ipv4_file=force_ipv4
66
67# Create configdrive file, use pre-builded if set to False
68# (boolean value)
69prepare_configdrive=false
70
71# Add udev rules for NIC remapping (boolean value)
72fix_udev_net_rules=true
73
74
75#
76# Options defined in bareon.cmd.agent
77#
78
79# Input data file (string value)
80#input_data_file=/tmp/provision.json
81
82# Input data (json string) (string value)
83#input_data=
84
85
86#
87# Options defined in bareon.openstack.common.log
88#
89
90# Print debugging output (set logging level to DEBUG instead
91# of default WARNING level). (boolean value)
92debug=true
93
94# Print more verbose output (set logging level to INFO instead
95# of default WARNING level). (boolean value)
96#verbose=false
97
98# Log output to standard error. (boolean value)
99use_stderr=false
100
101# Format string to use for log messages with context. (string
102# value)
103#logging_context_format_string=%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s
104
105# Format string to use for log messages without context.
106# (string value)
107#logging_default_format_string=%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s
108
109# Data to append to log format when level is DEBUG. (string
110# value)
111logging_debug_format_suffix=
112
113# Prefix each line of exception output with this format.
114# (string value)
115#logging_exception_prefix=%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s
116
117# List of logger=LEVEL pairs. (list value)
118#default_log_levels=amqp=WARN,amqplib=WARN,boto=WARN,qpid=WARN,sqlalchemy=WARN,suds=INFO,oslo.messaging=INFO,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN
119
120# Enables or disables publication of error events. (boolean
121# value)
122#publish_errors=false
123
124# Enables or disables fatal status of deprecations. (boolean
125# value)
126#fatal_deprecations=false
127
128# The format for an instance that is passed with the log
129# message. (string value)
130#instance_format="[instance: %(uuid)s] "
131
132# The format for an instance UUID that is passed with the log
133# message. (string value)
134#instance_uuid_format="[instance: %(uuid)s] "
135
136# The name of a logging configuration file. This file is
137# appended to any existing logging configuration files. For
138# details about logging configuration files, see the Python
139# logging module documentation. (string value)
140# Deprecated group/name - [DEFAULT]/log_config
141#log_config_append=<None>
142
143# DEPRECATED. A logging.Formatter log message format string
144# which may use any of the available logging.LogRecord
145# attributes. This option is deprecated. Please use
146# logging_context_format_string and
147# logging_default_format_string instead. (string value)
148#log_format=<None>
149
150# Format string for %%(asctime)s in log records. Default:
151# %(default)s . (string value)
152#log_date_format=%Y-%m-%d %H:%M:%S
153
154# (Optional) Name of log file to output to. If no default is
155# set, logging will go to stdout. (string value)
156# Deprecated group/name - [DEFAULT]/logfile
157log_file=/var/log/bareon.log
158
159# (Optional) The base directory used for relative --log-file
160# paths. (string value)
161# Deprecated group/name - [DEFAULT]/logdir
162#log_dir=<None>
163
164# Use syslog for logging. Existing syslog format is DEPRECATED
165# during I, and will change in J to honor RFC5424. (boolean
166# value)
167#use_syslog=false
168
169# (Optional) Enables or disables syslog rfc5424 format for
170# logging. If enabled, prefixes the MSG part of the syslog
171# message with APP-NAME (RFC5424). The format without the APP-
172# NAME is deprecated in I, and will be removed in J. (boolean
173# value)
174#use_syslog_rfc_format=false
175
176# Syslog facility to receive log lines. (string value)
177#syslog_log_facility=LOG_USER
178
179
180#
181# Options defined in bareon.utils.artifact
182#
183
184# Size of data chunk to operate with images (integer value)
185#data_chunk_size=1048576
186
187
188#
189# Options defined in bareon.utils.utils
190#
191
192# Maximum retries count for http requests. 0 means infinite
193# (integer value)
194#http_max_retries=30
195
196# Http request timeout in seconds (floating point value)
197#http_request_timeout=10.0
198
199# Delay in seconds before the next http request retry
200# (floating point value)
201#http_retry_delay=2.0
202
203# Block size of data to read for calculating checksum (integer
204# value)
205#read_chunk_size=1048576
206
207# Delay in seconds before the next exectuion will retry
208# (floating point value)
209#execute_retry_delay=2.0
210
211
diff --git a/centos-bareon/install.d/files.ironic/etc/network b/centos-bareon/install.d/files.ironic/etc/network
new file mode 100644
index 0000000..86ac14e
--- /dev/null
+++ b/centos-bareon/install.d/files.ironic/etc/network
@@ -0,0 +1,3 @@
1NETWORKING=yes
2HOSTNAME=bootstrap
3VLAN=yes
diff --git a/centos-bareon/install.d/files.ironic/etc/ssh/sshd_config b/centos-bareon/install.d/files.ironic/etc/ssh/sshd_config
new file mode 100644
index 0000000..3f34e9d
--- /dev/null
+++ b/centos-bareon/install.d/files.ironic/etc/ssh/sshd_config
@@ -0,0 +1,20 @@
1Protocol 2
2SyslogFacility AUTHPRIV
3PasswordAuthentication no
4PubkeyAuthentication yes
5ChallengeResponseAuthentication no
6GSSAPIAuthentication no
7UsePAM yes
8UseDNS no
9
10# Accept locale-related environment variables
11AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
12AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
13AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
14AcceptEnv XMODIFIERS
15
16Subsystem sftp /usr/libexec/openssh/sftp-server
17
18# Secure Ciphers and MACs
19Ciphers aes256-ctr,aes192-ctr,aes128-ctr,arcfour256,arcfour128
20MACs hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,hmac-sha1
diff --git a/centos-bareon/install.d/files.ironic/root/.ssh/authorized_keys b/centos-bareon/install.d/files.ironic/root/.ssh/authorized_keys
new file mode 100644
index 0000000..4a91b0c
--- /dev/null
+++ b/centos-bareon/install.d/files.ironic/root/.ssh/authorized_keys
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDtrVTSM8tGd4E8khJn2gfN/2fymnX/0YKAGSVZTWDNIcYL5zXTlSwrccn/8EgmnNsJNxucJRT+oWqrDGaFaehuwlY/IBqm50KJVaUr5QYzOUpqVpFIpoX3UwETCxcSB1LiQYbCvrJcqOPQ4Zu9fMhMGKaAX1ohzOumn4czuLDYIvCnPnoU5RDWt7g1GaFFlzGU3JFooj7/aWFJMqJLinvay3vr2vFpBvO1y29nKu+zgpZkzzJCc0ndoVqvB+W9DY6QtgTSWfd3ZE/8vg4h8QV8H+xxqL/uWCxDkv2Y3rviAHivR/V+1YCSQH0NBJrNSkRjd+1roLhcEGT7/YEnbgVV nailgun@bootstrap
diff --git a/centos-bareon/install.d/files.ironic/usr/lib/systemd/system/ironic-callback.service b/centos-bareon/install.d/files.ironic/usr/lib/systemd/system/ironic-callback.service
new file mode 100644
index 0000000..dbe1000
--- /dev/null
+++ b/centos-bareon/install.d/files.ironic/usr/lib/systemd/system/ironic-callback.service
@@ -0,0 +1,13 @@
1[Unit]
2Description=Ironic Callback
3Requires=sshd.service
4Wants=network-online.target
5After=network-online.target sshd.service
6
7[Service]
8Type=oneshot
9User=root
10ExecStart=/usr/bin/bareon-ironic-callback
11
12[Install]
13WantedBy=multi-user.target
diff --git a/centos-bareon/package-installs.yaml b/centos-bareon/package-installs.yaml
new file mode 100644
index 0000000..465c69a
--- /dev/null
+++ b/centos-bareon/package-installs.yaml
@@ -0,0 +1,21 @@
1curl:
2dhclient:
3policycoreutils:
4selinux-policy:
5selinux-policy-targeted:
6setroubleshoot:
7openssh-server:
8openssh-client:
9qemu-utils:
10parted:
11hdparm:
12util-linux:
13gcc:
14lvm2:
15e2fsprogs:
16xfsprogs:
17btrfs-progs:
18dosfstools:
19rsync:
20grub2:
21
diff --git a/centos-bareon/pkg-map b/centos-bareon/pkg-map
new file mode 100644
index 0000000..2c63c08
--- /dev/null
+++ b/centos-bareon/pkg-map
@@ -0,0 +1,2 @@
1{
2}
diff --git a/centos-bareon/post-install.d/10-disable-selinux b/centos-bareon/post-install.d/10-disable-selinux
new file mode 100755
index 0000000..7aecb11
--- /dev/null
+++ b/centos-bareon/post-install.d/10-disable-selinux
@@ -0,0 +1,15 @@
1#!/bin/bash
2
3if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
4 set -x
5fi
6
7set -e
8
9sed -i.bak \
10 -e 's/^SELINUX=.*/SELINUX=disabled/' \
11 /etc/sysconfig/selinux
12
13sed -i.bak \
14 -e 's/^SELINUX=.*/SELINUX=disabled/' \
15 /etc/selinux/config
diff --git a/centos-bareon/post-install.d/10-disable-udev-iface-rename b/centos-bareon/post-install.d/10-disable-udev-iface-rename
new file mode 100755
index 0000000..8b733f9
--- /dev/null
+++ b/centos-bareon/post-install.d/10-disable-udev-iface-rename
@@ -0,0 +1,24 @@
1#!/bin/bash
2
3if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
4 set -x
5fi
6
7set -e
8
9# Disabling this rule prevents inconsistent iface renames done by udev. This
10# were conflicting with prebuilt dhcp scripts (ifcfg-eth0, ifcfg-eth1) as well
11# as with dhcp-all-interfaces which was not able to generate scripts according
12# to new names (because it runs concurrently with renaming).
13# Using old schema (ethN) + pre-built dhcp scripts allows to have stable DHCP
14# even if eth interfaces are randomly swapped.
15ln -s /dev/null /etc/udev/rules.d/80-net-name-slot.rules
16
17# Configs for additional interfaces
18SYSCONFIG_PATH=/etc/sysconfig/network-scripts
19for IFACE_NUM in 1 2 3
20do
21 cp $SYSCONFIG_PATH/ifcfg-eth0 $SYSCONFIG_PATH/ifcfg-eth$IFACE_NUM
22 sed -i "s/eth0/eth$IFACE_NUM/g" $SYSCONFIG_PATH/ifcfg-eth$IFACE_NUM
23done
24
diff --git a/centos-bareon/post-install.d/80-bareon b/centos-bareon/post-install.d/80-bareon
new file mode 100755
index 0000000..af16172
--- /dev/null
+++ b/centos-bareon/post-install.d/80-bareon
@@ -0,0 +1,9 @@
1#!/bin/bash
2
3if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
4 set -x
5fi
6set -eu
7set -o pipefail
8
9rm -rf /tmp/bareon
diff --git a/centos-bareon/root.d/10-create-repo b/centos-bareon/root.d/10-create-repo
new file mode 100755
index 0000000..bd97b81
--- /dev/null
+++ b/centos-bareon/root.d/10-create-repo
@@ -0,0 +1,14 @@
1#!/bin/bash
2
3if [ ${DIB_DEBUG_TRACE:-1} -gt 0 ]; then
4 set -x
5fi
6
7set -e
8
9[[ -n "$TARGET_ROOT" ]] || exit 1
10
11sudo mkdir -p $TARGET_ROOT/etc/yum.repos.d
12sudo cp /etc/yum.repos.d/*.repo $TARGET_ROOT/etc/yum.repos.d/
13sudo cp /etc/pki/rpm-gpg/* $TARGET_ROOT/etc/pki/rpm-gpg/
14
diff --git a/centos-bareon/root.d/60-bareon-src b/centos-bareon/root.d/60-bareon-src
new file mode 100755
index 0000000..77f6232
--- /dev/null
+++ b/centos-bareon/root.d/60-bareon-src
@@ -0,0 +1,16 @@
1#!/bin/bash
2
3if [ ${DIB_DEBUG_TRACE:-0} -gt 0 ]; then
4 set -x
5fi
6set -eu
7set -o pipefail
8
9if [ -n ${BAREON_SRC-""} ] ; then
10 git clone -b $BAREON_BRANCH $BAREON_SRC $TARGET_ROOT/tmp/bareon
11
12 cd $TARGET_ROOT/tmp/bareon
13 git log -25 --oneline > changelog
14 cd -
15fi
16
diff --git a/debian-bareon/README.rst b/debian-bareon/README.rst
new file mode 100644
index 0000000..4be85c8
--- /dev/null
+++ b/debian-bareon/README.rst
@@ -0,0 +1,8 @@
1======
2bareon
3======
4Builds a debian ramdisk with bareon.
5
6Note: This element has not been maintained along with centos-bareon, so
7might not work out of the box.
8
diff --git a/debian-bareon/cleanup.d/99-ramdisk-create b/debian-bareon/cleanup.d/99-ramdisk-create
new file mode 100755
index 0000000..402f9f3
--- /dev/null
+++ b/debian-bareon/cleanup.d/99-ramdisk-create
@@ -0,0 +1,38 @@
1#!/bin/bash
2
3if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
4 set -x
5fi
6set -eu
7set -o pipefail
8
9
10[ -n "$TARGET_ROOT" ]
11
12source $_LIB/img-functions
13
14IMAGE_PATH=$(readlink -f $IMAGE_NAME)
15cd $TARGET_ROOT
16
17echo "#disabled" > ./tmp/fstab.new
18sudo mv ./tmp/fstab.new ./etc/fstab
19sudo ln -s ./sbin/init ./
20
21if [ ! -n ${DIB_MAKE_SQUASHFS-""} ] ; then
22 sudo find . -path './sys/*' -prune -o -path './proc/*' -prune -o -path './dev/*' -prune -o -path './tmp/*' -prune -o -print | sudo cpio -o -H newc | gzip > ${IMAGE_PATH}.initramfs
23
24 select_boot_kernel_initrd $TARGET_ROOT
25 sudo cp $BOOTDIR/$KERNEL ${IMAGE_PATH}.vmlinuz
26else
27 select_boot_kernel_initrd $TARGET_ROOT
28 sudo cp -a ./boot/initrd* ${IMAGE_PATH}.initramfs
29 sudo cp -a ./boot/vmlinuz* ${IMAGE_PATH}.vmlinuz
30 sudo rm -f ./boot/initrd*
31 sudo rm -f ./boot/vmlinuz*
32
33 if sudo mountpoint -q ./proc ; then
34 sudo umount ./proc
35 fi
36
37 sudo mksquashfs . ${IMAGE_PATH}.squashfs -noappend -e proc/* dev/* sys/* tmp/*
38fi
diff --git a/debian-bareon/element-deps b/debian-bareon/element-deps
new file mode 100644
index 0000000..715c11e
--- /dev/null
+++ b/debian-bareon/element-deps
@@ -0,0 +1 @@
source-repositories
diff --git a/debian-bareon/element-provides b/debian-bareon/element-provides
new file mode 100644
index 0000000..8ba5c33
--- /dev/null
+++ b/debian-bareon/element-provides
@@ -0,0 +1,2 @@
1bareon
2
diff --git a/debian-bareon/install.d/60-bareon-install b/debian-bareon/install.d/60-bareon-install
new file mode 100755
index 0000000..6bcee5a
--- /dev/null
+++ b/debian-bareon/install.d/60-bareon-install
@@ -0,0 +1,42 @@
1#!/bin/bash
2
3if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
4 set -x
5fi
6set -eu
7set -o pipefail
8
9SCRIPTDIR=$(dirname $0)
10
11install-packages openssh-server isc-dhcp-client rsync lvm2 parted ifupdown iproute2 gcc python-dev python-pip python-wheel
12
13if [ -n ${DIB_MAKE_SQUASHFS-""} ] ; then
14 install-packages live-boot live-boot-initramfs-tools
15fi
16
17# TODO(max_lobur): sync this with a way how we do for CentOS
18cd /tmp/bareon
19python2 setup.py bdist_wheel
20whl_name=$(ls -1rv dist/bareon*.whl 2>/dev/null | head -1)
21pip install $whl_name
22cd /
23
24if [ ! -f /usr/bin/ironic_callback ]; then
25 ln -s /usr/local/bin/ironic_callback /usr/bin/ironic_callback
26fi
27
28echo $'md-mod' >> /etc/modules
29
30install -D -g root -o root -m 0600 ${SCRIPTDIR}/files.ironic/root/.ssh/authorized_keys /root/.ssh/authorized_keys
31chmod 0700 /root/.ssh/
32install -D -g root -o root -m 0600 ${SCRIPTDIR}/files.ironic/etc/ssh/sshd_config /etc/ssh/sshd_config
33install -D -g root -o root -m 0644 ${SCRIPTDIR}/files.ironic/etc/hostname /etc/hostname
34install -D -g root -o root -m 0644 ${SCRIPTDIR}/files.ironic/etc/modprobe.d/blacklist-i2c-piix4.conf /etc/modprobe.d/blacklist-i2c-piix4.conf
35install -D -g root -o root -m 0644 ${SCRIPTDIR}/files.ironic/etc/modprobe.d/mlnx4_core.conf /etc/modprobe.d/mlnx4_core.conf
36install -D -g root -o root -m 0755 ${SCRIPTDIR}/files.ironic/etc/bareon/bareon.conf /etc/bareon/bareon.conf
37install -D -g root -o root -m 0644 ${SCRIPTDIR}/files.ironic/lib/systemd/system/ironic-callback.service /lib/systemd/system/ironic-callback.service
38
39# TODO(lobur): sync service definition with CentOS
40systemctl enable ironic-callback.service
41
42update-initramfs -u -k all
diff --git a/debian-bareon/install.d/files.ironic/etc/bareon/bareon.conf b/debian-bareon/install.d/files.ironic/etc/bareon/bareon.conf
new file mode 100644
index 0000000..154d9c5
--- /dev/null
+++ b/debian-bareon/install.d/files.ironic/etc/bareon/bareon.conf
@@ -0,0 +1,211 @@
1[DEFAULT]
2
3#
4# Options defined in bareon.manager
5#
6
7# Data driver (string value)
8#data_driver=nailgun
9
10# Directory where the image is supposed to be built (string
11# value)
12#image_build_dir=/tmp
13
14# Path to directory with cloud init templates (string value)
15#nc_template_path=/usr/share/bareon/cloud-init-templates
16
17# Temporary directory for file manipulations (string value)
18#tmp_path=/tmp
19
20# Path where to store generated config drive image (string
21# value)
22#config_drive_path=/tmp/config-drive.img
23
24# Path where to store actual rules for udev daemon (string
25# value)
26#udev_rules_dir=/etc/udev/rules.d
27
28# Path where to store default rules for udev daemon (string
29# value)
30#udev_rules_lib_dir=/lib/udev/rules.d
31
32# Substring to which file extension .rules be renamed (string
33# value)
34#udev_rename_substr=.renamedrule
35
36# Correct empty rule for udev daemon (string value)
37#udev_empty_rule=empty_rule
38
39# Suffix which is used while creating temporary files (string
40# value)
41#image_build_suffix=.bareon-image
42
43# Timeout in secs for GRUB (integer value)
44#grub_timeout=5
45
46# Maximum allowed loop devices count to use (integer value)
47#max_loop_devices_count=255
48
49# Size of sparse file in MiBs (integer value)
50#sparse_file_size=8192
51
52# System-wide major number for loop device (integer value)
53#loop_device_major_number=7
54
55# Maximum allowed debootstrap/apt-get attempts to execute
56# (integer value)
57#fetch_packages_attempts=10
58
59# File where to store apt setting for unsigned packages
60# (string value)
61#allow_unsigned_file=allow_unsigned_packages
62
63# File where to store apt setting for forcing IPv4 usage
64# (string value)
65#force_ipv4_file=force_ipv4
66
67# Create configdrive file, use pre-builded if set to False
68# (boolean value)
69prepare_configdrive=false
70
71# Add udev rules for NIC remapping (boolean value)
72fix_udev_net_rules=true
73
74
75#
76# Options defined in bareon.cmd.agent
77#
78
79# Input data file (string value)
80#input_data_file=/tmp/provision.json
81
82# Input data (json string) (string value)
83#input_data=
84
85
86#
87# Options defined in bareon.openstack.common.log
88#
89
90# Print debugging output (set logging level to DEBUG instead
91# of default WARNING level). (boolean value)
92debug=true
93
94# Print more verbose output (set logging level to INFO instead
95# of default WARNING level). (boolean value)
96#verbose=false
97
98# Log output to standard error. (boolean value)
99use_stderr=false
100
101# Format string to use for log messages with context. (string
102# value)
103#logging_context_format_string=%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [%(request_id)s %(user_identity)s] %(instance)s%(message)s
104
105# Format string to use for log messages without context.
106# (string value)
107#logging_default_format_string=%(asctime)s.%(msecs)03d %(process)d %(levelname)s %(name)s [-] %(instance)s%(message)s
108
109# Data to append to log format when level is DEBUG. (string
110# value)
111logging_debug_format_suffix=
112
113# Prefix each line of exception output with this format.
114# (string value)
115#logging_exception_prefix=%(asctime)s.%(msecs)03d %(process)d TRACE %(name)s %(instance)s
116
117# List of logger=LEVEL pairs. (list value)
118#default_log_levels=amqp=WARN,amqplib=WARN,boto=WARN,qpid=WARN,sqlalchemy=WARN,suds=INFO,oslo.messaging=INFO,iso8601=WARN,requests.packages.urllib3.connectionpool=WARN
119
120# Enables or disables publication of error events. (boolean
121# value)
122#publish_errors=false
123
124# Enables or disables fatal status of deprecations. (boolean
125# value)
126#fatal_deprecations=false
127
128# The format for an instance that is passed with the log
129# message. (string value)
130#instance_format="[instance: %(uuid)s] "
131
132# The format for an instance UUID that is passed with the log
133# message. (string value)
134#instance_uuid_format="[instance: %(uuid)s] "
135
136# The name of a logging configuration file. This file is
137# appended to any existing logging configuration files. For
138# details about logging configuration files, see the Python
139# logging module documentation. (string value)
140# Deprecated group/name - [DEFAULT]/log_config
141#log_config_append=<None>
142
143# DEPRECATED. A logging.Formatter log message format string
144# which may use any of the available logging.LogRecord
145# attributes. This option is deprecated. Please use
146# logging_context_format_string and
147# logging_default_format_string instead. (string value)
148#log_format=<None>
149
150# Format string for %%(asctime)s in log records. Default:
151# %(default)s . (string value)
152#log_date_format=%Y-%m-%d %H:%M:%S
153
154# (Optional) Name of log file to output to. If no default is
155# set, logging will go to stdout. (string value)
156# Deprecated group/name - [DEFAULT]/logfile
157log_file=/var/log/bareon.log
158
159# (Optional) The base directory used for relative --log-file
160# paths. (string value)
161# Deprecated group/name - [DEFAULT]/logdir
162#log_dir=<None>
163
164# Use syslog for logging. Existing syslog format is DEPRECATED
165# during I, and will change in J to honor RFC5424. (boolean
166# value)
167#use_syslog=false
168
169# (Optional) Enables or disables syslog rfc5424 format for
170# logging. If enabled, prefixes the MSG part of the syslog
171# message with APP-NAME (RFC5424). The format without the APP-
172# NAME is deprecated in I, and will be removed in J. (boolean
173# value)
174#use_syslog_rfc_format=false
175
176# Syslog facility to receive log lines. (string value)
177#syslog_log_facility=LOG_USER
178
179
180#
181# Options defined in bareon.utils.artifact
182#
183
184# Size of data chunk to operate with images (integer value)
185#data_chunk_size=1048576
186
187
188#
189# Options defined in bareon.utils.utils
190#
191
192# Maximum retries count for http requests. 0 means infinite
193# (integer value)
194#http_max_retries=30
195
196# Http request timeout in seconds (floating point value)
197#http_request_timeout=10.0
198
199# Delay in seconds before the next http request retry
200# (floating point value)
201#http_retry_delay=2.0
202
203# Block size of data to read for calculating checksum (integer
204# value)
205#read_chunk_size=1048576
206
207# Delay in seconds before the next exectuion will retry
208# (floating point value)
209#execute_retry_delay=2.0
210
211
diff --git a/debian-bareon/install.d/files.ironic/etc/hostname b/debian-bareon/install.d/files.ironic/etc/hostname
new file mode 100644
index 0000000..b7c200a
--- /dev/null
+++ b/debian-bareon/install.d/files.ironic/etc/hostname
@@ -0,0 +1 @@
bootstrap
diff --git a/debian-bareon/install.d/files.ironic/etc/modprobe.d/blacklist-i2c-piix4.conf b/debian-bareon/install.d/files.ironic/etc/modprobe.d/blacklist-i2c-piix4.conf
new file mode 100644
index 0000000..a4339cc
--- /dev/null
+++ b/debian-bareon/install.d/files.ironic/etc/modprobe.d/blacklist-i2c-piix4.conf
@@ -0,0 +1 @@
blacklist i2c_piix4
diff --git a/debian-bareon/install.d/files.ironic/etc/modprobe.d/mlnx4_core.conf b/debian-bareon/install.d/files.ironic/etc/modprobe.d/mlnx4_core.conf
new file mode 100644
index 0000000..1b6f5af
--- /dev/null
+++ b/debian-bareon/install.d/files.ironic/etc/modprobe.d/mlnx4_core.conf
@@ -0,0 +1 @@
options mlx4_core port_type_array=2,2
diff --git a/debian-bareon/install.d/files.ironic/etc/ssh/sshd_config b/debian-bareon/install.d/files.ironic/etc/ssh/sshd_config
new file mode 100644
index 0000000..4b984fc
--- /dev/null
+++ b/debian-bareon/install.d/files.ironic/etc/ssh/sshd_config
@@ -0,0 +1,20 @@
1Protocol 2
2SyslogFacility AUTHPRIV
3PasswordAuthentication no
4PubkeyAuthentication yes
5ChallengeResponseAuthentication no
6GSSAPIAuthentication no
7UsePAM no
8UseDNS no
9
10# Accept locale-related environment variables
11AcceptEnv LANG LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
12AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
13AcceptEnv LC_IDENTIFICATION LC_ALL LANGUAGE
14AcceptEnv XMODIFIERS
15
16Subsystem sftp /usr/lib/openssh/sftp-server
17
18# Secure Ciphers and MACs
19Ciphers aes256-ctr,aes192-ctr,aes128-ctr,arcfour256,arcfour128
20MACs hmac-sha2-512,hmac-sha2-256,hmac-ripemd160,hmac-sha1
diff --git a/debian-bareon/install.d/files.ironic/lib/systemd/system/ironic-callback.service b/debian-bareon/install.d/files.ironic/lib/systemd/system/ironic-callback.service
new file mode 100644
index 0000000..9653502
--- /dev/null
+++ b/debian-bareon/install.d/files.ironic/lib/systemd/system/ironic-callback.service
@@ -0,0 +1,11 @@
1[Unit]
2Description=Ironic Callback
3Requires=ssh.service
4
5[Service]
6Type=oneshot
7User=root
8ExecStart=/usr/bin/bareon-ironic-callback
9
10[Install]
11WantedBy=multi-user.target
diff --git a/debian-bareon/install.d/files.ironic/root/.ssh/authorized_keys b/debian-bareon/install.d/files.ironic/root/.ssh/authorized_keys
new file mode 100644
index 0000000..4a91b0c
--- /dev/null
+++ b/debian-bareon/install.d/files.ironic/root/.ssh/authorized_keys
@@ -0,0 +1 @@
ssh-rsa AAAAB3NzaC1yc2EAAAADAQABAAABAQDtrVTSM8tGd4E8khJn2gfN/2fymnX/0YKAGSVZTWDNIcYL5zXTlSwrccn/8EgmnNsJNxucJRT+oWqrDGaFaehuwlY/IBqm50KJVaUr5QYzOUpqVpFIpoX3UwETCxcSB1LiQYbCvrJcqOPQ4Zu9fMhMGKaAX1ohzOumn4czuLDYIvCnPnoU5RDWt7g1GaFFlzGU3JFooj7/aWFJMqJLinvay3vr2vFpBvO1y29nKu+zgpZkzzJCc0ndoVqvB+W9DY6QtgTSWfd3ZE/8vg4h8QV8H+xxqL/uWCxDkv2Y3rviAHivR/V+1YCSQH0NBJrNSkRjd+1roLhcEGT7/YEnbgVV nailgun@bootstrap
diff --git a/debian-bareon/post-install.d/80-bareon b/debian-bareon/post-install.d/80-bareon
new file mode 100755
index 0000000..8759a24
--- /dev/null
+++ b/debian-bareon/post-install.d/80-bareon
@@ -0,0 +1,11 @@
1#!/bin/bash
2
3if [ "${DIB_DEBUG_TRACE:-0}" -gt 0 ]; then
4 set -x
5fi
6set -eu
7set -o pipefail
8
9install-packages -e git
10rm -rf /tmp/bareon
11apt-get -y autoremove
diff --git a/debian-bareon/source-repository-bareon b/debian-bareon/source-repository-bareon
new file mode 100644
index 0000000..fbdd56e
--- /dev/null
+++ b/debian-bareon/source-repository-bareon
@@ -0,0 +1 @@
agent git /tmp/bareon git@github.com:openstack/bareon.git