sborenst
2017-10-27 a081aedd4820e8b3cf8cdd03d492f5006b1b16d9
added local tested ocp-demo-lab  with new ec2 method
2 files deleted
5 files modified
762 ■■■■■ changed files
ansible/configs/ocp-demo-lab/README.adoc 16 ●●●● patch | view | raw | blame | history
ansible/configs/ocp-demo-lab/env_vars.yml 5 ●●●●● patch | view | raw | blame | history
ansible/configs/ocp-demo-lab/files/ec2_internal_dns.json.j2.not_required_any_more 63 ●●●●● patch | view | raw | blame | history
ansible/configs/ocp-demo-lab/files/env_infra_template.j2 631 ●●●●● patch | view | raw | blame | history
ansible/configs/ocp-demo-lab/files/hosts_template.j2 24 ●●●● patch | view | raw | blame | history
ansible/configs/ocp-demo-lab/post_software.yml 16 ●●●●● patch | view | raw | blame | history
ansible/configs/ocp-demo-lab/pre_software.yml 7 ●●●●● patch | view | raw | blame | history
ansible/configs/ocp-demo-lab/README.adoc
@@ -50,29 +50,29 @@
----
# Set the your environment variables (this is optional, but makes life easy)
REGION=us-east-1
REGION=ap-southeast-2
KEYNAME=ocpkey
GUID=testdemolab2
ENVTYPE="ocp-demo-lab"
CLOUDPROVIDER=ec2
HOSTZONEID='Z3IHLWJZOU9SRT'
REPO_PATH='https://admin.example.com/repos/ocp/3.5/'
REPO_PATH='https://admin.example.com/repos/ocp/3.6/'
BASESUFFIX='.example.opentlc.com'
IPAPASS=aaaaaa
REPO_VERSION=3.5
REPO_VERSION=3.6
NODE_COUNT=2
## For a HA environment that is not installed with OpenShift
time ansible-playbook -i ./inventory/ ./main.yml \
       -e "osrelease=3.5.5.8" -e "repo_version=${REPO_VERSION}" -e "docker_version=1.12.6" \
time ansible-playbook ./main.yml \
       -e "osrelease=3.6.173.0.21" -e "repo_version=${REPO_VERSION}" -e "docker_version=1.12.6" \
       -e "guid=${GUID}" -e "env_type=${ENVTYPE}" -e "cloud_provider=${CLOUDPROVIDER}" \
       -e "aws_region=${REGION}"  -e "HostedZoneId=${HOSTZONEID}" -e "key_name=${KEYNAME}" \
       -e "subdomain_base_suffix=${BASESUFFIX}"  -e "install_idm=htpasswd" \
    -e "email=name@example.com" \
    -e "email=name@example.com"   -e "ANSIBLE_REPO_PATH=${DEPLOYER_REPO_PATH}" \
       -e "node_instance_count=${NODE_COUNT}" -e "infranode_instance_count=1" -e "master_instance_count=1" \
       -e "software_to_deploy=none"  -e "own_repo_path=${REPO_PATH}" -e "ipa_host_password=${IPAPASS}" \
       -e "tower_run=false"
       -e "software_to_deploy=openshift"  -e "own_repo_path=${REPO_PATH}" -e "ipa_host_password=${IPAPASS}" \
       -e "tower_run=false" -e"install_ipa_client=false"
