Browse Source

Add recipes Centos 6.9 et 7 minimal

jenkins
parent
commit
f326ddceba

+ 52
- 0
recipes/centos/6.9-minimal/centos-6.9-mini32.json View File

@@ -0,0 +1,52 @@
1
+{
2
+  "variables": {
3
+    "HTTP_PROXY": "{{ env `HTTP_PROXY` }}",
4
+    "HTTPS_PROXY": "{{ env `HTTPS_PROXY` }}",
5
+    "http_proxy": "{{ env `http_proxy` }}",
6
+    "https_proxy": "{{ env `https_proxy` }}",
7
+    "vm_name": "centos-6-mini32"
8
+  },
9
+  "builders": [
10
+    {
11
+      "name": "{{ user `vm_name` }}",
12
+      "type": "qemu",
13
+      "iso_url": "http://mirror.guru/centos/6.9/isos/i386/CentOS-6.9-i386-minimal.iso",
14
+      "iso_checksum_url": "http://mirror.guru/centos/6.9/isos/i386/md5sum.txt",
15
+      "iso_checksum_type": "md5",
16
+      "format": "qcow2",
17
+      "disk_size": "10000",
18
+      "ssh_username": "root",
19
+      "ssh_password": "cadoles",
20
+	  "headless": "true",
21
+      "accelerator": "kvm",
22
+      "http_directory": "{{ template_dir }}",
23
+      "ssh_wait_timeout": "20m",
24
+      "boot_wait": "5s",
25
+       "boot_command": [
26
+        "<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/kickstart.cfg<enter><wait>"
27
+      ],
28
+      "output_directory": "{{ template_dir }}/../../../images/centos/centos-6-mini32",
29
+      "vm_name": "{{ build_name }}-{{ isotime \"20060102\" }}.img",
30
+      "qemuargs": [
31
+        [ "-m", "1024" ]
32
+      ]
33
+    }
34
+  ],
35
+ "provisioners": [
36
+    {
37
+      "type": "shell",
38
+      "scripts": [
39
+        "{{template_dir}}/provision.sh"
40
+      ],
41
+      "environment_vars": [
42
+        "VM_NAME={{user `vm_name`}}",
43
+        "HTTP_PROXY={{user `HTTP_PROXY`}}",
44
+        "HTTPS_PROXY={{user `HTTPS_PROXY`}}",
45
+        "http_proxy={{user `http_proxy`}}",
46
+        "https_proxy={{user `https_proxy`}}"
47
+      ]
48
+    }
49
+  ]
50
+
51
+
52
+}

+ 51
- 0
recipes/centos/6.9-minimal/centos-6.9-mini64.json View File

@@ -0,0 +1,51 @@
1
+{
2
+  "variables": {
3
+    "HTTP_PROXY": "{{ env `HTTP_PROXY` }}",
4
+    "HTTPS_PROXY": "{{ env `HTTPS_PROXY` }}",
5
+    "http_proxy": "{{ env `http_proxy` }}",
6
+    "https_proxy": "{{ env `https_proxy` }}",
7
+    "vm_name": "centos-6-mini64"
8
+  },
9
+  "builders": [
10
+    {
11
+      "name": "{{ user `vm_name` }}",
12
+      "type": "qemu",
13
+      "iso_url": "http://mirror.in2p3.fr/linux/CentOS/6.9/isos/x86_64/CentOS-6.9-x86_64-minimal.iso",
14
+      "iso_checksum_url": "http://mirror.in2p3.fr/linux/CentOS/6.9/isos/x86_64/md5sum.txt",
15
+      "iso_checksum_type": "md5",
16
+      "format": "qcow2",
17
+      "disk_size": "10000",
18
+      "ssh_username": "root",
19
+      "ssh_password": "cadoles",
20
+	  "headless": "true",
21
+      "accelerator": "kvm",
22
+      "http_directory": "{{ template_dir }}",
23
+      "ssh_wait_timeout": "20m",
24
+      "boot_wait": "5s",
25
+       "boot_command": [
26
+        "<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/kickstart.cfg<enter><wait>"
27
+      ],
28
+      "output_directory": "{{ template_dir }}/../../../images/centos/centos-6-mini64",
29
+      "vm_name": "{{ build_name }}-{{ isotime \"20060102\" }}.img",
30
+      "qemuargs": [
31
+        [ "-m", "1024" ]
32
+      ]
33
+    }
34
+  ],
35
+ "provisioners": [
36
+    {
37
+      "type": "shell",
38
+      "scripts": [
39
+        "{{template_dir}}/provision.sh"
40
+      ],
41
+      "environment_vars": [
42
+        "VM_NAME={{user `vm_name`}}",
43
+        "HTTP_PROXY={{user `HTTP_PROXY`}}",
44
+        "HTTPS_PROXY={{user `HTTPS_PROXY`}}",
45
+        "http_proxy={{user `http_proxy`}}",
46
+        "https_proxy={{user `https_proxy`}}"
47
+      ]
48
+    }
49
+  ]
50
+  
51
+}

