Skip to content

Commit

Permalink
ncr: TM-534: bip fixes v2 (#1026)
Browse files Browse the repository at this point in the history
* yum update test

* test

* fix

* update bash profile

* fix

* don't rename hostname

* fix

* fix

* Commit changes made by code formatters

---------

Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
  • Loading branch information
drobinson-moj and github-actions[bot] authored Oct 7, 2024
1 parent f705076 commit c7c4fa3
Show file tree
Hide file tree
Showing 10 changed files with 27 additions and 8 deletions.
7 changes: 5 additions & 2 deletions ansible/group_vars/server_type_base_rhel85.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,18 @@ ansible_python_interpreter: python3.9
server_type_roles_list:
- autoscale-group-hooks
- get-ec2-facts
- packages
- sshd-config
- users-and-groups
- set-ec2-hostname
- domain-search
# - set-ec2-hostname
# - domain-search
- ansible-script
- time
- python-ssm-configure
- autoscale-group-hooks-state

packages_yum_update_on_build: []

collectd_monitored_services_servertype:
- metric_name: service_status_os
metric_dimension: chronyd
Expand Down
3 changes: 3 additions & 0 deletions ansible/group_vars/server_type_ncr_bip_app.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ users_and_groups_system:
- dba
- sapsys

set_ec2_hostname_mode: "short" # don't rename to tags.Name

server_type_roles_list:
- ansible-requirements
- sshd-config
Expand Down Expand Up @@ -42,6 +44,7 @@ server_type_roles_list:

roles_list: "{{ (ami_roles_list | default([]) | difference(server_type_roles_list | default([]))) + (server_type_roles_list | default([])) }}"

packages_yum_update_on_build: []
packages_yum_install:
- bind-utils
- nano
Expand Down
3 changes: 3 additions & 0 deletions ansible/group_vars/server_type_ncr_bip_cms.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ users_and_groups_system:
- dba
- sapsys

set_ec2_hostname_mode: "short" # don't rename to tags.Name

server_type_roles_list:
- ansible-requirements
- sshd-config
Expand Down Expand Up @@ -42,6 +44,7 @@ server_type_roles_list:

roles_list: "{{ (ami_roles_list | default([]) | difference(server_type_roles_list | default([]))) + (server_type_roles_list | default([])) }}"

packages_yum_update_on_build: []
packages_yum_install:
- bind-utils
- nano
Expand Down
3 changes: 3 additions & 0 deletions ansible/group_vars/server_type_ncr_web.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ users_and_groups_system:
- dba
- sapsys

set_ec2_hostname_mode: "short" # don't rename to tags.Name

server_type_roles_list:
- ansible-requirements
- sshd-config
Expand Down Expand Up @@ -40,6 +42,7 @@ server_type_roles_list:

roles_list: "{{ (ami_roles_list | default([]) | difference(server_type_roles_list | default([]))) + (server_type_roles_list | default([])) }}"

packages_yum_update_on_build: []
packages_yum_install:
- bind-utils
- nano
Expand Down
3 changes: 3 additions & 0 deletions ansible/group_vars/server_type_ncr_webadmin.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ users_and_groups_system:
- dba
- sapsys

set_ec2_hostname_mode: "short" # don't rename to tags.Name

server_type_roles_list:
- ansible-requirements
- sshd-config
Expand Down Expand Up @@ -40,6 +42,7 @@ server_type_roles_list:

roles_list: "{{ (ami_roles_list | default([]) | difference(server_type_roles_list | default([]))) + (server_type_roles_list | default([])) }}"

packages_yum_update_on_build: []
packages_yum_install:
- bind-utils
- nano
Expand Down
4 changes: 2 additions & 2 deletions ansible/roles/ncr-bip/defaults/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ sap_bip_auditing_db_user: "{{ sap_bip_db_conf.auditing_db_user }}"
sap_bip_cms_db_server: "{{ sap_bip_db_conf.cms_db_server }}"
sap_bip_cms_db_user: "{{ sap_bip_db_conf.cms_db_user }}"
sap_bip_cms_db_reset: 1
sap_bip_sia_name_cms: "{{ ansible_ec2_hostname.split('.')[0] | replace('-','') }}"
sap_bip_sia_name_app: "{{ ansible_ec2_hostname.split('.')[0] | replace('-','') }}"
sap_bip_sia_name_cms: "{{ ec2.tags.Name | replace('-','') }}"
sap_bip_sia_name_app: "{{ ec2.tags.Name | replace('-','') }}"

# set in group vars, otherwise response.cms.ini or response.app.ini is used depending on whether first install
# sap_bip_responsefile:
Expand Down
2 changes: 1 addition & 1 deletion ansible/roles/ncr-bip/tasks/update_secrets.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
vars:
secretsmanager_passwords:
config:
secret: "/ec2/ncr-bip/{{ ncr_environment }}/config"
secret: "{{ sap_bip_secretsmanager_passwords.config.secret }}"
users:
- cms_primary_hostname: "{{ sap_bip_cms_primary_hostname }}"
- cms_hosts: "{{ sap_bip_cms_hosts }}"
Expand Down
1 change: 1 addition & 0 deletions ansible/roles/ncr-bip/templates/home/bobj/.bash_profile
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ fi
# User specific environment and startup programs

export EDITOR=vi
export PS1="[\u@\h {{ ec2.tags['Name'] }} \W]\$ "

# Oracle setup
export ORACLE_HOME={{ oracle_home }}
Expand Down
1 change: 1 addition & 0 deletions ansible/roles/set-ec2-hostname/defaults/main.yml
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
---
# dns_zone_internal: set in environment specific group_vars
set_ec2_hostname_mode: "auto" # or tags.Name or short
8 changes: 5 additions & 3 deletions ansible/roles/set-ec2-hostname/tasks/set-ec2-hostname.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,15 @@
set_fact:
ec2_hostname_fqdn: "{{ ec2.tags.Name }}.{{ dns_zone_internal }}"
ec2_hostname_short: "{{ ec2.tags.Name }}"
when: ansible_ec2_autoscaling_target_lifecycle_state is not defined
when:
- set_ec2_hostname_mode == "tags.Name" or (set_ec2_hostname_mode == "auto" and ansible_ec2_autoscaling_target_lifecycle_state is not defined)

- name: Set hostname to the dns name
set_fact:
ec2_hostname_fqdn: "{{ ansible_ec2_hostname }}"
ec2_hostname_short: "{{ ansible_ec2_hostname.split('.')[0] }}"
when: ansible_ec2_autoscaling_target_lifecycle_state is defined
when:
- set_ec2_hostname_mode == "short" or (set_ec2_hostname_mode == "auto" and ansible_ec2_autoscaling_target_lifecycle_state is defined)

- name: Configure /etc/hosts
ansible.builtin.template:
Expand All @@ -45,7 +47,7 @@
- name: Get hostname RHEL6
ansible.builtin.shell: |
hostname
check_mode: no
check_mode: false
changed_when: false
register: rhel6_hostname
when: ansible_distribution_major_version == '6'
Expand Down

0 comments on commit c7c4fa3

Please sign in to comment.