File tree Expand file tree Collapse file tree 4 files changed +549
-1
lines changed Expand file tree Collapse file tree 4 files changed +549
-1
lines changed Original file line number Diff line number Diff line change 112
112
ansible_host : " {{ instance_public_ip }}"
113
113
ansible_port : 22
114
114
instance_ocid : " {{ instance_id }}"
115
+
116
+ - name : Create host ini file
117
+ ansible.builtin.lineinfile :
118
+ path : hosts
119
+ regexp : ' ^\[{{ host_group }}'
120
+ line : " [{{ host_group }}]"
121
+ create : true
122
+ mode : " 0664"
123
+ delegate_to : localhost
124
+ loop :
125
+ - control
126
+ - execution
127
+ - db
128
+ loop_control :
129
+ loop_var : host_group
130
+
131
+ - name : Add host to ini host file
132
+ ansible.builtin.lineinfile :
133
+ path : hosts
134
+ regexp : ' ^{{ instance_name }}'
135
+ line : >-
136
+ {{ instance_name }}
137
+ ansible_host={{ instance_ansible_host }}
138
+ ansible_user={{ instance_ansible_user }}
139
+ ansible_private_key_file={{ instance_ansible_private_key_file }}
140
+ ansible_ssh_common_args={{ instance_ansible_ssh_common_args | quote }}
141
+ insertafter : ' ^\[{{ item.value.type }}\]$'
142
+ create : true
143
+ mode : " 664"
144
+ delegate_to : localhost
145
+ vars :
146
+ instance_name : " {{ instance_display_name }}"
147
+ instance_ansible_user : opc
148
+ instance_ansible_private_key_file : " {{ lookup('env', 'HOME') + '/.ssh/' + private_key }}"
149
+ instance_ansible_ssh_common_args : " -o StrictHostKeyChecking=no"
150
+ instance_ansible_host : " {{ instance_public_ip }}"
151
+ instance_ansible_port : 22
You can’t perform that action at this time.
0 commit comments