|
| 1 | +--- |
| 2 | +# Copyright (c) 2024 Oracle and/or its affiliates. |
| 3 | +# This software is made available to you under the terms of the Universal Permissive License (UPL), Version 1.0. |
| 4 | +# The Universal Permissive License (UPL), Version 1.0 (see COPYING or https://oss.oracle.com/licenses/upl) |
| 5 | +# See LICENSE.TXT for details. |
| 6 | + |
| 7 | +- name: Set file_system mount target |
| 8 | + oracle.oci.oci_file_storage_mount_target: |
| 9 | + availability_domain: "{{ my_availability_domain }}" |
| 10 | + compartment_id: "{{ my_compartment_id }}" |
| 11 | + subnet_id: "{{ my_subnet_id }}" |
| 12 | + display_name: "mt-ocne" |
| 13 | + hostname_label: "ocne-fss" |
| 14 | + state: present |
| 15 | + register: result |
| 16 | + retries: 10 |
| 17 | + delay: 30 |
| 18 | + until: result is not failed |
| 19 | + |
| 20 | +- name: Print file_system mount target |
| 21 | + ansible.builtin.debug: |
| 22 | + var: result |
| 23 | + when: debug_enabled |
| 24 | + |
| 25 | +- name: Get file_system mount target facts |
| 26 | + ansible.builtin.set_fact: |
| 27 | + mount_target_id: "{{ result.mount_target.id }}" |
| 28 | + export_set_id: "{{ result.mount_target.export_set_id }}" |
| 29 | + mount_target_private_ip_id: "{{ result.mount_target.private_ip_ids[0] }}" |
| 30 | + |
| 31 | +- name: Get file_system mount target private ip facts |
| 32 | + oracle.oci.oci_network_private_ip_facts: |
| 33 | + id: "{{ mount_target_private_ip_id }}" |
| 34 | + register: result |
| 35 | + retries: 10 |
| 36 | + delay: 30 |
| 37 | + until: result is not failed |
| 38 | + |
| 39 | +- name: Set file_system mount target private ip |
| 40 | + ansible.builtin.set_fact: |
| 41 | + mount_target_ip_address: "{{ result.private_ips[0].ip_address }}" |
| 42 | + |
| 43 | +- name: Print file_system mount target private ip |
| 44 | + ansible.builtin.debug: |
| 45 | + msg: "Mount Target Ip Address: {{ mount_target_ip_address }}" |
| 46 | + when: debug_enabled |
| 47 | + |
| 48 | +- name: Set file_system |
| 49 | + oracle.oci.oci_file_storage_file_system: |
| 50 | + availability_domain: "{{ my_availability_domain }}" |
| 51 | + compartment_id: "{{ my_compartment_id }}" |
| 52 | + display_name: "fss-ocne" |
| 53 | + state: present |
| 54 | + register: result |
| 55 | + retries: 10 |
| 56 | + delay: 30 |
| 57 | + until: result is not failed |
| 58 | + |
| 59 | +- name: Get file_system id |
| 60 | + ansible.builtin.set_fact: |
| 61 | + file_system_id: "{{ result.file_system.id }}" |
| 62 | + |
| 63 | +- name: Set file_system export |
| 64 | + oracle.oci.oci_file_storage_export: |
| 65 | + export_set_id: "{{ export_set_id }}" |
| 66 | + file_system_id: "{{ file_system_id }}" |
| 67 | + export_options: |
| 68 | + - source: "0.0.0.0/0" |
| 69 | + require_privileged_source_port: false |
| 70 | + access: "READ_WRITE" |
| 71 | + identity_squash: "NONE" |
| 72 | + path: "/fss-ocne" |
| 73 | + state: present |
| 74 | + register: result |
| 75 | + retries: 10 |
| 76 | + delay: 30 |
| 77 | + until: result is not failed |
| 78 | + |
| 79 | +- name: Get file_system export id and path |
| 80 | + ansible.builtin.set_fact: |
| 81 | + export_id: "{{ result.export.id }}" |
| 82 | + export_path: "{{ result.export.path }}" |
| 83 | + |
| 84 | +- name: Set file_system vars file |
| 85 | + ansible.builtin.template: |
| 86 | + src: fss_vars.j2 |
| 87 | + dest: fss_vars.yml |
| 88 | + mode: "0664" |
0 commit comments