+ 59
- 0
recipes/centos/6.9-minimal/kickstart.cfg View File

@@ -0,0 +1,59 @@
1
+#version=DEVEL
2
+# Install OS instead of upgrade
3
+install
4
+# Use CDROM installation media
5
+cdrom
6
+# Use text mode install
7
+text
8
+# Firewall configuration
9
+firewall --disabled
10
+# Keyboard layouts
11
+# old format: keyboard fr
12
+# new format:
13
+keyboard fr
14
+# System language
15
+lang fr_FR.UTF-8
16
+
17
+# Network information
18
+network  --bootproto=dhcp --device=eth0 --activate
19
+network  --hostname=localhost.localdomain
20
+# Reboot after installation
21
+reboot
22
+# Root password
23
+rootpw --iscrypted $1$Rjj7lFXI$JQGgrgbrULPvaRj9WlKFn1
24
+
25
+#Create user cadoles with password cadoles
26
+user --name=cadoles --iscrypted $1$Rjj7lFXI$JQGgrgbrULPvaRj9WlKFn1 --shell=/bin/bash
27
+authconfig --enableshadow --enablemd5
28
+# SELinux configuration
29
+selinux --disabled
30
+# System services
31
+services --enabled="network,ntpd,ntpdate,chronyd"
32
+# Do not configure the X Window System
33
+skipx
34
+# System timezone
35
+timezone Etc/UTC
36
+bootloader --location=mbr
37
+# Clear the Master Boot Record
38
+zerombr
39
+# Partition clearing information
40
+clearpart --all --initlabel
41
+# Disk partitioning information
42
+part pv.60 --fstype="lvmpv" --size=9799
43
+part /boot --fstype="ext4" --size=200 --fsoptions="noatime"
44
+volgroup vg0 --pesize=4096 pv.60
45
+logvol /  --fstype="ext4" --grow --size=1 --fsoptions="noatime" --name=root --vgname=vg0
46
+logvol swap  --fstype="swap" --size=1024 --name=swap --vgname=vg0
47
+
48
+%post
49
+/bin/sed -i 's/^.PermitRootLogin.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
50
+%end
51
+
52
+%packages --nobase
53
+openssh-server
54
+sed
55
+
56
+%end
57
+
58
+
59
+

+ 43
- 0
recipes/centos/6.9-minimal/provision.sh View File

@@ -0,0 +1,43 @@
1
+ #!/bin/bash -e
2
+
3
+set -xeo pipefail
4
+
5
+# Download OpenNebula context package
6
+ONE_CONTEXT_VERSION=5.4.0
7
+ONE_CONTEXT_BUILD_SUFFIX=-1
8
+ONE_FAMILY=el6
9
+ONE_CONTEXT_SHASUM=ac7714f4ed6ac0e6b92338a7ab0fed09841e4590
10
+ONE_CONTEXT_URL="https://github.com/OpenNebula/addon-context-linux/releases/download/v${ONE_CONTEXT_VERSION}/one-context-${ONE_CONTEXT_VERSION}${ONE_CONTEXT_BUILD_SUFFIX}.${ONE_FAMILY}.noarch.rpm"
11
+ONE_CONTEXT_PACKAGE_DEST=/tmp/one-context.noarch.rpm
12
+
13
+yum install epel-release -y
14
+yum install perl-Digest-SHA -y
15
+yum install wget -y
16
+yum install cloud-utils-growpart -y
17
+yum install bind-utils -y
18
+yum install dracut-modules-growroot -y
19
+yum install ruby -y
20
+yum install rubygem-json -y
21
+
22
+wget -O- "${ONE_CONTEXT_URL}" > "${ONE_CONTEXT_PACKAGE_DEST}"
23
+#echo "${ONE_CONTEXT_SHASUM}  ${ONE_CONTEXT_PACKAGE_DEST}" | shasum -c
24
+
25
+# Purge cloud-init
26
+#yum remove cloud-init
27
+
28
+# Install onecontext
29
+rpm -i "${ONE_CONTEXT_PACKAGE_DEST}" 
30
+
31
+# Update hostname
32
+sed -i "s/^HOSTNAME=*/HOSTNAME=${VM_NAME}.localdomain/" /etc/sysconfig/network
33
+
34
+# Disable root login with password
35
+sed -i 's/^PermitRootLogin.*$/PermitRootLogin without-password/' /etc/ssh/sshd_config
36
+
37
+# Cleanup
38
+rm -f "${ONE_CONTEXT_PACKAGE_DEST}"
39
+yum clean all -y
40
+
41
+#chkconfig sshd on --level 2,3,4,5;
42
+# Force sync
43
+sync

