From 0d7645f1f41905c868527c3befb675154bfbaa36 Mon Sep 17 00:00:00 2001 From: Phil Date: Fri, 27 Nov 2026 19:05:35 -0700 Subject: [PATCH] oci.yml: pass credentials through a temporary OCI config file Co-Authored-By: Claude Opus 5.5 --- oci.yml | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/oci.yml b/oci.yml index 9b475bf..936a82a 100644 --- a/oci.yml +++ b/oci.yml @@ -20,12 +20,11 @@ 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_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 - api_user: "{{ vault_oci.user }}" - api_user_fingerprint: "{{ vault_oci.fingerprint }}" - api_user_key_file: "{{ oci_key_dir.path }}/key.pem" - tenancy: "{{ vault_oci.tenancy }}" - region: "{{ vault_oci.region }}" + config_file_location: "{{ oci_key_dir.path }}/config" + config_profile_name: DEFAULT tasks: - name: Stay inside the Always Free limits @@ -52,6 +51,18 @@ mode: '0600' 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 oracle.oci.oci_identity_compartment: <<: *oci_auth