Marcos Entenza
2020-02-16 3ec1481938fc048b65e968a9598997b8a01604c9
Add Satellite, SAP Software and more customization (#1155)

* Modify config with Satellite integration, Device Block for SAP Software and other minor changes

* Clean not required entries
6 files modified
212 ■■■■■ changed files
ansible/configs/sap-hana/README.adoc 14 ●●●● patch | view | raw | blame | history
ansible/configs/sap-hana/default_vars.yml 126 ●●●● patch | view | raw | blame | history
ansible/configs/sap-hana/files/cloud_providers/osp_cloud_template_master.j2 2 ●●● patch | view | raw | blame | history
ansible/configs/sap-hana/files/hosts_template.j2 11 ●●●●● patch | view | raw | blame | history
ansible/configs/sap-hana/requirements.yml 2 ●●● patch | view | raw | blame | history
ansible/configs/sap-hana/software.yml 57 ●●●●● patch | view | raw | blame | history
ansible/configs/sap-hana/README.adoc
@@ -1,8 +1,8 @@
== Overview
*SAP HANA Auto* _config_ will cover the Technical Enablement for 'RHEL for SAP Solutions' related trainning. This is the Techincal Enablement on how to insall SAP HANA on an standalone server using both Ansible and Ansible Tower
*SAP HANA* _config_ will cover the Technical Enablement for 'RHEL for SAP Solutions' related trainning. This is the Techincal Enablement on how to insall SAP HANA on an standalone server, covering automated installation using Ansible and Ansible Tower a well manual installation.
It makes an ideal base infrastructure to build on and can easily be extended via it's `env_vars.yml` to less or more machines and also to different operating system images.
It makes an ideal base infrastructure to build on and can easily be extended via it's `default_vars.yml` to less or more machines and also to different operating system images.
image::topology.png[width=100%]
@@ -26,13 +26,13 @@
For further information on customizing images consult the link:../../../docs/Creating_a_config.adoc[Creating a Config Guide]
== Deploying the SAP HANA Auto Config
== Deploying the SAP HANA Config
You can deploy this config by running the following command from the `ansible`
directory. You will have to provide credentials and adjust settings to your own
environment.
`ansible-playbook -e @configs/sap-hana-auto/sample_vars.yml main.yml`
`ansible-playbook -e @configs/sap-hana/sample_vars.yml main.yml`
Or ideally using an external not shared vars file where to pass OSP credentials and others
@@ -41,12 +41,12 @@
=== To Delete an environment
----
ansible-playbook -e @configs/sap-hana-auto/sample_vars.yml \
  configs/sap-hana-auto/destroy_env.yml
ansible-playbook -e @configs/sap-hana/sample_vars.yml \
  configs/sap-hana/destroy_env.yml
Or the custom variables file you used for the deployment:
ansible-playbook -e @my_secret_env_vars.yml \
  configs/sap-hana-auto/destroy_env.yml
  configs/sap-hana/destroy_env.yml
----
ansible/configs/sap-hana/default_vars.yml
@@ -1,44 +1,25 @@
### Vars that can be removed:
# use_satellite: true
# use_subscription_manager: false
# use_own_repos: false
## Subscription Settings
repo_method: satellite
satellite_org: Red_Hat_GPTE_Labs
satellite_activationkey: rhel8-summit
satellite_url: labsat.opentlc.com
use_content_view: false
#If using repo_method: satellite, you must set these values as well.
# satellite_url: satellite.example.com
# satellite_org: Sat_org_name
# satellite_activationkey: "rhel7basic"
# RHSM
# repo_method: rhn
# use_subscription_manager: true
# rhel_subscription_user: "xxxxxxxxxxxxx"
# rhel_subscription_pass: "xxxxxxxxxxx"
# rhsm_pool_ids:
#   - "xxxxxxxxxxxxxxxxxxxxxx"
#   - "xxxxxxxxxxxxxxxxxxxxxx"
# rhel_repos:
#    - "rhel-8-for-x86_64-baseos-rpms"
#    - "rhel-8-for-x86_64-appstream-rpms"
#    - "ansible-2-for-rhel-8-x86_64-rpms"
# rhel_repos:
#   - "rhel-7-server-rpms"
#   - "rhel-server-rhscl-7-rpms"
#   - "rhel-7-server-ansible-2.8-rpms"
###### VARIABLES YOU SHOULD CONFIGURE FOR YOUR DEPLOYEMNT
###### OR PASS as "-e" args to ansible-playbook command
rhel_repos:
   - "rhel-8-for-x86_64-baseos-rpms"
   - "rhel-8-for-x86_64-appstream-rpms"
   - "ansible-2-for-rhel-8-x86_64-rpms"
   - "rhel-8-for-x86_64-sap-solutions-rpms"
   - "rhel-8-for-x86_64-sap-netweaver-rpms"
### Common Host settings
# repo_method: file # Other Options are: file, satellite and rhn
install_ipa_client: false
install_student_user: false
# Do you want to run a full yum update
update_packages: false
## guid is the deployment unique identifier, it will be appended to all tags,
## files and anything that identifies this environment from another "just like it"
@@ -53,9 +34,6 @@
install_bastion: true
install_common: true
## SB Don't set software_to_deploy from here, always use extra vars (-e) or "none" will be used
#software_to_deploy:: none
### If you want a Key Pair name created and injected into the hosts,
# set `set_env_authorized_key` to true and set the keyname in `env_authorized_key`
@@ -69,53 +47,45 @@
# Is this running from Red Hat Ansible Tower
tower_run: false
## Networking (AWS)
## Networking
subdomain_base_short: "{{ guid }}"
subdomain_base_suffix: ".example.opentlc.com"
subdomain_base: "{{subdomain_base_short}}{{subdomain_base_suffix}}"
## Environment Sizing
## Environment Sizing and OS
bastion_instance_image: rhel-8.0-update-3
bastion_instance_type: "2-16"
bastion_instance_count: 1
rootfs_size_bastion: "{{ rootfs_size_bastion }}"
nfs_size_bastion: 100
hana_instance_image: rhel-8.0-update-3
hana_instance_type: "4-32"
support_instance_type: "{{ support_instance_type }}"
hana_instance_count: 1
rootfs_size_hana: "{{ rootfs_size_hana }}"
pv_size_hana: 200
hana_instance_image: "{{ hana_instance_image }}"
support_instance_image: "{{ support_instance_image }}"
s4hana_instance_image: rhel-8.0-update-3
s4hana_instance_type: "4-32"
s4hana_instance_count: 1
rootfs_size_s4hana: "{{ rootfs_size_s4hana }}"
pv_size_s4hana: 200
## Variables required when deploying Ansible Tower alongside the HANA and bastion instances
tower_instance_count: 0
tower_instance_image: "{{ tower_instance_image }}"
tower_instance_image: rhel8.1_01
tower_instance_type: "4-32"
tower_instance_count: "{{ tower_instance_count }}"
rootfs_size_tower: "{{ rootfs_size_tower }}"
# Instances images to use
#bastion_instance_image: xxxxxxxxxxxxxxxx
#hana_instance_image: xxxxxxxxxxxxx
#NFS Server variables
install_nfs: true
nfs_device: "/dev/vdb"
nfs_vg: "nfs"
nfs_export_path: "/srv/nfs"
nfs_shares:
  - "hana"
nfs_exports_config: "*(insecure,rw,root_squash,no_wdelay,sync)"
# SAP Software image and variables
sap_software_image: software-sap
sap_software_size: "{{ sap_software_size }}"
#Ansible Tower Variables
# ansible_tower:
#   admin_password: "xxxxxxxxxxxxxxx"
# ansible_tower_download_url: xxxxxxx
# ansible_tower_epel_download_url: xxxxx
ansible_tower_download_url: "https://releases.ansible.com/ansible-tower/setup-bundle/ansible-tower-setup-bundle-3.6.2-1.tar.gz"
ansible_tower_epel_download_url: "https://dl.fedoraproject.org/pub/epel/epel-release-latest-8.noarch.rpm"
# OSP Security Groups
security_groups:
  - name: HanaSG
    rules:
@@ -212,11 +182,10 @@
        value: "linux"
      - key: "instance_filter"
        value: "{{ env_type }}-{{ email }}"
      - key: ansible_python_interpreter
        value: /usr/libexec/platform-python
    rootfs_size: "50"
    softwarefs_size: "{{ sap_software_size }}"
    volumes:
      - volume_name: "bastion_nfs"
        volume_size: "{{ nfs_size_bastion }}"
    security_groups:
      - BastionSG
@@ -235,11 +204,38 @@
        value: "rhel"
      - key: "instance_filter"
        value: "{{ env_type }}-{{ email }}"
      - key: ansible_python_interpreter
        value: /usr/libexec/platform-python
    key_name: "{{key_name}}"
    rootfs_size: "100"
    volumes:
      - volume_name: "hana_pv"
        volume_size: "{{ pv_size_hana }}"
    security_groups:
      - HanaSG
  - name: "s4hana"
    count: "{{ s4hana_instance_count }}"
    public_dns: false
    dns_loadbalancer: false
    floating_ip: false
    image_id: "{{ s4hana_instance_image }}"
    flavor:
      osp: "{{ s4hana_instance_type }}"
    tags:
      - key: "AnsibleGroup"
        value: "s4hanas"
      - key: "ostype"
        value: "rhel"
      - key: "instance_filter"
        value: "{{ env_type }}-{{ email }}"
      - key: ansible_python_interpreter
        value: /usr/libexec/platform-python
    key_name: "{{key_name}}"
    rootfs_size: "100"
    volumes:
      - volume_name: "s4hana_pv"
        volume_size: "{{ pv_size_s4hana }}"
    security_groups:
      - HanaSG
@@ -258,6 +254,8 @@
        value: "rhel"
      - key: "instance_filter"
        value: "{{ env_type }}-{{ email }}"
      - key: ansible_python_interpreter
        value: /usr/libexec/platform-python
    key_name: "{{key_name}}"
    rootfs_size: "200"
    security_groups:
@@ -283,8 +281,6 @@
vpcid_cidr_block: "192.168.0.0/16"
vpcid_name_tag: "{{subdomain_base}}"
#dopt_domain_name: "{{ aws_region }}.compute.internal"
rtb_public_name_tag: "{{subdomain_base}}-public"
rtb_private_name_tag: "{{subdomain_base}}-private"
ansible/configs/sap-hana/files/cloud_providers/osp_cloud_template_master.j2
@@ -166,7 +166,7 @@
          volume_size: {{ instance['rootfs_size'] | default(osp_default_rootfs_size) }}
          boot_index: 0
        {% if iname == "bastion" %}
        - image: {{ instance.sofware_image_id | default("sap-software") }}
        - image: {{ instance.sofware_image_id | default("software-sap") }}
          delete_on_termination: true
          volume_size: {{ instance['softwarefs_size'] }}
          boot_index: -1
ansible/configs/sap-hana/files/hosts_template.j2
@@ -3,11 +3,22 @@
hana
{% endfor %}
[s4hanas]
{% for host in groups['s4hanas'] %}
hana
{% endfor %}
[hana:children]
hanas
[s4hana:children]
s4hanas
[sap:children]
hanas
s4hanas
[hana:vars]
timeout=60
ansible_become=yes
ansible/configs/sap-hana/requirements.yml
@@ -1,4 +1,4 @@
---
- src: https://github.com/redhat-cop/infra-ansible.git
  name: infra-ansible
  version: v1.0.13
  version: v1.0.14
ansible/configs/sap-hana/software.yml
@@ -7,14 +7,63 @@
    - debug:
        msg: "Software tasks Started"
- name: Install and configure NFS Server
- name: Ensure NFS Server is installed, SAP Software Device Mounted and Ansible Installed
  hosts: bastion
  become: True
  gather_facts: True
  roles:
    # Install and deloy NFS Server
    - { role: "host-ocp-nfs", when: install_nfs }
  tasks:
    - name: Ensure NFS directory exists
      file:
        path: "/nfs"
        state: directory
    - name: Mount up device by UUID
      mount:
        path: /nfs
        src: /dev/vdb
        fstype: xfs
        state: present
    - name: 'Ensure required packages are installed'
      package:
        name: '{{ item }}'
        state: installed
      with_items:
      - nfs-utils
      - firewalld
    - name: 'Ensure firewalld is running'
      service:
        name: firewalld
        state: started
        enabled: yes
    - name: 'Open Firewall for NFS use'
      firewalld:
        port: "{{ item }}"
        permanent: yes
        state: enabled
        immediate: yes
      with_items:
      - 111/tcp
      - 111/udp
      - 2049/tcp
      - 2049/udp
    - name: "Ensure export file contains the directory to be shared"
      lineinfile:
        path: /etc/exports
        state: present
        regexp: "^/nfs"
        line: "/nfs *(insecure,rw,root_squash,no_wdelay,sync)"
    - name: 'Ensure nfs-server is restarted and running'
      service:
        name: nfs-server
        state: restarted
        enabled: yes
    - name: Ensure Ansible is installed
      yum:
        name: ansible