1 heat_template_version: pike
4 RHEL Registration and unregistration software deployments.
6 # Note extra parameters can be defined, then passed data via the
7 # environment parameter_defaults, without modifying the parent template
11 # To be defined via a local or global environment in parameter_defaults
12 rhel_reg_activation_key:
22 rhel_reg_machine_name:
38 rhel_reg_service_level:
48 rhel_reg_http_proxy_host:
50 rhel_reg_http_proxy_port:
52 rhel_reg_http_proxy_username:
54 rhel_reg_http_proxy_password:
56 UpdateOnRHELRegistration:
60 When enabled, the system will perform a yum update after performing the
61 RHEL Registration process.
66 type: OS::Heat::SoftwareConfig
70 - name: REG_ACTIVATION_KEY
71 - name: REG_AUTO_ATTACH
73 - name: REG_ENVIRONMENT
75 - name: REG_MACHINE_NAME
82 - name: REG_SERVER_URL
83 - name: REG_SERVICE_LEVEL
88 - name: REG_HTTP_PROXY_HOST
89 - name: REG_HTTP_PROXY_PORT
90 - name: REG_HTTP_PROXY_USERNAME
91 - name: REG_HTTP_PROXY_PASSWORD
92 config: {get_file: scripts/rhel-registration}
94 RHELRegistrationDeployment:
95 type: OS::Heat::SoftwareDeployment
97 name: RHELRegistrationDeployment
98 server: {get_param: server}
99 config: {get_resource: RHELRegistration}
100 actions: ['CREATE'] # Only do this on CREATE
102 REG_ACTIVATION_KEY: {get_param: rhel_reg_activation_key}
103 REG_AUTO_ATTACH: {get_param: rhel_reg_auto_attach}
104 REG_BASE_URL: {get_param: rhel_reg_base_url}
105 REG_ENVIRONMENT: {get_param: rhel_reg_environment}
106 REG_FORCE: {get_param: rhel_reg_force}
107 REG_MACHINE_NAME: {get_param: rhel_reg_machine_name}
108 REG_ORG: {get_param: rhel_reg_org}
109 REG_PASSWORD: {get_param: rhel_reg_password}
110 REG_POOL_ID: {get_param: rhel_reg_pool_id}
111 REG_RELEASE: {get_param: rhel_reg_release}
112 REG_REPOS: {get_param: rhel_reg_repos}
113 REG_SAT_URL: {get_param: rhel_reg_sat_url}
114 REG_SERVER_URL: {get_param: rhel_reg_server_url}
115 REG_SERVICE_LEVEL: {get_param: rhel_reg_service_level}
116 REG_USER: {get_param: rhel_reg_user}
117 REG_TYPE: {get_param: rhel_reg_type}
118 REG_METHOD: {get_param: rhel_reg_method}
119 REG_SAT_REPO: {get_param: rhel_reg_sat_repo}
120 REG_HTTP_PROXY_HOST: {get_param: rhel_reg_http_proxy_host}
121 REG_HTTP_PROXY_PORT: {get_param: rhel_reg_http_proxy_port}
122 REG_HTTP_PROXY_USERNAME: {get_param: rhel_reg_http_proxy_username}
123 REG_HTTP_PROXY_PASSWORD: {get_param: rhel_reg_http_proxy_password}
126 type: OS::Heat::SoftwareConfig
129 config: {get_file: scripts/rhel-unregistration}
133 RHELUnregistrationDeployment:
134 type: OS::Heat::SoftwareDeployment
136 name: RHELUnregistrationDeployment
137 server: {get_param: server}
138 config: {get_resource: RHELUnregistration}
139 actions: ['DELETE'] # Only do this on DELETE
141 REG_METHOD: {get_param: rhel_reg_method}
143 YumUpdateConfigurationAfterRHELRegistration:
144 type: OS::Heat::SoftwareConfig
150 num_updates=$(yum list -q updates | wc -l)
151 if [ "$num_updates" -eq "0" ]; then
152 echo "No packages require updating"
155 full_command="yum -q -y update"
156 echo "Running: $full_command"
157 result=$($full_command)
160 echo "yum return code: $return_code"
163 UpdateDeploymentAfterRHELRegistration:
164 type: OS::Heat::SoftwareDeployment
165 depends_on: RHELRegistrationDeployment
167 update_requested: {get_param: UpdateOnRHELRegistration}
169 name: UpdateDeploymentAfterRHELRegistration
170 config: {get_resource: YumUpdateConfigurationAfterRHELRegistration}
171 server: {get_param: server}
172 actions: ['CREATE'] # Only do this on CREATE
176 description: Deployment reference, used to trigger puppet apply on changes
177 value: {get_attr: [RHELRegistrationDeployment, deploy_stdout]}