首页 > 代码库 > cloud-init 问题小记

cloud-init 问题小记

1. 使用ConfigDrive的场景下,NetworkManager会overwrite DNS

1 # /etc/NetworkManager/NetworkManager.conf
2 [main]
3 dns=none

     https://ma.ttias.be/centos-7-networkmanager-keeps-overwriting-etcresolv-conf/

 

2.安装cloud-init

    1.源安装:http://www.ibm.com/support/knowledgecenter/SSB27U_6.3.0/com.ibm.zvm.v630.hcpo4/instslesmore.htm

    2.rpm包安装

        a.生成rpm包,cloud-init/packages/brpm

        b.yum install  cloud-init-0.7.7-1.el7.centos.noarch.rpm 

 

3. Nova 使用configDrive

技术分享
#1.nova启用ConfigDrive
nova boot --config-drive true --flavor m1.small  --image centos6 --nic net-id=xxxxxxxx --key-name controller --user-data ./my-user-data.txt instance-003

#2.查看configDrive配置
 mkdir -p /mnt/config
 mount /dev/disk/by-label/config-2 /mnt/config

#3.configdrive
#cloud-config
chpasswd:
list: |
centos:passw0rd
expire: False
ssh_pwauth: True
hostname: host001
runcmd:
- [ service, ssh, restart ]
 
#!/bin/sh
passwd centos<<EOF
passw0rd
passw0rd
EOF
sed -i s/PasswordAuthentication no/PasswordAuthentication yes/g /etc/ssh/sshd_config
service ssh restart
View Code

 

cloud-init 问题小记