ansible/playbooks/manual/gdpr/sar_openshift.yml
Ryan Lerch 3c41882bb0 ansiblelint fixes - fqcn[action-core] - shell to ansible.builtin.shell
Replaces references to shell: with ansible.builtin.shell

Signed-off-by: Ryan Lerch <rlerch@redhat.com>
2025-01-15 11:29:10 +10:00

16 lines
817 B
YAML

# Retrieve GDPR data from single openshift app.
# Get the correct pod
---
- name: Retrieve the id of the running container/pod
ansible.builtin.shell: "oc get -n {{ item.value.openshift_namespace }} -o name -l app={{ item.value.openshift_pod }} pods | cut -f 2 -d '/'"
register: pod_id
# Run the SAR script
- name: Run oc exec in container to extract the data
ansible.builtin.command: "oc -n {{ item.value.openshift_namespace }} rsh {{ pod_id.stdout }} bash -c 'SAR_USERNAME={{ sar_fas_user }} SAR_EMAIL={{ sar_email }} {{ item.value.sar_script }}'"
register: sar_data
# Store the result on disk
- name: Copy the output data locally
ansible.builtin.copy:
content: "{{ sar_data['stdout'] }}"
dest: "{{ hostvars['localhost']['sar_tmp_dir'] }}/{{ item.value.sar_output_file }}"
delegate_to: localhost