. To Delete an environment
----
ansible/configs/ocp-demo-lab/env_vars.yml
@@ -7,10 +7,9 @@
###### VARIABLES YOU SHOULD CONFIGURE FOR YOUR DEPLOYEMNT
###### OR PASS as "-e" args to ansible-playbook command
install_ipa_client: false
deploy_local_ssh_config_location: "{{ ANSIBLE_REPO_PATH }}/workdir"
all: "{{ ('tag_Project_' ~ env_type ~ '_' ~ guid) | replace('-', '_') }}"
repo_method: "file"
tower_run: false
### Route 53 Zone ID (AWS)
HostedZoneId: ''
ansible/configs/ocp-demo-lab/files/ec2_internal_dns.json.j2.not_required_any_more
File was deleted
ansible/configs/ocp-demo-lab/files/env_infra_template.j2
File was deleted
ansible/configs/ocp-demo-lab/files/hosts_template.j2
@@ -13,7 +13,7 @@
###########################################################################
openshift_metrics_image_version=v{{ repo_version }}
#openshift_image_tag=v{{ repo_version }}
openshift_release={{ osrelease }}
#openshift_release={{ osrelease }}
#docker_version="{{docker_version}}"
deployment_type=openshift-enterprise
containerized=false
@@ -167,33 +167,33 @@
nfs
[masters]
{% for host in groups[('tag_' + env_type + '-' + guid + '_master') | replace('-', '_') ] %}
master{{loop.index}}.{{chomped_zone_internal_dns}}  host_zone={{hostvars[host]['ec2_placement']}}
{% for host in groups['masters'] %}
master{{loop.index}}.{{chomped_zone_internal_dns}}  host_zone={{hostvars[host]['placement']}}
{% endfor %}
[etcd]
{% for host in groups[('tag_' + env_type + '-' + guid + '_master') | replace('-', '_') ] %}
master{{loop.index}}.{{chomped_zone_internal_dns}}  host_zone={{hostvars[host]['ec2_placement']}}
{% for host in groups['masters'] %}
master{{loop.index}}.{{chomped_zone_internal_dns}}  host_zone={{hostvars[host]['placement']}}
{% endfor %}
[nodes]
## These are the masters
{% for host in groups[('tag_' + env_type + '-' + guid + '_master') | replace('-', '_') ] %}
master{{loop.index}}.{{chomped_zone_internal_dns}} openshift_hostname=master{{loop.index}}.{{chomped_zone_internal_dns}}   ansible_ssh_user={{remote_user}} ansible_ssh_private_key_file=~/.ssh/{{key_name}}.pem openshift_node_labels="{'logging':'true','openshift_schedulable':'False','cluster': '{{guid}}', 'zone': '{{hostvars[host]['ec2_placement']}}'}"
{% for host in groups['masters'] %}
master{{loop.index}}.{{chomped_zone_internal_dns}} openshift_hostname=master{{loop.index}}.{{chomped_zone_internal_dns}}   ansible_ssh_user={{remote_user}} ansible_ssh_private_key_file=~/.ssh/{{key_name}}.pem openshift_node_labels="{'logging':'true','openshift_schedulable':'False','cluster': '{{guid}}', 'zone': '{{hostvars[host]['placement']}}'}"
{% endfor %}
## These are infranodes
{% for host in groups[('tag_' + env_type + '-' + guid + '_infranode') | replace('-', '_') ] %}
infranode{{loop.index}}.{{chomped_zone_internal_dns}} openshift_hostname=infranode{{loop.index}}.{{chomped_zone_internal_dns}} ansible_ssh_user={{remote_user}} ansible_ssh_private_key_file=~/.ssh/{{key_name}}.pem openshift_node_labels="{'logging':'true','cluster': '{{guid}}', 'env':'infra', 'zone': '{{hostvars[host]['ec2_placement']}}'}"
{% for host in groups['infranodes'] %}
infranode{{loop.index}}.{{chomped_zone_internal_dns}} openshift_hostname=infranode{{loop.index}}.{{chomped_zone_internal_dns}} ansible_ssh_user={{remote_user}} ansible_ssh_private_key_file=~/.ssh/{{key_name}}.pem openshift_node_labels="{'logging':'true','cluster': '{{guid}}', 'env':'infra', 'zone': '{{hostvars[host]['placement']}}'}"
{% endfor %}
## These are regular nodes
{% for host in groups[('tag_' + env_type + '-' + guid + '_node') | replace('-', '_') ] %}
node{{loop.index}}.{{chomped_zone_internal_dns}} openshift_hostname=node{{loop.index}}.{{chomped_zone_internal_dns}} ansible_ssh_user={{remote_user}} ansible_ssh_private_key_file=~/.ssh/{{key_name}}.pem openshift_node_labels="{'logging':'true','cluster': '{{guid}}', 'env':'users', 'zone': '{{hostvars[host]['ec2_placement']}}'}"
{% for host in groups['nodes'] %}
node{{loop.index}}.{{chomped_zone_internal_dns}} openshift_hostname=node{{loop.index}}.{{chomped_zone_internal_dns}} ansible_ssh_user={{remote_user}} ansible_ssh_private_key_file=~/.ssh/{{key_name}}.pem openshift_node_labels="{'logging':'true','cluster': '{{guid}}', 'env':'users', 'zone': '{{hostvars[host]['placement']}}'}"
{% endfor %}
[nfs]
{% for host in groups[('tag_' + env_type + '-' + guid + '_support') | replace('-', '_') ] %}
{% for host in groups['support'] %}
support{{loop.index}}.{{chomped_zone_internal_dns}} openshift_hostname=support{{loop.index}}.{{chomped_zone_internal_dns}} ansible_ssh_user={{remote_user}} ansible_ssh_private_key_file=~/.ssh/{{key_name}}.pem
{% endfor %}
ansible/configs/ocp-demo-lab/post_software.yml
@@ -1,5 +1,5 @@
- name: Create user-vols on the support host
  hosts: "{{ ('tag_' ~ env_type ~ '_' ~ guid ~ '_support') | replace('-', '_') }}"
  hosts: support
  gather_facts: False
  become: yes
  vars_files:
