Skip to content

Commit 7e1d0a5

Browse files
authored
Push octavia nova/glance files into HOME (#1387)
/tmp is often restricted for certain file operations and generally globally readaable, installing SSH key and other artifacts should not be installed there. The new override octavia_tmp_dir defaults to `$HOME/octavia`
1 parent 63fbb80 commit 7e1d0a5

File tree

2 files changed

+11
-4
lines changed

2 files changed

+11
-4
lines changed

ansible/roles/octavia_preconf/defaults/main.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ amphora_image_url: "https://tarballs.opendev.org/openstack/octavia/test-images/t
3939
# these are the defaults for certs
4040
octavia_create_certs: true
4141
octavia_certs_dir: "{{ lookup('env', 'HOME') }}/octavia_certs"
42+
octavia_tmp_dir: "{{ lookup('env', 'HOME') }}/octavia"
4243
octavia_cert_key_bits: 4096
4344
octavia_key_type: "RSA"
4445
octavia_key_passwd: 'not-secure-passphrase'

ansible/roles/octavia_preconf/tasks/octavia_amphora_keypair_image_flavor.yml

Lines changed: 10 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,17 +4,23 @@
44
# optional; amphora image uploaded is suitable for
55
# test environments; the flavor specs are currently set
66
# to 2 vcpus, 1024 MB ram and 5 GB of disk
7+
- name: Create the base directory for octavia key/image
8+
file:
9+
path: "{{ octavia_tmp_dir }}"
10+
state: directory
11+
mode: '0700'
12+
713
- name: Create ssh keypair for amphorae
814
community.crypto.openssh_keypair:
9-
path: /tmp/amphora_ssh_key
15+
path: "{{ octavia_tmp_dir }}/amphora_ssh_key"
1016
size: 2048
1117
comment: "amphora ssh key"
1218
when: amphora_ssh_enabled
1319

1420
- name: Create ssh keypair in nova for amphora
1521
openstack.cloud.keypair:
1622
name: "{{ amphora_ssh_key_name }}"
17-
public_key: "{{ lookup('file', '/tmp/amphora_ssh_key.pub') }}"
23+
public_key: "{{ lookup('file', octavia_tmp_dir + '/amphora_ssh_key.pub') }}"
1824
state: present
1925
interface: public
2026
when: amphora_ssh_enabled
@@ -36,7 +42,7 @@
3642
- name: Get the image for amphora
3743
get_url:
3844
url: "{{ amphora_image_url }}"
39-
dest: /tmp/test-only-amphora-x64-haproxy-ubuntu-{{ amphora_image_version }}.qcow2
45+
dest: "{{ octavia_tmp_dir }}/test-only-amphora-x64-haproxy-ubuntu-{{ amphora_image_version }}.qcow2"
4046
register: download_amphora_image
4147
until: download_amphora_image is success
4248
retries: 5
@@ -46,7 +52,7 @@
4652
openstack.cloud.image:
4753
name: "{{ amphora_image_name }}"
4854
state: present
49-
filename: /tmp/test-only-amphora-x64-haproxy-ubuntu-{{ amphora_image_version }}.qcow2
55+
filename: "{{ octavia_tmp_dir }}/test-only-amphora-x64-haproxy-ubuntu-{{ amphora_image_version }}.qcow2"
5056
container_format: bare
5157
disk_format: qcow2
5258
visibility: private

0 commit comments

Comments
 (0)