Advertisement
Guest User

Untitled

a guest
Aug 22nd, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.27 KB | None | 0 0
  1. #!/bin/bash
  2. echo "==========================================================================================="
  3. echo "Initiating Satellite 6.2 system registration and configuration setup..[Internal use only]"
  4. echo "===========================================================================================
  5. "
  6. trap ctrl_c INT
  7. function ctrl_c() {
  8. echo "**Trapped CTRL-C**" ; exit
  9. }
  10.  
  11. #System information.
  12. echo "System Information:"
  13. echo "########################################"
  14. echo "Hostname:"
  15. hostname
  16. echo "########################################"
  17. cat '/etc/redhat-release'
  18. echo "########################################"
  19. echo "Memory Info:"
  20. free -m
  21. echo "########################################"
  22. echo "Disk Info:"
  23. df -h
  24. echo "########################################"
  25. echo "Date:"
  26. date
  27. echo "########################################"
  28.  
  29. echo "
  30.  
  31. "
  32.  
  33. #Installer details.
  34.  
  35. echo "Please provide Satellite Installer details"
  36.  
  37. echo "Organization Name:"
  38. unset org
  39. while [ -z ${org} ]; do
  40. read org
  41. done
  42.  
  43. echo "Location Name:"
  44. unset loc
  45. while [ -z ${loc} ]; do
  46. read loc
  47. done
  48.  
  49. echo "Admin Username:"
  50. unset username
  51. while [ -z ${username} ]; do
  52. read username
  53. done
  54.  
  55. echo "Admin Password:"
  56. unset passwd
  57. while [ -z ${passwd} ]; do
  58. read passwd
  59. done
  60.  
  61. read -p "Do you wish to install Satellite with above parameters. STOP the installer if 'DNS' is not configured properly. Y/N: " -n 1 -r
  62. echo "
  63. "
  64. if [[ ! $REPLY =~ ^[Yy]$ ]]
  65. then
  66. exit 1
  67. fi
  68.  
  69.  
  70. echo "
  71. "
  72.  
  73.  
  74. #Registration.
  75. echo "Registering system to the RHSM, Red Hat portal credentials required"
  76.  
  77. subscription-manager register --force
  78. RESULT=$?
  79. if [ $RESULT -eq 0 ]; then
  80. echo "Registration Successful!"
  81. else
  82. echo "Registration Failed :("
  83. exit 1
  84. fi
  85.  
  86. echo "
  87. "
  88.  
  89. #Subscription.
  90. echo "Attaching Employee Satellite subscription"
  91. sub=`subscription-manager list --matches="Red Hat Satellite Employee Subscription" --all --available | grep "Pool ID:" | awk '{print $3}'`
  92. subscription-manager attach --pool="$sub"
  93. RESULT=$?
  94. if [ $RESULT -eq 0 ]; then
  95. echo "Satellite Subsription Attached!"
  96. else
  97. echo "Failed to attach Subscription :("
  98. exit 1
  99. fi
  100.  
  101. echo "
  102. "
  103.  
  104. #Enable repos.
  105. echo "Enabling required repositories..."
  106. subscription-manager repos --disable "*" --enable=rhel-7-server-rpms --enable=rhel-server-rhscl-7-rpms --enable=rhel-7-server-satellite-6.2-rpms
  107.  
  108. #Update the system.
  109. yum clean all
  110. yum update -y
  111.  
  112. echo "
  113. "
  114.  
  115. #Install the Satellite server.
  116. echo "Insatlling Satellite server..."
  117. yum install satellite -y
  118.  
  119.  
  120. echo "
  121. "
  122.  
  123. #Configure the Satellite server.
  124. echo "******************************************"
  125. echo "Executing Installer with below parameters"
  126. echo "------------------------------------------"
  127. echo "Org:$org"
  128. echo "------------------------------------------"
  129. echo "Location:$loc"
  130. echo "------------------------------------------"
  131. echo "User:$username Password:$passwd"
  132. echo "******************************************"
  133.  
  134. echo "
  135. "
  136. satellite-installer --scenario satellite --foreman-initial-organization "$org" --foreman-initial-location "$loc" --foreman-admin-username "$username" --foreman-admin-password "$passwd" --foreman-proxy-dns-managed=false --foreman-proxy-dhcp-managed=false
  137. RESULT=$?
  138. if [ $RESULT -eq 0 ]; then
  139. echo "Yippee! Configuration Completed :)"
  140.  
  141. else
  142. echo "Installation Failed :( "
  143. exit 1
  144. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement