File tree Expand file tree Collapse file tree 4 files changed +78
-82
lines changed Expand file tree Collapse file tree 4 files changed +78
-82
lines changed Original file line number Diff line number Diff line change @@ -22,6 +22,7 @@ resources:
22
22
- workflowtemplates/reclean-server.yaml
23
23
- workflowtemplates/openstack-oslo-event.yaml
24
24
- workflowtemplates/netapp-configure-net.yaml
25
+ - workflowtemplates/ansible-run.yaml
25
26
# Alert automation
26
27
- sensors/alertmanager-webhook-sensor.yaml
27
28
- eventsources/alertmanager-webhook-eventsource.yaml
Original file line number Diff line number Diff line change
1
+ ---
2
+ apiVersion : argoproj.io/v1alpha1
3
+ kind : WorkflowTemplate
4
+ metadata :
5
+ name : ansible-workflow-template
6
+ annotations :
7
+ workflows.argoproj.io/title : Run arbitrary ansible playbook from the undercloud-rackspace repo
8
+ workflows.argoproj.io/description : |
9
+ Defined in `workflows/argo-events/workflowtemplates/ansible-run.yaml`
10
+ spec :
11
+ serviceAccountName : workflow
12
+ templates :
13
+ - name : ansible-run
14
+ inputs :
15
+ parameters :
16
+ - name : playbook
17
+ default : " nonexistent.yaml"
18
+ - name : extra_vars
19
+ default : " var=default"
20
+ - name : inventory_file
21
+ default : inventory/in-cluster/01-nautobot.yaml
22
+ container :
23
+ image : ghcr.io/rss-engineering/undercloud-nautobot/ansible:latest
24
+ command : [ansible-playbook]
25
+ args :
26
+ - " {{ inputs.parameters.playbook }}"
27
+ - --extra-vars
28
+ - " {{ inputs.parameters.extra_vars }}"
29
+ - " -i"
30
+ - " {{ inputs.parameters.inventory_file }}"
31
+ - " -vvv"
32
+ env :
33
+ - name : NAUTOBOT_TOKEN
34
+ valueFrom :
35
+ secretKeyRef :
36
+ key : token
37
+ name : nautobot-token
38
+ envFrom :
39
+ - configMapRef :
40
+ name : cluster-metadata
41
+ optional : false
Original file line number Diff line number Diff line change @@ -99,45 +99,21 @@ spec:
99
99
print(str(uuid.UUID(project_id_without_dashes)))
100
100
- - name : ansible-on-server-create
101
101
when : " \" {{steps.oslo-events.outputs.parameters.storage}}\" == wanted"
102
- inline :
103
- container :
104
- image : ghcr.io/rss-engineering/undercloud-nautobot/ansible:latest
105
- command : [ansible-playbook]
106
- args :
107
- - " storage_on_server_create.yml"
108
- - --extra-vars
109
- - " project_id={{steps.convert-project-id.outputs.result}} device_id={{workflow.parameters.device_id}}"
110
- - " -i"
111
- - " inventory/in-cluster/01-nautobot.yaml"
112
- - " -vvv"
113
- env :
114
- - name : NAUTOBOT_TOKEN
115
- valueFrom :
116
- secretKeyRef :
117
- key : token
118
- name : nautobot-token
119
- envFrom :
120
- - configMapRef :
121
- name : cluster-metadata
122
- optional : false
102
+ templateRef :
103
+ name : ansible-workflow-template
104
+ template : ansible-run
105
+ arguments :
106
+ parameters :
107
+ - name : playbook
108
+ value : storage_on_server_create.yml
109
+ - name : extra_vars
110
+ value : project_id={{steps.convert-project-id.outputs.result}} device_id={{workflow.parameters.device_id}}
123
111
- - name : ansible-storage-update
124
112
when : " \" {{steps.oslo-events.outputs.parameters.storage}}\" == wanted"
125
- inline :
126
- container :
127
- image : ghcr.io/rss-engineering/undercloud-nautobot/ansible:latest
128
- command : [ansible-playbook]
129
- args :
130
- - " storage_update_switches.yml"
131
- - " -i"
132
- - " inventory/in-cluster/01-nautobot.yaml"
133
- - " -vvv"
134
- env :
135
- - name : NAUTOBOT_TOKEN
136
- valueFrom :
137
- secretKeyRef :
138
- key : token
139
- name : nautobot-token
140
- envFrom :
141
- - configMapRef :
142
- name : cluster-metadata
143
- optional : false
113
+ templateRef :
114
+ name : ansible-workflow-template
115
+ template : ansible-run
116
+ arguments :
117
+ parameters :
118
+ - name : playbook
119
+ value : storage_update_switches.yml
Original file line number Diff line number Diff line change @@ -97,50 +97,28 @@ spec:
97
97
98
98
- - name : ansible-create-project
99
99
when : " {{steps.oslo-events.outputs.parameters.svm_enabled}} == True"
100
- inline :
101
- container :
102
- image : ghcr.io/rss-engineering/undercloud-nautobot/ansible:latest
103
- command : [ansible-playbook]
104
- args :
105
- - " storage_on_create_project.yml"
106
- - --extra-vars
107
- - " project_id={{steps.convert-project-id.outputs.result}}"
108
- - " -i"
109
- - " inventory/in-cluster/01-nautobot.yaml"
110
- - " -vvv"
111
- env :
112
- - name : NAUTOBOT_TOKEN
113
- valueFrom :
114
- secretKeyRef :
115
- key : token
116
- name : nautobot-token
117
- envFrom :
118
- - configMapRef :
119
- name : cluster-metadata
120
- optional : false
100
+ templateRef :
101
+ name : ansible-workflow-template
102
+ template : ansible-run
103
+ arguments :
104
+ parameters :
105
+ - name : playbook
106
+ value : storage_on_create_project.yml
107
+ - name : extra_vars
108
+ value : " project_id={{steps.convert-project-id.outputs.result}}"
109
+
121
110
- - name : ansible-create-svm
122
111
when : " {{steps.oslo-events.outputs.parameters.svm_created}} == True"
123
- inline :
124
- container :
125
- image : ghcr.io/rss-engineering/undercloud-nautobot/ansible:latest
126
- command : [ansible-playbook]
127
- args :
128
- - " storage_on_svm_create.yml"
129
- - --extra-vars
130
- - " svm_name=os-{{workflow.parameters.project_id}} project_id={{steps.convert-project-id.outputs.result}}"
131
- - " -i"
132
- - " inventory/in-cluster/01-nautobot.yaml"
133
- - " -vvv"
134
- env :
135
- - name : NAUTOBOT_TOKEN
136
- valueFrom :
137
- secretKeyRef :
138
- key : token
139
- name : nautobot-token
140
- envFrom :
141
- - configMapRef :
142
- name : cluster-metadata
143
- optional : false
112
+ templateRef :
113
+ name : ansible-workflow-template
114
+ template : ansible-run
115
+ arguments :
116
+ parameters :
117
+ - name : playbook
118
+ value : storage_on_svm_create.yml
119
+ - name : extra_vars
120
+ value : svm_name=os-{{workflow.parameters.project_id}} project_id={{steps.convert-project-id.outputs.result}}
121
+
144
122
- - name : netapp-configure-net
145
123
when : " {{steps.oslo-events.outputs.parameters.svm_created}} == True"
146
124
templateRef :
You can’t perform that action at this time.
0 commit comments