Skip to content

Commit 3a7f53f

Browse files
committed
Automatically add libvirt host to trusted
1 parent a4e2af4 commit 3a7f53f

2 files changed

Lines changed: 16 additions & 10 deletions

File tree

examples/cluster.yaml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -21,9 +21,6 @@ inputs:
2121
disk_size:
2222
default: 80GB
2323

24-
agent_private_key:
25-
default: { get_secret: agent_private_key }
26-
2724
# cluster(kvm) settings
2825
cluster_user:
2926
type: string
@@ -151,7 +148,7 @@ node_templates:
151148
- path: /etc/cloudify/kvm.key
152149
owner: cfyuser:cfyuser
153150
permissions: '0400'
154-
content: { get_input: agent_private_key }
151+
content: { get_input: agent_key_private }
155152
- path: /etc/cloudify/kvm.key.pub
156153
owner: cfyuser:cfyuser
157154
permissions: '0400'
@@ -234,7 +231,7 @@ node_templates:
234231
use_public_ip: true
235232
agent_config:
236233
user: { get_input: agent_user }
237-
key: { get_input: agent_private_key }
234+
key: { get_input: agent_key_private }
238235
install_method: remote
239236
interfaces:
240237
cloudify.interfaces.lifecycle:
@@ -247,7 +244,7 @@ node_templates:
247244
terminal_auth: &terminal_auth
248245
user: { get_input: agent_user }
249246
ip: { get_attribute: [SELF, ip] }
250-
key_content: { get_input: agent_private_key }
247+
key_content: { get_input: agent_key_private }
251248
port: 22
252249
promt_check:
253250
- '$'
@@ -265,6 +262,15 @@ node_templates:
265262
- action: sudo usermod -a -G libvirt cfyuser
266263
- action: sudo usermod -a -G kvm cfyuser
267264
- action: sudo usermod -a -G qemu cfyuser
265+
# enable ssh connect
266+
- action: sudo mkdir -p /etc/cloudify/.ssh/
267+
# enable write for current user, will fix on next step
268+
- action: sudo chmod 777 -R /etc/cloudify/.ssh
269+
# dump ssh key to known_hsot
270+
- action: {concat:["sudo ssh-keyscan -H ", { get_input: cluster_host }, " >> /etc/cloudify/.ssh/known_hosts"]}
271+
- action: sudo chmod 700 /etc/cloudify/.ssh
272+
- action: sudo chmod 600 /etc/cloudify/.ssh/known_hosts
273+
- action: sudo chown cfyuser:cfyuser -R /etc/cloudify/.ssh
268274
# upload plugins
269275
- action: cfy profile use localhost -u admin -p admin -t default_tenant
270276
- action: cfy plugins bundle-upload

examples/vm_agent.yaml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,8 @@ inputs:
1818
disk_size:
1919
default: 24GB
2020

21-
agent_private_key:
22-
default: { get_secret: agent_private_key }
21+
agent_key_private:
22+
default: { get_secret: agent_key_private }
2323

2424
# cluster(kvm) settings
2525
cluster_user:
@@ -221,7 +221,7 @@ node_templates:
221221
use_public_ip: true
222222
agent_config:
223223
user: { get_input: agent_user }
224-
key: { get_input: agent_private_key }
224+
key: { get_input: agent_key_private }
225225
install_method: remote
226226
interfaces:
227227
cloudify.interfaces.lifecycle:
@@ -234,7 +234,7 @@ node_templates:
234234
terminal_auth: &terminal_auth
235235
user: { get_input: agent_user }
236236
ip: { get_attribute: [SELF, ip] }
237-
key_content: { get_input: agent_private_key }
237+
key_content: { get_input: agent_key_private }
238238
port: 22
239239
promt_check:
240240
- '$'

0 commit comments

Comments
 (0)