+ 50
- 0
recipes/centos/7-minimal/centos-7-mini64.json View File

@@ -0,0 +1,50 @@
1
+{
2
+  "variables": {
3
+    "HTTP_PROXY": "{{ env `HTTP_PROXY` }}",
4
+    "HTTPS_PROXY": "{{ env `HTTPS_PROXY` }}",
5
+    "http_proxy": "{{ env `http_proxy` }}",
6
+    "https_proxy": "{{ env `https_proxy` }}",
7
+    "vm_name": "centos-7-mini64"
8
+  },
9
+  "builders": [
10
+    {
11
+      "name": "{{ user `vm_name` }}",
12
+      "type": "qemu",
13
+      "iso_url": "http://centos.quelquesmots.fr/7/isos/x86_64/CentOS-7-x86_64-Minimal-1708.iso",
14
+      "iso_checksum_url": "http://centos.quelquesmots.fr/7/isos/x86_64/sha1sum.txt",
15
+      "iso_checksum_type": "sha1",
16
+      "format": "qcow2",
17
+      "disk_size": "10000",
18
+      "ssh_username": "root",
19
+      "ssh_password": "cadoles",
20
+	  "headless": "true",
21
+      "accelerator": "kvm",
22
+      "http_directory": "{{ template_dir }}",
23
+      "ssh_wait_timeout": "20m",
24
+      "boot_wait": "5s",
25
+       "boot_command": [
26
+        "<tab> text ks=http://{{ .HTTPIP }}:{{ .HTTPPort }}/kickstart.cfg<enter><wait>"
27
+      ],
28
+      "output_directory": "{{ template_dir }}/../../../images/centos/centos-7-mini64",
29
+      "vm_name": "{{ build_name }}-{{ isotime \"20060102\" }}.img",
30
+      "qemuargs": [
31
+        [ "-m", "1024" ]
32
+      ]
33
+    }
34
+  ],
35
+ "provisioners": [
36
+    {
37
+      "type": "shell",
38
+      "scripts": [
39
+        "{{template_dir}}/provision.sh"
40
+      ],
41
+      "environment_vars": [
42
+        "VM_NAME={{user `vm_name`}}",
43
+        "HTTP_PROXY={{user `HTTP_PROXY`}}",
44
+        "HTTPS_PROXY={{user `HTTPS_PROXY`}}",
45
+        "http_proxy={{user `http_proxy`}}",
46
+        "https_proxy={{user `https_proxy`}}"
47
+      ]
48
+    }
49
+  ]
50
+}

+ 66
- 0
recipes/centos/7-minimal/kickstart.cfg View File

