-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcreate_headnode.yml
52 lines (45 loc) · 2.68 KB
/
create_headnode.yml
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
51
52
---
- hosts: localhost
gather_facts: false
vars_files:
- vars/main.yml
tasks:
- name: Upload image to OpenStack
openstack.cloud.image:
name: "{{ image_name }}"
filename: "{{ image_file }}"
disk_format: qcow2
container_format: bare
state: present
- name: Launch cluster head node instance
openstack.cloud.server:
name: "{{ head_node_name }}"
image: "{{ image_name }}"
flavor: "{{ head_node_flavor }}"
key_name: "{{ keypair_name }}"
network: "{{ cluster_network_name }}"
auto_ip: false
security_groups: "{{ cluster_security_group }}"
state: present
userdata: |
#cloud-config
packages:
- python3
package_upgrade: true
runcmd:
- echo "CRYPTO_POLICY='[email protected],[email protected],aes256-ctr [email protected],[email protected],[email protected],[email protected],hmac-sha2-256,hmac-sha2-512 -oGSSAPIKeyExchange=no -oKexAlgorithms=curve25519-sha256,[email protected],ecdh-sha2-nistp256,ecdh-sha2-nistp384,ecdh-sha2-nistp521,diffie-hellman-group-exchange-sha256,diffie-hellman-group16-sha512,diffie-hellman-group18-sha512 -oHostKeyAlgorithms=rsa-sha2-256,[email protected],ecdsa-sha2-nistp256,[email protected],ecdsa-sha2-nistp384,[email protected],rsa-sha2-512,[email protected],ecdsa-sha2-nistp521,[email protected],ssh-ed25519,[email protected] -oPubkeyAcceptedKeyTypes=rsa-sha2-256,[email protected],ecdsa-sha2-nistp256,[email protected],ecdsa-sha2-nistp384,[email protected],rsa-sha2-512,[email protected],ecdsa-sha2-nistp521,[email protected],ssh-ed25519,[email protected] -oCASignatureAlgorithms=rsa-sha2-256,ecdsa-sha2-nistp256,ecdsa-sha2-nistp384,rsa-sha2-512,ecdsa-sha2-nistp521,ssh-ed25519'" >>/etc/sysconfig/sshd
- systemctl restart sshd
- name: Add head node to inventory
import_tasks: tasks/add_headnode_inventory.yml
- debug:
msg: "{{ cluster_name }} head node is launched at {{ hostvars['localhost'].headnode.openstack_servers[0].private_v4 }}"
- hosts: headnode
gather_facts: false
vars_files:
- ./vars/main.yml
tasks:
- name: wait for head node to boot and become reachable
wait_for_connection:
delay: 5
- debug:
msg: "{{ cluster_name }} head node is up at {{ hostvars['localhost'].headnode.openstack_servers[0].private_v4 }}."