@@ -11,7 +11,7 @@
      shell: "chmod -R 777 /srv/nfs/user-vols"
- name: Create System PVs and user PVs
  hosts: "{{ ('tag_' ~ env_type ~ '_' ~ guid ~ '_bastion') | replace('-', '_') }}"
  hosts: bastions
  gather_facts: False
  become: yes
  vars_files:
@@ -19,9 +19,7 @@
  tasks:
    - name: get nfs Hostname
      set_fact:
        nfs_host: "{{item}}"
      with_items:
        - "{{groups['tag_AnsibleGroup_support']}}"
        nfs_host: groups['bastions'].0
      when: '"{{env_type}}-{{guid}}" in hostvars[item].{{cloud_provider}}_tag_Project'
    - set_fact:
@@ -54,7 +52,7 @@
    - shell: 'oc create -f /root/userpvs-{{ env_type }}-{{ guid }}.yml || oc update -f /root/userpvs-{{ env_type }}-{{ guid }}.yml'
- name: env-specific infrastructure
  hosts: "{{ ('tag_' ~ env_type ~ '_' ~ guid ~ '_master') | replace('-', '_') }}"
  hosts: masters
  become: yes
  gather_facts: False
  vars_files:
@@ -85,7 +83,7 @@
      command: "oc patch scc/anyuid --patch '{\"requiredDropCapabilities\":[\"MKNOD\",\"SYS_CHROOT\"]}'"
- name: node admin configs
  hosts: "{{ ('tag_' ~ env_type ~ '_' ~ guid ~ '_node') | replace('-', '_') }}"
  hosts: nodes
  gather_facts: False
  become: yes
  vars_files:
@@ -125,7 +123,7 @@
- name: Install Nexus
  hosts: "{{ ('tag_' ~ env_type ~ '_' ~ guid ~ '_master') | replace('-', '_') }}"
  hosts: masters
  gather_facts: False
  become: yes
  vars_files:
@@ -138,7 +136,7 @@
    - install_nexus
- name: Install dev-workstation on bastion and cofigure opentlc ipa
  hosts: "{{ ('tag_' ~ env_type ~ '_' ~ guid ~ '_bastion') | replace('-', '_') }}"
  hosts: bastions
  gather_facts: False
  become: yes
  vars_files:
ansible/configs/ocp-demo-lab/pre_software.yml
@@ -22,7 +22,8 @@
# Cloudformation template or equivalent should tag all hosts with Project:{{ env_type }}-{{ guid }}
- name: Configure all hosts with Repositories, Common Files and Set environment key
  hosts: "{{ ('tag_Project_' ~ env_type ~ '_' ~ guid) | replace('-', '_') }}"
  hosts:
    - all:!windows
  become: true
  gather_facts: False
  vars_files:
@@ -38,7 +39,7 @@
    - { role: "{{ ANSIBLE_REPO_PATH }}/roles/set_env_authorized_key", when: 'set_env_authorized_key' }
- name: Configuring Bastion Hosts
  hosts: "{{ ('tag_' ~ env_type ~ '_' ~ guid ~ '_bastion') | replace('-', '_') }}"
  hosts: bastions
  become: true
  vars_files:
    - "{{ ANSIBLE_REPO_PATH }}/configs/{{ env_type }}/env_vars.yml"
@@ -51,7 +52,7 @@
    - bastion_tasks
- name: Pre-software verification and ipa client
  hosts: "{{ ('tag_' ~ env_type ~ '_' ~ guid ~ '_bastion') | replace('-', '_') }}"
  hosts: bastions
  gather_facts: False
  become: yes
  tags: