This repository has been archived by the owner on Nov 9, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 163
/
fabops.yaml
72 lines (60 loc) · 2.4 KB
/
fabops.yaml
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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
---
- name: Start fabric operations
hosts: minifab
gather_facts: no
connection: local
vars:
pjroot: "{{ playbook_dir }}"
vars_files:
- "./spec.yaml"
- "./playbooks/ops/opnames.yaml"
tasks:
- set_fact:
TARGET_ENV: "{{ TARGET_ENVIRONMENT }}"
allops: "{{ mode.split(',')|list }}"
status_flag: "Success"
current_location_hash: "{{ hostroot | hash('sha256') }}"
- set_fact:
CLINAME: "{{ (fabric.netname is defined) | ternary(fabric.netname, current_location_hash[:10]+'_cli') }}"
NETNAME: "{{ (fabric.netname is defined) | ternary(fabric.netname, current_location_hash[:10]+'_net') }}"
- name: Set endpoint address to first auto detected IP address
set_fact:
endpoint_address: "{{ ADDRS.split(',')[0] }}"
when: fabric.endpoint_address is undefined
- name: Set up the endpoint address when configured in spec.yaml
set_fact:
endpoint_address: "{{ fabric.endpoint_address }}"
when: fabric.endpoint_address is defined
- name: Remove approve and commit from the operation list if release is less than 2.0
set_fact:
allops: "{{ allops | difference(['ccapprove', 'cccommit']) }}"
OPNAMES: "{{ OPNAMES | combine({'ccinstantiate': 'cc instantiate'}) }}"
when: IMAGETAG is version('2.0', '<')
- name: Setup container_options for appending docker run command
set_fact:
container_options: "{{ ( fabric.container_options is defined ) | ternary(fabric.container_options, '') }}"
- meta: end_play
when: allops|length == 0
- set_fact:
msgops: "{{ (msgops|default([])) + [OPNAMES[item]] }}"
with_items: "{{ allops }}"
- name: "Preparing for the following operations:"
debug:
msg: "{{ msgops|join(', ') }}"
when: msgops|length > 1
tags: [print_action]
- name: "Process configuration"
include_tasks: "playbooks/common/config_apply.yaml"
- name: Check if external node endpoint exists
stat:
path: "{{ pjroot }}/vars/ext_node_vars.json"
register: exflag
- name: "Load external node vars"
include_vars: "{{ pjroot }}/vars/ext_node_vars.json"
when: exflag.stat.exists == true
- name: Do all the requested fabric operations
include_tasks: "playbooks/ops/opwrapper.yaml"
loop: "{{ allops }}"
loop_control:
loop_var: op
when: status_flag == "Success"