MicrosoftDocs / azure-docs

Open source documentation of Microsoft Azure
https://docs.microsoft.com/azure
Creative Commons Attribution 4.0 International
10.28k stars 21.47k forks source link

cloud-init user-data script is not working on centos 7 #67376

Closed bobbybhaskar closed 3 years ago

bobbybhaskar commented 3 years ago

Hello everyone,

In cloud-init I took one of the centos VM, while I am creating the VM there is an option called "custom data" in that given one of the sample scripts for testing, I attach the script.

just follow this link "

([(https://docs.microsoft.com/en-us/azure/virtual-machines/linux/tutorial-automate-vm-deployment)])

OS:

NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/"

CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7"

kernel : Kernel: Linux 3.10.0-1160.6.1.el7.x86_64

[root@centos-7-cloud-init cloud.cfg.d]# cloud-init --version /bin/cloud-init 19.4

script:

cloud-config

package_upgrade: true packages:


After deployment of centos VM the "user-data script" is not working, these are logs image

I have doubt that when I tested on the ubuntu machine is working fine, but I tried a number of times on centos vms still it is not working, is script issue or centos os is not compatible for cloud-init?

Here I attached cloud-init logs cloud-init.log

Thanks,

Bobby.

Edited: Added doc metadata


Document Details

Do not edit this section. It is required for docs.microsoft.com ➟ GitHub issue linking.

AjayKumar-MSFT commented 3 years ago

@bobbybhaskar, Thanks for the question! We are taking a look into this and will get back to you soon.

ghost commented 3 years ago

Hi @bobbybhaskar ,

That script in the quickstart is intended for an UbuntuLTS image.

Azure Supports cloud-init for a number of CentOs images. See the list here to ensure your using the correct version for your script. This doc here has good examples for a Centos image.