@@ -0,0 +1,66 @@
1
+#version=DEVEL
2
+# Install OS instead of upgrade
3
+install
4
+# Use CDROM installation media
5
+cdrom
6
+# Use text mode install
7
+text
8
+# Firewall configuration
9
+firewall --disabled
10
+firstboot --disable
11
+ignoredisk --only-use=vda
12
+# Keyboard layouts
13
+# old format: keyboard fr
14
+# new format:
15
+keyboard --vckeymap=fr --xlayouts='fr'
16
+# System language
17
+lang fr_FR.UTF-8
18
+
19
+# Network information
20
+network  --bootproto=dhcp --device=eth0 --activate
21
+network  --hostname=localhost.localdomain
22
+# Reboot after installation
23
+reboot
24
+# Root password
25
+rootpw --iscrypted $1$Rjj7lFXI$JQGgrgbrULPvaRj9WlKFn1
26
+
27
+#Create user cadoles with password cadoles
28
+user --name=cadoles --iscrypted $1$Rjj7lFXI$JQGgrgbrULPvaRj9WlKFn1 --shell=/bin/bash
29
+authconfig --enableshadow --enablemd5
30
+# SELinux configuration
31
+selinux --disabled
32
+# System services
33
+services --enabled="network,ntpd,ntpdate,chronyd"
34
+# Do not configure the X Window System
35
+skipx
36
+# System timezone
37
+timezone Etc/UTC
38
+# System bootloader configuration
39
+bootloader --append=" crashkernel=auto" --location=mbr --boot-drive=vda
40
+# Clear the Master Boot Record
41
+zerombr
42
+# Partition clearing information
43
+clearpart --all --initlabel
44
+# Disk partitioning information
45
+part pv.60 --fstype="lvmpv" --size=9799
46
+part /boot --fstype="ext4" --size=200 --fsoptions="noatime"
47
+volgroup vg0 --pesize=4096 pv.60
48
+logvol /  --fstype="ext4" --grow --size=1 --fsoptions="noatime" --name=root --vgname=vg0
49
+logvol swap  --fstype="swap" --size=1024 --name=swap --vgname=vg0
50
+
51
+%post
52
+/bin/sed -i 's/^.PermitRootLogin.*$/PermitRootLogin yes/' /etc/ssh/sshd_config
53
+%end
54
+
55
+%packages --nobase
56
+chrony
57
+kexec-tools
58
+openssh-server
59
+sed
60
+
61
+%end
62
+
63
+%addon com_redhat_kdump --enable --reserve-mb='auto'
64
+
65
+%end
66
+

+ 44
- 0
recipes/centos/7-minimal/provision.sh View File

@@ -0,0 +1,44 @@
1
+ #!/bin/bash -e
2
+
3
+set -xeo pipefail
4
+
5
+# Download OpenNebula context package
6
+ONE_CONTEXT_VERSION=5.4.0
7
+ONE_CONTEXT_BUILD_SUFFIX=-1
8
+ONE_FAMILY=el7
9
+ONE_CONTEXT_SHASUM=239010aab9660f2870847ad2b223279a5c26e425
10
+ONE_CONTEXT_URL="https://github.com/OpenNebula/addon-context-linux/releases/download/v${ONE_CONTEXT_VERSION}/one-context-${ONE_CONTEXT_VERSION}${ONE_CONTEXT_BUILD_SUFFIX}.${ONE_FAMILY}.noarch.rpm"
11
+ONE_CONTEXT_PACKAGE_DEST=/tmp/one-context.noarch.rpm
12
+
13
+#Install dependencies
14
+yum install perl-Digest-SHA -y
15
+yum install wget -y
16
+yum install bind-utils -y
17
+yum install cloud-utils-growpart -y
18
+yum install ruby -y
19
+yum install rubygem-json -y
20
+
21
+wget -O- "${ONE_CONTEXT_URL}" > "${ONE_CONTEXT_PACKAGE_DEST}"
22
+echo "${ONE_CONTEXT_SHASUM}  ${ONE_CONTEXT_PACKAGE_DEST}" | shasum -c
23
+
24
+# Purge cloud-init
25
+yum remove cloud-init
26
+
27
+# Install onecontext
28
+rpm -i "${ONE_CONTEXT_PACKAGE_DEST}" 
29
+
30
+# Update hostname
31
+hostnamectl set-hostname "${VM_NAME}"
32
+
33
+# Disable root login with password
34
+sed -i 's/^PermitRootLogin.*$/PermitRootLogin without-password/' /etc/ssh/sshd_config
35
+
36
+# Cleanup
37
+rm -f "${ONE_CONTEXT_PACKAGE_DEST}"
38
+yum clean all -y
39
+
40
+#enabled ssh on boot
41
+systemctl enable sshd
42
+
43
+# Force sync
44
+sync

Loading…
Cancel
Save