Skip to content

Commit 4dab7d0

Browse files
committed
MAINT: Remove volume facts from play
We cannot rely on the OpenStack API to provide accurate information about where the device is mounted. This is due to a discrepancy between OpenStack and the OS of the VM. To work around this we will try the two most common devices, sdb and vdb. If both of these fail intervention will be required. A bonus to this is it removes the convoluted ansible fact solution previously used.
1 parent 2d45d9e commit 4dab7d0

File tree

5 files changed

+24
-21
lines changed

5 files changed

+24
-21
lines changed

chatops_deployment/ansible/deploy.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -20,3 +20,9 @@
2020
roles:
2121
- role: ssh_known_hosts
2222
tags: known_hosts
23+
24+
- name: Create certificates
25+
hosts: localhost
26+
roles:
27+
- role: ssl_certificates
28+
tags: ssl_certificates

chatops_deployment/ansible/roles/terraform/tasks/deploy.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -83,11 +83,3 @@
8383
force_init: true
8484
workspace: "{{ env }}"
8585
register: terraform_output
86-
87-
- name: Write ansible inventory file from Terraform outputs
88-
ansible.builtin.template:
89-
src: hosts.ini.j2
90-
dest: "{{ playbook_dir }}/hosts.ini"
91-
owner: "{{ ansible_env.USER }}"
92-
group: "{{ ansible_env.USER }}"
93-
mode: "0774"

chatops_deployment/ansible/roles/volume/tasks/main.yml

Lines changed: 18 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,23 @@
11
---
22
- name: Attach volume to stack host
3-
become: true
4-
ansible.posix.mount:
5-
boot: true
6-
path: /var/stack
7-
src: "{{ ansible_local.terraform.vars.stack_device }}"
8-
state: mounted
9-
fstype: ext4
3+
block:
4+
- name: Try sdb
5+
become: true
6+
ansible.posix.mount:
7+
boot: true
8+
path: /var/stack
9+
src: /dev/sdb
10+
state: mounted
11+
fstype: ext4
12+
rescue:
13+
- name: Try vdb
14+
become: true
15+
ansible.posix.mount:
16+
boot: true
17+
path: /var/stack
18+
src: /dev/vdb
19+
state: mounted
20+
fstype: ext4
1021

1122
- name: Set permissions
1223
become: true
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
output "stack_volume_device" {
2-
value = openstack_compute_volume_attach_v2.stack_volume.device
3-
}
Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +0,0 @@
1-
output "stack_volume_device" {
2-
value = module.compute.stack_volume_device
3-
}

0 commit comments

Comments
 (0)