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.
63 default: ['CREATE', 'UPDATE']
64 type: comma_delimited_list
66 List of stack actions that will trigger any deployments in this
67 templates. The actions will be an empty list of the server is in the
68 toplevel DeploymentServerBlacklist parameter's value.
71 deployment_actions_empty:
73 - {get_param: deployment_actions}
79 type: OS::Heat::SoftwareConfig
83 - name: REG_ACTIVATION_KEY
84 - name: REG_AUTO_ATTACH
86 - name: REG_ENVIRONMENT
88 - name: REG_MACHINE_NAME
95 - name: REG_SERVER_URL
96 - name: REG_SERVICE_LEVEL
101 - name: REG_HTTP_PROXY_HOST
102 - name: REG_HTTP_PROXY_PORT
103 - name: REG_HTTP_PROXY_USERNAME
104 - name: REG_HTTP_PROXY_PASSWORD
105 config: {get_file: scripts/rhel-registration}
107 RHELRegistrationDeployment:
108 type: OS::Heat::SoftwareDeployment
110 name: RHELRegistrationDeployment
111 server: {get_param: server}
112 config: {get_resource: RHELRegistration}
113 actions: ['CREATE'] # Only do this on CREATE
115 REG_ACTIVATION_KEY: {get_param: rhel_reg_activation_key}
116 REG_AUTO_ATTACH: {get_param: rhel_reg_auto_attach}
117 REG_BASE_URL: {get_param: rhel_reg_base_url}
118 REG_ENVIRONMENT: {get_param: rhel_reg_environment}
119 REG_FORCE: {get_param: rhel_reg_force}
120 REG_MACHINE_NAME: {get_param: rhel_reg_machine_name}
121 REG_ORG: {get_param: rhel_reg_org}
122 REG_PASSWORD: {get_param: rhel_reg_password}
123 REG_POOL_ID: {get_param: rhel_reg_pool_id}
124 REG_RELEASE: {get_param: rhel_reg_release}
125 REG_REPOS: {get_param: rhel_reg_repos}
126 REG_SAT_URL: {get_param: rhel_reg_sat_url}
127 REG_SERVER_URL: {get_param: rhel_reg_server_url}
128 REG_SERVICE_LEVEL: {get_param: rhel_reg_service_level}
129 REG_USER: {get_param: rhel_reg_user}
130 REG_TYPE: {get_param: rhel_reg_type}
131 REG_METHOD: {get_param: rhel_reg_method}
132 REG_SAT_REPO: {get_param: rhel_reg_sat_repo}
133 REG_HTTP_PROXY_HOST: {get_param: rhel_reg_http_proxy_host}
134 REG_HTTP_PROXY_PORT: {get_param: rhel_reg_http_proxy_port}
135 REG_HTTP_PROXY_USERNAME: {get_param: rhel_reg_http_proxy_username}
136 REG_HTTP_PROXY_PASSWORD: {get_param: rhel_reg_http_proxy_password}
139 type: OS::Heat::SoftwareConfig
142 config: {get_file: scripts/rhel-unregistration}
146 RHELUnregistrationDeployment:
147 type: OS::Heat::SoftwareDeployment
149 name: RHELUnregistrationDeployment
150 server: {get_param: server}
151 config: {get_resource: RHELUnregistration}
154 - deployment_actions_empty
156 - ['DELETE'] # Only do this on DELETE
158 REG_METHOD: {get_param: rhel_reg_method}
160 YumUpdateConfigurationAfterRHELRegistration:
161 type: OS::Heat::SoftwareConfig
167 num_updates=$(yum list -q updates | wc -l)
168 if [ "$num_updates" -eq "0" ]; then
169 echo "No packages require updating"
172 full_command="yum -q -y update"
173 echo "Running: $full_command"
174 result=$($full_command)
177 echo "yum return code: $return_code"
180 UpdateDeploymentAfterRHELRegistration:
181 type: OS::Heat::SoftwareDeployment
182 depends_on: RHELRegistrationDeployment
184 update_requested: {get_param: UpdateOnRHELRegistration}
186 name: UpdateDeploymentAfterRHELRegistration
187 config: {get_resource: YumUpdateConfigurationAfterRHELRegistration}
188 server: {get_param: server}
191 - deployment_actions_empty
193 - ['CREATE'] # Only do this on CREATE
197 description: Deployment reference, used to trigger puppet apply on changes
198 value: {get_attr: [RHELRegistrationDeployment, deploy_stdout]}