I have a problem with the below blueprint in relation to cloud-init, yum_repos and packages. The blueprint gets a static IP address from an existing network and that works fine after the deployment is complete, however, during the cloud-init stages, the network is unavailable to install the packages that are available via the yum_repos section. In looking at the logs, I have reconfigured /etc/cloud/cloud.cfg to run the yum_repos and packages modules to run during the same stage as bootcmd, as the network appears to be available here via a bootcmd that runs ip addr > /tmp/bootcmd_ip.txt. I get the same error with the modules in their default configuration or in my changed configuration, and as you can see in the log, the network device is not 'Up' as indicated after the reboot.
Has anyone run in to this and have any ideas on where I should go?
cloud-init output:
Cloud-init v. 18.5 running 'init-local' at Fri, 12 Jun 2020 12:52:15 +0000. Up 12.72 seconds.
Cloud-init v. 18.5 running 'init' at Fri, 12 Jun 2020 12:52:17 +0000. Up 14.12 seconds.
ci-info: ++++++++++++++++++++++++++++++++Net device info+++++++++++++++++++++++++++++++++
ci-info: +--------+-------+--------------+-----------------+--------+-------------------+
ci-info: | Device | Up | Address | Mask | Scope | Hw-Address |
ci-info: +--------+-------+--------------+-----------------+--------+-------------------+
ci-info: | ens192 | False | 10.73.112.44 | 255.255.255.128 | global | 00:50:56:8e:64:e1 |
ci-info: | lo | True | 127.0.0.1 | 255.0.0.0 | host | . |
ci-info: +--------+-------+--------------+-----------------+--------+-------------------+
ci-info: ++++++++++++++++++++++++++++++Route IPv4 info++++++++++++++++++++++++++++++
ci-info: +-------+-------------+-------------+-----------------+-----------+-------+
ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags |
ci-info: +-------+-------------+-------------+-----------------+-----------+-------+
ci-info: | 0 | 0.0.0.0 | 10.73.112.1 | 0.0.0.0 | ens192 | UG |
ci-info: | 1 | 10.73.112.0 | 0.0.0.0 | 255.255.255.128 | ens192 | U |
ci-info: +-------+-------------+-------------+-----------------+-----------+-------+
Loaded plugins: langpacks, product-id, search-disabled-repos, subscription-
: manager
[Errno 113] No route to host
http://internal.satellite.server/pulp/repos/ORG/Library/custom/EPEL/epel_7_x86_64/repodata/repomd.xml: [Errno 14] curl#7 - "Failed connect to internal.satellite.server:80; No route to host"
Trying other mirror.
Cloud-init v. 18.5 running 'init-local' at Fri, 12 Jun 2020 12:52:42 +0000. Up 9.22 seconds.
Cloud-init v. 18.5 running 'init' at Fri, 12 Jun 2020 12:52:43 +0000. Up 10.75 seconds.
ci-info: ++++++++++++++++++++++++++++++++Net device info++++++++++++++++++++++++++++++++
ci-info: +--------+------+--------------+-----------------+--------+-------------------+
ci-info: | Device | Up | Address | Mask | Scope | Hw-Address |
ci-info: +--------+------+--------------+-----------------+--------+-------------------+
ci-info: | ens192 | True | 10.73.112.44 | 255.255.255.128 | global | 00:50:56:8e:64:e1 |
ci-info: | lo | True | 127.0.0.1 | 255.0.0.0 | host | . |
ci-info: +--------+------+--------------+-----------------+--------+-------------------+
ci-info: ++++++++++++++++++++++++++++++Route IPv4 info++++++++++++++++++++++++++++++
ci-info: +-------+-------------+-------------+-----------------+-----------+-------+
ci-info: | Route | Destination | Gateway | Genmask | Interface | Flags |
ci-info: +-------+-------------+-------------+-----------------+-----------+-------+
ci-info: | 0 | 0.0.0.0 | 10.73.112.1 | 0.0.0.0 | ens192 | UG |
ci-info: | 1 | 10.73.112.0 | 0.0.0.0 | 255.255.255.128 | ens192 | U |
ci-info: +-------+-------------+-------------+-----------------+-----------+-------+
Cloud-init v. 18.5 running 'modules:config' at Fri, 12 Jun 2020 12:52:44 +0000. Up 11.78 seconds.
Cloud-init v. 18.5 running 'modules:final' at Fri, 12 Jun 2020 12:52:45 +0000. Up 12.29 seconds.
ci-info: no authorized ssh keys fingerprints found for user cloud-user.
Cloud-init v. 18.5 finished at Fri, 12 Jun 2020 12:52:45 +0000. Datasource DataSourceOVF [seed=iso]. Up 12.40 seconds
/etc/cloud/cloud.cfg:
users:
- default
disable_root: 1
ssh_pwauth: 0
mount_default_fields: [~, ~, 'auto', 'defaults,nofail,x-systemd.requires=cloud-init.service', '0', '2']
resize_rootfs_tmp: /dev
ssh_deletekeys: 0
ssh_genkeytypes: ~
syslog_fix_perms: ~
disable_vmware_customization: true
cloud_init_modules:
- disk_setup
- migrator
- bootcmd
- yum-add-repo
- package-update-upgrade-install
- write-files
- growpart
- resizefs
- set_hostname
- update_hostname
- update_etc_hosts
- rsyslog
- users-groups
- ssh
cloud_config_modules:
- mounts
- locale
- set-passwords
- rh_subscription
# - yum-add-repo
# - package-update-upgrade-install
- timezone
- puppet
- chef
- salt-minion
- mcollective
- disable-ec2-metadata
- runcmd
cloud_final_modules:
- rightscale_userdata
- scripts-per-once
- scripts-per-boot
- scripts-per-instance
- scripts-user
- ssh-authkey-fingerprints
- keys-to-console
- phone-home
- final-message
- power-state-change
system_info:
default_user:
name: cloud-user
lock_passwd: true
gecos: Cloud User
groups: [wheel, adm, systemd-journal]
sudo: ["ALL=(ALL) NOPASSWD:ALL"]
shell: /bin/bash
distro: rhel
paths:
cloud_dir: /var/lib/cloud
templates_dir: /etc/cloud/templates
ssh_svcname: sshd
# vim:syntax=yaml
network: { config: "disabled" }
output: { all: "| tee -a /var/log/cloud-init-output.log" }
disable_ec2_metadata: True
Blueprint:
formatVersion: 1
inputs:
os:
type: string
title: Operating System
description: Choose an operating system
format: ''
default: rhel7
oneOf:
- title: RHEL 7
const: rhel7
- title: RHEL 8
const: rhel8
size:
type: string
description: Choose the size for the new VM
title: VM Size
oneOf:
- title: 'Small Memory (1cpu, 4GB)'
const: smallmem
- title: 'Small CPU (2cpu, 2GB)'
const: smallcpu
- title: 'Medium Memory (2cpu, 8GB)'
const: mediummem
- title: 'Medium CPU (4cpu, 4GB)'
const: mediumcpu
- title: 'Large Memory (4cpu, 16GB)'
const: largemem
- title: 'Large CPU (8cpu, 8GB)'
const: largecpu
- title: 'XL Memory (8cpu, 32GB)'
const: xlmem
- title: 'XL CPU (16cpu, 16GB)'
const: xlcpu
- title: 'XXL Memory (16cpu, 64GB)'
const: xxlmem
- title: 'XXL CPU (32cpu, 32GB)'
const: xxlcpu
default: smallmem
workload:
type: string
description: 'Workload function, example - tomcat'
title: Node Workload
default: tomcat
pattern: '^[a-z0-9]+$'
environment:
type: string
description: Choose the environment for this deployment
title: Environment
oneOf:
- title: Sandbox
const: sbx
- title: UAT
const: uat
- title: Production
const: prd
default: sbx
disks:
type: array
title: Data Disks
description: Data disk mount points and sizes.
default:
- size: 10
mountpoint: /app
minItems: 0
maxItems: 2
items:
type: object
properties:
mountpoint:
type: string
title: Mountpoint
size:
type: integer
title: Size (GB)
maximum: 1024
min: 5
custom-files:
type: array
title: Custom files
description: Custom files to write via cloud-init
items:
type: object
properties:
path:
type: string
title: Full file path
content:
type: string
title: File contents
encoding:
type: string
title: File encoding
oneOf:
- title: Base64 Encoding
const: b64
default: b64
owner:
type: string
title: User/Group Owner
oneOf:
- title: 'root:root'
const: root
default: 'root:root'
permissions:
type: string
title: File permissions
oneOf:
- title: Read Write (0644)
const: '0644'
- title: Read Only (0600)
const: '0600'
- title: Executable (0755)
const: '0755'
default: '0600'
publickey:
type: string
description: SSH public key to add to the machine
title: SSH Public Key
resources:
network:
type: Cloud.NSX.Network
properties:
networkType: existing
machine:
type: Cloud.vSphere.Machine
properties:
name: 'ls${input.workload}'
image: '${input.os}'
flavor: '${input.size}'
networks:
- network: '${resource.network.id}'
assignment: static
DNSZone: internal.dns
Infoblox.IPAM.Network.dnsSuffix: '${env.projectName}.${input.environment}.${self.DNSZone}'
attachedDisks: '${map_to_object(resource.disk1[*].id, "source")}'
cloudConfig: |
#cloud-config
preserve_hostname: false
hostname: ${self.resourceName}
fqdn: ${self.resourceName}.${env.projectName}.${input.environment}.sdc.icp
users:
- default
- name: icpautomate
gecos: Internal Cloud Platform automation account
ssh-authorized-keys:
- ${input.publickey}
sudo: ALL=(ALL) NOPASSWD:ALL
shell: /bin/bash
yum_repos:
epel-7:
name: EPEL-7
baseurl: 'http://lsmgtspsat.tsysmgmt.net/pulp/repos/TSYS/Library/custom/EPEL/epel_7_x86_64/'
gpgcheck: false
sslverify: false
enabled: true
packages:
- ansible
- git
bootcmd:
- mkdir -p ${input.disks[0].mountpoint}
- mkdir -p ${input.disks[1].mountpoint}
- ip addr > /tmp/bootip.txt
disk_setup:
/dev/sdb:
table_type: mbr
layout: true
overwrite: true
/dev/sdc:
table_type: mbr
layout: true
overwrite: true
fs_setup:
- label: ${to_upper(replace(input.disks[0].mountpoint,"/",""))}
filesystem: xfs
device: /dev/sdb1
- label: ${to_upper(replace(input.disks[1].mountpoint,"/",""))}
filesystem: xfs
device: /dev/sdc1
mounts:
- [ /dev/sdb1, ${input.disks[0].mountpoint} ]
- [ /dev/sdc1, ${input.disks[1].mountpoint} ]
write_files:
${input.custom-files}
disk1:
type: Cloud.vSphere.Disk
properties:
capacityGb: '${input.disks[0].size}'
name: '${to_upper(replace(input.disks[0].mountpoint,"/",""))}'
count: '${length(input.disks) >= 1 ? 1 : 0}'