oci.yml: pass credentials through a temporary OCI config file

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
PhilandClaude Opus 5.5 committed 2026-11-27 19:05:35 -07:00
1 parent 629abc0a96
commit 0d7645f1f4
1 file changed
+16 -5
+16 -5
View File
@@ -20,12 +20,11 @@
oci_storage_budget_gbs: 100 # of the tenancy's 200 GB; the rest stays free oci_storage_budget_gbs: 100 # of the tenancy's 200 GB; the rest stays free
oci_ad_index: 1 # retry on another AD with -e oci_ad_index=2 oci_ad_index: 1 # retry on another AD with -e oci_ad_index=2
oci_vcn_cidr: 10.40.0.0/24 oci_vcn_cidr: 10.40.0.0/24
# The modules need an OCI config file; it's written to a private temp
# dir from vault_oci and removed at the end.
oci_auth: &oci_auth oci_auth: &oci_auth
api_user: "{{ vault_oci.user }}" config_file_location: "{{ oci_key_dir.path }}/config"
api_user_fingerprint: "{{ vault_oci.fingerprint }}" config_profile_name: DEFAULT
api_user_key_file: "{{ oci_key_dir.path }}/key.pem"
tenancy: "{{ vault_oci.tenancy }}"
region: "{{ vault_oci.region }}"
tasks: tasks:
- name: Stay inside the Always Free limits - name: Stay inside the Always Free limits
@@ -52,6 +51,18 @@
mode: '0600' mode: '0600'
no_log: true no_log: true
- name: Write the OCI config
ansible.builtin.copy:
content: |
[DEFAULT]
user={{ vault_oci.user }}
fingerprint={{ vault_oci.fingerprint }}
tenancy={{ vault_oci.tenancy }}
region={{ vault_oci.region }}
key_file={{ oci_key_dir.path }}/key.pem
dest: "{{ oci_key_dir.path }}/config"
mode: '0600'
- name: Compartment - name: Compartment
oracle.oci.oci_identity_compartment: oracle.oci.oci_identity_compartment:
<<: *oci_auth <<: *oci_auth