aboutsummaryrefslogtreecommitdiffstats
path: root/extraconfig/tasks/ssh/host_public_key.yaml
blob: 02fdbf1c2acc50dee876abe0e9168e3e251ba7b8 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
heat_template_version: pike

description: >
  This is a template which will fetch the ssh host public key.

parameters:
  server:
    description: ID of the node to apply this config to
    type: string
  deployment_actions:
    default: ['CREATE', 'UPDATE']
    type: comma_delimited_list
    description: >
      List of stack actions that will trigger any deployments in this
      templates. The actions will be an empty list of the server is in the
      toplevel DeploymentServerBlacklist parameter's value.

resources:
  SshHostPubKeyConfig:
    type: OS::Heat::SoftwareConfig
    properties:
      group: script
      outputs:
      - name: rsa
      - name: ecdsa
      - name: ed25519
      config: |
        #!/bin/sh -x
        test -e '/etc/ssh/ssh_host_rsa_key.pub' && cat /etc/ssh/ssh_host_rsa_key.pub > $heat_outputs_path.rsa
        test -e '/etc/ssh/ssh_host_ecdsa_key.pub' && cat /etc/ssh/ssh_host_ecdsa_key.pub > $heat_outputs_path.ecdsa
        test -e '/etc/ssh/ssh_host_ed25519_key.pub' && cat /etc/ssh/ssh_host_ed25519_key.pub > $heat_outputs_path.ed25519

  SshHostPubKeyDeployment:
    type: OS::Heat::SoftwareDeployment
    properties:
      config: {get_resource: SshHostPubKeyConfig}
      server: {get_param: server}
      actions: {get_param: deployment_actions}


outputs:
  ecdsa:
    description: Host ssh public key (ecdsa)
    value:  {get_attr: [SshHostPubKeyDeployment, ecdsa]}
  rsa:
    description: Host ssh public key (rsa)
    value:  {get_attr: [SshHostPubKeyDeployment, rsa]}
  ed25519:
    description: Host ssh public key (ed25519)
    value:  {get_attr: [SshHostPubKeyDeployment, ed25519]}