blob: a320e681e977af45c02d300b54ba1f8699109220 (
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
|
---
- name: Test if libvirt network for openshift already exists
command: "virsh -c {{ libvirt_uri }} net-info {{ libvirt_network }}"
register: net_info_result
changed_when: False
failed_when: "net_info_result.rc != 0 and 'error: Network not found:' not in net_info_result.stderr"
- name: Create a temp directory for the template xml file
command: "mktemp -d /tmp/openshift-ansible-XXXXXXX"
register: mktemp
when: net_info_result.rc == 1
- name: Create network xml file
template:
src: templates/network.xml
dest: "{{ mktemp.stdout }}/network.xml"
when: net_info_result.rc == 1
- name: Create libvirt network for openshift
command: "virsh -c {{ libvirt_uri }} net-create {{ mktemp.stdout }}/network.xml"
when: net_info_result.rc == 1
- name: Remove the temp directory
file:
path: "{{ mktemp.stdout }}"
state: absent
when: net_info_result.rc == 1
|