From bef8412e26dae15bfefd61a5c7ad8a2a3955ff48 Mon Sep 17 00:00:00 2001 From: Bill Buchan Date: Thu, 7 Mar 2024 12:40:57 +0000 Subject: [PATCH] Avoid FQDN for OEM Hosts --- .../oracle-oem-agent-setup/tasks/agent_target_promote.yml | 1 + .../tasks/oms_upgrade_agentpatcher.yml | 2 +- .../roles/oracle-oem-agent-setup/templates/add_targets.sh.j2 | 5 +++++ 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/ansible/roles/oracle-oem-agent-setup/tasks/agent_target_promote.yml b/ansible/roles/oracle-oem-agent-setup/tasks/agent_target_promote.yml index 5e127add0..261146672 100644 --- a/ansible/roles/oracle-oem-agent-setup/tasks/agent_target_promote.yml +++ b/ansible/roles/oracle-oem-agent-setup/tasks/agent_target_promote.yml @@ -65,6 +65,7 @@ loop: - emcli_setup.sh - add_targets.sh + tags: clean_up # block become: true diff --git a/ansible/roles/oracle-oem-agent-setup/tasks/oms_upgrade_agentpatcher.yml b/ansible/roles/oracle-oem-agent-setup/tasks/oms_upgrade_agentpatcher.yml index f66c49369..a698fce5d 100644 --- a/ansible/roles/oracle-oem-agent-setup/tasks/oms_upgrade_agentpatcher.yml +++ b/ansible/roles/oracle-oem-agent-setup/tasks/oms_upgrade_agentpatcher.yml @@ -17,7 +17,7 @@ register: agentpatcher_directory - name: Backup Old AgentPatcher - ansible.builtin.shell: mv {{ agent_home }}/AgentPatcher {{ agent_home }}/AgentPatcher_PREV + ansible.builtin.shell: mv {{ agent_home }}/AgentPatcher {{ agent_home }}/AgentPatcher_PREV.$(date +%Y%m%d%H%M) when: agentpatcher_directory.stat.exists and agentpatcher_directory.stat.isdir - name: Unzip OMS AgentPatcher diff --git a/ansible/roles/oracle-oem-agent-setup/templates/add_targets.sh.j2 b/ansible/roles/oracle-oem-agent-setup/templates/add_targets.sh.j2 index 65ff7b5d1..221528b32 100644 --- a/ansible/roles/oracle-oem-agent-setup/templates/add_targets.sh.j2 +++ b/ansible/roles/oracle-oem-agent-setup/templates/add_targets.sh.j2 @@ -8,6 +8,11 @@ HOST_FQDN_NAME=$(hostname --fqdn) # For delius hosts, we cannot use the hostname to determine the lifecycle status, so we use the tags instead APPLICATION="{{ ec2.tags['application'] }}" + +# For OEM hosts we do not use the FQDN for the targets +if [[ "${APPLICATION}" == "hmpps-oem" ]]; then + HOST_FQDN_NAME=${HOSTNAME} +fi if [[ "${APPLICATION}" == "delius" ]]; then LIFECYCLE_STATUS=$(echo {{ ec2.tags['environment-name'].split('-')[-1] }}) # First character must be made uppercase