<template>
  <name>centos72-source</name>
  <os>
    <name>CentOS-7</name>
    <version>2</version>
    <arch>x86_64</arch>
    <install type='iso'>
      <iso>file:///data/md0/iso/CentOS-7.2-x86_64-Minimal-1511.iso</iso>
    </install>
    <rootpw>Ct@2017Yun!@$%.CN</rootpw>
  </os>
  <disk>
    <size>20</size>
  </disk>
  <description>CentOS 7.2 x86_64</description>
  <packages>
    <package name='net-tools'/>
    <package name='acpid'/>
    <package name='cloud-utils-growpart'/>
    <package name='sysstat'/>
  </packages>
  <commands>
    <command name='install_qga'>
cd /root
tar xf qga.20171124.tar.gz
cd qga
bash ./install_qga_local.sh
    </command>
    
   <command name='sed_profile'>
echo "NOZEROCONF=yes" >> /etc/sysconfig/network
rm -rf /etc/udev/rules.d/70-persistent-net.rules
touch /etc/udev/rules.d/75-persistent-net-generator.rules
chmod +x /var/lib/cloud/scripts/per-boot/resetroot
chmod +x /var/lib/cloud/scripts/per-instance/ssh.sh
chmod +x /usr/local/bin/nic_set_mq.sh
echo "/usr/local/bin/nic_set_mq.sh > /tmp/nic_set_mq.log 2&gt;&amp;1" >> /etc/rc.d/rc.local
chmod +x /etc/rc.d/rc.local
   </command>
   
   <command name='install_Cloudinit_and_dependencies'>
mkdir -p  /root/.pip/
yum install wget -y
yum install epel-release -y
yum clean all
yum install python-pip -y
pip install setuptools jinja2 prettytable oauthlib pyyaml requests jsonpatch jsonschema six --upgrade
cd /root
wget https://launchpad.net/cloud-init/trunk/17.1/+download/cloud-init-17.1.tar.gz
tar -zxvf cloud-init-17.1.tar.gz
cd ./cloud-init-17.1
python setup.py build
python setup.py install --init-system systemd
   </command>
    
   <command name='console'>
grub2-mkconfig -o /boot/grub2/grub.cfg
   </command>
   
   <command name='services'>
systemctl enable sshd
systemctl disable firewalld
systemctl enable cloud-init
systemctl enable cloud-config
systemctl enable cloud-final
systemctl enable cloud-init-local
systemctl enable acpid
systemctl disable NetworkManager
   </command>
   
   <command name='clear-logs'>
rm -rf /root/*
rm -rf /var/log/anaconda*
rm -rf /var/log/message
>/var/log/boot.log
>/var/log/messages
>/var/log/cloud-init-output.log
>/var/log/yum.log
>/var/log/lastlog
   </command>
  </commands>

    <files>
        <file name="/root/qga.20171124.tar.gz" type="url">
            file:///data/nvme0n1/OZ-build-image/scripts/qga.20171124.tar.gz
        </file>
        <file name="/var/lib/cloud/scripts/per-boot/resetroot" type="url">
            file:///data/nvme0n1/OZ-build-image/scripts/resetroot
        </file>
        <file name="/etc/cloud/cloud.cfg" type="url">
            file:///data/nvme0n1/OZ-build-image/scripts/cloud.cfg_centos7
        </file>
        <file name="/usr/local/bin/nic_set_mq.sh" type="url">
            file:///data/nvme0n1/OZ-build-image/scripts/nic_set_mq.sh
        </file>
        <file name="/etc/default/grub" type="url">
            file:///data/nvme0n1/OZ-build-image/scripts/grub_centos7
        </file>
        <file name="/var/lib/cloud/scripts/per-instance/ssh.sh" type="url">
            file:///data/nvme0n1/OZ-build-image/scripts/ssh-centos7.ssh
        </file>
        <file name="/root/.pip/pip.conf" type="url">
            file:///data/nvme0n1/OZ-build-image/scripts/pip.conf
        </file>
        <file name="/lib/systemd/system/cloud-init-local.service" type="url">
            file:///data/nvme0n1/OZ-build-image/scripts/cloud-init-local.service
        </file>
        <file name="/lib/systemd/system/cloud-init.service" type="url">
            file:///data/nvme0n1/OZ-build-image/scripts/cloud-init.service
        </file>
    </files>
</template>
View Code

相关文章:

  • 2021-10-01
  • 2021-10-19
  • 2018-01-07
  • 2019-07-28
  • 2022-03-07
  • 2022-02-22
  • 2021-12-27
  • 2021-08-29
猜你喜欢
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2022-12-23
  • 2021-12-04
相关资源
相似解决方案