← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1907449] [NEW] cloud-init user-data script is not working on Azure centos 7 vm

 

Public bug reported:

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:

nginx
nodejs
npm
write_files:
owner: www-data:www-data
path: /etc/nginx/sites-available/default
content: |
server {
listen 80;
location / {
proxy_pass http://localhost:3000;
proxy_http_version 1.1;
proxy_set_header Upgrade $http_upgrade;
proxy_set_header Connection keep-alive;
proxy_set_header Host $host;
proxy_cache_bypass $http_upgrade;
}
}
owner: azureuser:azureuser
path: /home/azureuser/myapp/index.js
content: |
var express = require('express')
var app = express()
var os = require('os');
app.get('/', function (req, res) {
res.send('Hello World from host ' + os.hostname() + '!')
})
app.listen(3000, function () {
console.log('Hello world app listening on port 3000!')
})
runcmd:
service nginx restart
cd "/home/azureuser/myapp"
npm init
npm install express -y
nodejs index.js


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.tar.gz

Thanks,

Bobby

** Affects: cloud-init
     Importance: Undecided
         Status: New

** Attachment added: "cloud-init .tar.gz"
   https://bugs.launchpad.net/bugs/1907449/+attachment/5442245/+files/cloud-init.tar.gz

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to cloud-init.
https://bugs.launchpad.net/bugs/1907449

Title:
  cloud-init user-data script is not working on Azure centos 7 vm

Status in cloud-init:
  New

Bug description:
  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:

  nginx
  nodejs
  npm
  write_files:
  owner: www-data:www-data
  path: /etc/nginx/sites-available/default
  content: |
  server {
  listen 80;
  location / {
  proxy_pass http://localhost:3000;
  proxy_http_version 1.1;
  proxy_set_header Upgrade $http_upgrade;
  proxy_set_header Connection keep-alive;
  proxy_set_header Host $host;
  proxy_cache_bypass $http_upgrade;
  }
  }
  owner: azureuser:azureuser
  path: /home/azureuser/myapp/index.js
  content: |
  var express = require('express')
  var app = express()
  var os = require('os');
  app.get('/', function (req, res) {
  res.send('Hello World from host ' + os.hostname() + '!')
  })
  app.listen(3000, function () {
  console.log('Hello world app listening on port 3000!')
  })
  runcmd:
  service nginx restart
  cd "/home/azureuser/myapp"
  npm init
  npm install express -y
  nodejs index.js

  
  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.tar.gz

  Thanks,

  Bobby

To manage notifications about this bug go to:
https://bugs.launchpad.net/cloud-init/+bug/1907449/+subscriptions


Follow ups