Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -----------------------------------------------------------
- # File Read on RHEL8 Box
- # -----------------------------------------------------------
- [root@rhel8-base ~]# curl http://169.254.169.254/latest/user-data
- #cloud-config
- # Cloud-Config file must start with the above line or bad things happen.
- datasource:
- Ec2:
- strict_id: false
- # Ensure Password Auth is Enabled
- ssh_pwauth: true
- # Configure some prereq stuff semi-statically so the test images can build/work
- # Add hostfile entry for this server to /etc/hosts
- # Configure static Facter Values
- # Create root/initialbuild directory
- # Ensure Password SSH Config is ENABLED
- runcmd:
- - echo "$(/opt/puppetlabs/bin/facter networking.interfaces.eth0.bindings.0.address) $(/opt/puppetlabs/bin/facter fqdn) $(/opt/puppetlabs/bin/facter hostname)" >> /etc/hosts
- - echo "$(/opt/puppetlabs/bin/facter fqdn)" > /etc/hostname
- - [mkdir, -p, /etc/facter/facts.d]
- - echo "payx_network_segment=zone1" > /etc/facter/facts.d/payx_network_segment.txt
- - echo "payx_datacenter=webster" > /etc/facter/facts.d/payx_datacenter.txt
- - echo "payx_network_location=webster_zone1" > /etc/facter/facts.d/payx_network_location.txt
- - echo "payx_environment=prod" > /etc/facter/facts.d/payx_environment.txt
- - echo "payx_tan=no" > /etc/facter/facts.d/payx_tan.txt
- - echo "payx_multi=no" > /etc/facter/facts.d/payx_multi.txt
- - [systemctl, disable, --no-block, NetworkManager.service]
- - [systemctl, enable, --no-block, puppet.service]
- - [mkdir, -p, /root/initialbuild]
- - [sed, -i, 's/PasswordAuthentication no/PasswordAuthentication yes/', /etc/ssh/sshd_config]
- final_message: Test Instance is up and ready for Inspec Testing!
- # -----------------------------------------------------------
- # File Read on RHEL7 Box
- # -----------------------------------------------------------
- [root@rhel7-test-hen ~]# curl http://169.254.169.254/latest/user-data
- #cloud-config
- # Cloud-Config file must start with the above line or bad things happen.
- datasource:
- Ec2:
- strict_id: false
- # Ensure Password Auth is Enabled
- ssh_pwauth: true
- # Configure some prereq stuff semi-statically so the test images can build/work
- # Add hostfile entry for this server to /etc/hosts
- # Configure static Facter Values
- # Create root/initialbuild directory
- # Ensure Password SSH Config is ENABLED
- runcmd:
- - echo "$(/opt/puppetlabs/bin/facter networking.interfaces.eth0.bindings.0.address) $(/opt/puppetlabs/bin/facter fqdn) $(/opt/puppetlabs/bin/facter hostname)" >> /etc/hosts
- - echo "$(/opt/puppetlabs/bin/facter fqdn)" > /etc/hostname
- - [mkdir, -p, /etc/facter/facts.d]
- - echo "payx_network_segment=zone1" > /etc/facter/facts.d/payx_network_segment.txt
- - echo "payx_datacenter=webster" > /etc/facter/facts.d/payx_datacenter.txt
- - echo "payx_network_location=webster_zone1" > /etc/facter/facts.d/payx_network_location.txt
- - echo "payx_environment=prod" > /etc/facter/facts.d/payx_environment.txt
- - echo "payx_tan=no" > /etc/facter/facts.d/payx_tan.txt
- - echo "payx_multi=no" > /etc/facter/facts.d/payx_multi.txt
- - [systemctl, disable, --no-block, NetworkManager.service]
- - [systemctl, enable, --no-block, puppet.service]
- - [mkdir, -p, /root/initialbuild]
- - [sed, -i, 's/PasswordAuthentication no/PasswordAuthentication yes/', /etc/ssh/sshd_config]
- final_message: Test Instance is up and ready for Inspec Testing!
- # -----------------------------------------------------------
- ## Identical Hashes of files from metadata service as well:
- # -----------------------------------------------------------
- [root@rhel8-base ~]# curl http://169.254.169.254/latest/user-data | md5sum
- % Total % Received % Xferd Average Speed Time Time Time Current
- Dload Upload Total Spent Left Speed
- 100 1466 100 1466 0 0 3878 0 --:--:-- --:--:-- --:--:-- 3868
- e5d8cece78385ef0a54de242fd856a75 -
- [root@rhel7-test-hen ~]# curl http://169.254.169.254/latest/user-data | md5sum
- % Total % Received % Xferd Average Speed Time Time Time Current
- Dload Upload Total Spent Left Speed
- 100 1466 100 1466 0 0 3401 0 --:--:-- --:--:-- --:--:-- 3401
- e5d8cece78385ef0a54de242fd856a75 -
- # -----------------------------------------------------------
- ## Proof that "User Data" is actually read (not disabled via config)
- # -----------------------------------------------------------
- [root@rhel8-base ~]# cloud-init analyze show | grep user-data
- |`->reading and applying user-data @96.36500s +00.00300s
- [root@rhel7-test-hen ~]# cloud-init analyze show | grep user-data
- |`->reading and applying user-data @100.75800s +00.02300s
- # -----------------------------------------------------------
- ## Error message noted on RHEL8
- # -----------------------------------------------------------
- [root@rhel8-base ~]# cat /var/log/cloud-init.log | grep "text/x-not-multipart"
- 2020-07-01 18:38:33,270 - __init__.py[DEBUG]: {'MIME-Version': '1.0', 'Content-Type': 'text/x-not-multipart', 'Content-Disposition': 'attachment; filename="part-001"'}
- 2020-07-01 18:38:33,270 - __init__.py[DEBUG]: Empty payload of type text/x-not-multipart
- # -----------------------------------------------------------
- ## Absence of this error on RHEL7:
- # -----------------------------------------------------------
- [root@rhel7-test-hen ~]# cat /var/log/cloud-init.log | grep "text/x-not-multipart"
- [root@rhel7-test-hen ~]#
- # -----------------------------------------------------------
- ## User-Data file EMPTY on RHEL8 - correct on RHEL7
- # -----------------------------------------------------------
- [root@rhel8-base ~]# cat /var/lib/cloud/instance/user-data.txt
- [root@rhel8-base ~]#
- [root@rhel7-test-hen ~]# cat /var/lib/cloud/instance/user-data.txt
- #cloud-config
- # Cloud-Config file must start with the above line or bad things happen.
- datasource:
- Ec2:
- strict_id: false
- # Ensure Password Auth is Enabled
- ssh_pwauth: true
- # Configure some prereq stuff semi-statically so the test images can build/work
- # Add hostfile entry for this server to /etc/hosts
- # Configure static Facter Values
- # Create root/initialbuild directory
- # Ensure Password SSH Config is ENABLED
- runcmd:
- - echo "$(/opt/puppetlabs/bin/facter networking.interfaces.eth0.bindings.0.address) $(/opt/puppetlabs/bin/facter fqdn) $(/opt/puppetlabs/bin/facter hostname)" >> /etc/hosts
- - echo "$(/opt/puppetlabs/bin/facter fqdn)" > /etc/hostname
- - [mkdir, -p, /etc/facter/facts.d]
- - echo "payx_network_segment=zone1" > /etc/facter/facts.d/payx_network_segment.txt
- - echo "payx_datacenter=webster" > /etc/facter/facts.d/payx_datacenter.txt
- - echo "payx_network_location=webster_zone1" > /etc/facter/facts.d/payx_network_location.txt
- - echo "payx_environment=prod" > /etc/facter/facts.d/payx_environment.txt
- - echo "payx_tan=no" > /etc/facter/facts.d/payx_tan.txt
- - echo "payx_multi=no" > /etc/facter/facts.d/payx_multi.txt
- - [systemctl, disable, --no-block, NetworkManager.service]
- - [systemctl, enable, --no-block, puppet.service]
- - [mkdir, -p, /root/initialbuild]
- - [sed, -i, 's/PasswordAuthentication no/PasswordAuthentication yes/', /etc/ssh/sshd_config]
- final_message: Test Instance is up and ready for Inspec Testing!
- # -----------------------------------------------------------
- ## user-data.txt.i file on rhel8 shows weird mimetype issues:
- # -----------------------------------------------------------
- [root@rhel8-base ~]# cat /var/lib/cloud/instance/user-data.txt.i
- Content-Type: multipart/mixed; boundary="===============9020804030255639540=="
- MIME-Version: 1.0
- Number-Attachments: 1
- --===============9020804030255639540==
- MIME-Version: 1.0
- Content-Type: text/x-not-multipart
- Content-Disposition: attachment; filename="part-001"
- --===============9020804030255639540==--
- [root@rhel8-base ~]#
- Seems OK on RHEL7
- [root@rhel7-test-hen ~]# cat /var/lib/cloud/instance/user-data.txt.i
- From nobody Wed Jul 1 15:00:11 2020
- Content-Type: multipart/mixed; boundary="===============4957072323274166186=="
- MIME-Version: 1.0
- Number-Attachments: 1
- --===============4957072323274166186==
- MIME-Version: 1.0
- Content-Type: text/cloud-config
- Content-Disposition: attachment; filename="part-001"
- #cloud-config
- # Cloud-Config file must start with the above line or bad things happen.
- datasource:
- Ec2:
- strict_id: false
- # Ensure Password Auth is Enabled
- ssh_pwauth: true
- # Configure some prereq stuff semi-statically so the test images can build/work
- # Add hostfile entry for this server to /etc/hosts
- # Configure static Facter Values
- # Create root/initialbuild directory
- # Ensure Password SSH Config is ENABLED
- runcmd:
- - echo "$(/opt/puppetlabs/bin/facter networking.interfaces.eth0.bindings.0.address) $(/opt/puppetlabs/bin/facter fqdn) $(/opt/puppetlabs/bin/facter hostname)" >> /etc/hosts
- - echo "$(/opt/puppetlabs/bin/facter fqdn)" > /etc/hostname
- - [mkdir, -p, /etc/facter/facts.d]
- - echo "payx_network_segment=zone1" > /etc/facter/facts.d/payx_network_segment.txt
- - echo "payx_datacenter=webster" > /etc/facter/facts.d/payx_datacenter.txt
- - echo "payx_network_location=webster_zone1" > /etc/facter/facts.d/payx_network_location.txt
- - echo "payx_environment=prod" > /etc/facter/facts.d/payx_environment.txt
- - echo "payx_tan=no" > /etc/facter/facts.d/payx_tan.txt
- - echo "payx_multi=no" > /etc/facter/facts.d/payx_multi.txt
- - [systemctl, disable, --no-block, NetworkManager.service]
- - [systemctl, enable, --no-block, puppet.service]
- - [mkdir, -p, /root/initialbuild]
- - [sed, -i, 's/PasswordAuthentication no/PasswordAuthentication yes/', /etc/ssh/sshd_config]
- final_message: Test Instance is up and ready for Inspec Testing!
- --===============4957072323274166186==--[root@rhel7-test-hen ~]#
Add Comment
Please, Sign In to add comment