This repository was archived by the owner on Dec 9, 2020. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 363
Add an Openstack provider #397
Merged
cooktheryan
merged 196 commits into
openshift:master
from
tomassedovic:openstack-provider
Jun 16, 2017
Merged
Changes from all commits
Commits
Show all changes
196 commits
Select commit
Hold shift + click to select a range
fa82787
First cut at the rhc-ose-ansible structure
oybed 609a84b
New OSE3 docker host builder and OpenStack ansible provisioning support
sabre1041 57116c7
Support for supplying flavor name and moved around variables
sabre1041 de175e9
Refactored OpenStack provisioning to be a generic role. Created OpenS…
sabre1041 899dbe8
Registry Role for ansible playbooks
etsauer a1b414a
Added immediate=yes to have firwalld port take affect; restructured r…
etsauer b840281
added post_install role
becb578
adding playbook
b88f71b
Migration of CICD server provisioning to Ansible
sabre1041 d4bc5c9
Adding nginx auth layer
etsauer 5295665
Removing key name from registry
etsauer 7060037
Refactoring and renaming
etsauer d2668fa
adding openshift-ansible's post install roles
ed08161
removing deprecated files
7f6c10d
Shell for role variable info
106661e
removing extra files
3aa99b9
Add OpenStack SSH key parameter check
vvaldez b9819b2
Replacing yum commands and normalizing comments
etsauer d706ed6
fixed README
2eb3f24
Renaming template files with .j2 for clarity
etsauer 4589279
Merge pull request #131 from JayKayy/role_info
oybed 3300278
Merge pull request #126 from etsauer/registry-enhanced
oybed 0933257
Add OpenStack security group detection and creation resolves #106
vvaldez 2de1adb
Change to using split to iterate and SSH rule create only once
vvaldez 1a09d0b
Reorder instances names to sort by env_id
vvaldez 4065633
Change default_env_id of "testenv" to local env OS_USERNAME resolves …
vvaldez 52025ed
Prepend 'casl' to default_env_id
vvaldez 7bee02d
Merge pull request #149 from vvaldez/openstack-rename-for-sorting
oybed a49bbc0
Merge pull request #135 from vvaldez/openstack-secgroups
oybed 5e16e66
Add connection test to OpenStack before proceeding
vvaldez e86888a
First cut at DNS ansible roles
oybed 28108d3
Updated defaults and tasks for dns-server
oybed 0789cd2
Add subscription-manager support for Hosted or Satellite
vvaldez a72b09f
Refactor role to dynamically determine rhsm_method
vvaldez 2b80f53
Fix bad syntax with extra 'and' in when using rhsm_pool
vvaldez 9754105
Refactor use of rhsm_password to prevent display to CLI
vvaldez dfbbeb8
Cosmetic changes to task names and move yum clean all to prereqs
vvaldez b71dba1
Remove vars_prompt, add info to README to re-enable and for ansible-v…
vvaldez 0e21e8e
Add openstack pre_tasks and ansible_sudo when calling role
vvaldez b37972e
Add deprovision playbook using nova list with sanity checks
vvaldez 044e684
Refactor debug flag to be dry_run and other small changes
vvaldez 877adbb
Add ansible_sudo: true to subscription-manager task
vvaldez 6eb5ac9
Updated to fix broken/missing 'defaults'...
oybed 271a211
Add unique image logic and rename playbook to terminate.yml
vvaldez 6d74a53
Add OSE provision prerequisites
vvaldez b847576
Add SELinux check and fail if not enforcing
vvaldez 44e0e4a
Remove getenforce and firewall tasks and use facts
vvaldez 654eed7
Add docker role
vvaldez b9e7b96
Add org parameter to Satellite with user/pass
vvaldez 8c8362f
Fix typo in task name
vvaldez 0b68a04
Merge pull request #147 from vvaldez/ose-provision-prereqs
etsauer 0dce56a
Merge branch 'docker-ansible-role' of git://github.com/vvaldez/rhc-os…
etsauer e8365b4
Merge branch 'openshift-enterprise-3' of github.com:rhtconsulting/rhc…
etsauer 44e9ceb
Updated dns-server role based on feedback
oybed 4f2fe57
Merge pull request #154 from oybed/ansible-dns
etsauer 126a63a
Changes by JayKayy for a full provision of OpenShift on OpenStack
etsauer 7827ce8
Role for disconnected git server
sabre1041 3270472
Added additional yum dependency and corrected spelling
sabre1041 ba64ac5
Added example of disconnected git inventory file
sabre1041 a888ba5
Changes to allow runs from inside a container. Also allows for runnin…
etsauer fbc0984
Reverting previous commit and making template adjustments
etsauer 0fc86a0
Subscription manager role should accomodate orgs with spaces
etsauer 6fb7aee
Fixing unescaped newline
etsauer c6b533f
Channging hard coded host groups to match openshift-ansible expected …
etsauer 4cdf1b9
Updated to run as root rather than cloud-user, for now...
oybed 9007fbf
Updated inventory template to include openshift_hostname and openshif…
oybed f6cfadf
Wrapping in a script to tie the two playbooks together
etsauer 178e9fb
Updating ose-provision with DNS workarounds / fixes
oybed ebf20d9
Removed spaces causing issues...
oybed 870dfa2
DNS fix to support OSEv3.2
oybed e64a593
Add floating IP support when using Neutron
vvaldez 6c1f97e
Updated to remove repos from playbook + fix typo
oybed d361293
Cleande up hostname role to make it more generic
oybed 57ec31c
Image name for DNS server becomes configurable.
etsauer 99d6e48
Merge pull request #189 from etsauer/dns-image-name-fix
oybed db38537
Updated inventory and template file to make cluster config optional
oybed 9523bcd
Removing temporary file
oybed 1ae6bff
Loosen up the DNS server a bit to allow for ETL OSP installs
oybed fbd9828
Merge pull request #132 from vvaldez/openstack-deprovision
etsauer 0e003f9
Updated per latest
oybed 72a5c7c
Merge pull request #157 from vvaldez/satellite-with-org
etsauer d7db503
Re-implements original subscription-manager role invokation that was
vvaldez 237d59e
Enhanced provisioning script with better error checking, diretory awa…
etsauer e097330
Should be looking for generated inventory file in SCRIPTS_BASE_DIR
etsauer abc0e4e
Add Neutron floating IP support for Issue #195
vvaldez 9123ec5
first attempt at securing the registry
35cac4c
Minor updates for ansible 2.1 compatibility
etsauer dbb4521
Updated CICD implementation to support ETL OSP env
oybed 87316b8
Updated OSE inventory file with some clean-up
oybed 63af584
Merge pull request #171 from sabre1041/ansible-disconnected-git
etsauer cb92b81
Merge pull request #204 from rhtconsulting/ose-inventory
etsauer 300f592
Merge pull request #203 from rhtconsulting/cicd-updates
etsauer 6ae639c
Merge pull request #196 from vvaldez/openstack-terminate-release-floa…
etsauer 96bc21c
Merge pull request #194 from etsauer/provisioning-script-enhancements
sabre1041 436eac0
Add enhancements for for terminate playbook
vvaldez 71325f5
Adding NFS support and fixing template labels so we get a router and …
etsauer 169b217
testing changes
56853b6
tested changes
1fd53e4
fixing defaults and removing host from test playbook
8b2f5d0
adding clenaup test book and fixed typo
8d9c229
Allow passing of ansible extra-vars in provisioning script
etsauer 25655e8
Change --environment to --extra-vars and add usage.
etsauer e7d44b8
added check for already secured registry and uses actualy openshift_c…
1092b12
fixed readiness probe by adding logic for 3.1 vs 3.2
7032aee
Fix malformed file to address Issue #210
vvaldez e5884db
Pulling out file paths into variables to account for containerized in…
etsauer 16fd8d5
fixed error message logic for already secured registry
be89b66
Merge pull request #1 from etsauer/secure-registry
01ad7ee
added tasks to disable and re-enable deployment triggers, remove debu…
dbffb0b
added var for config dir and removed unnecessary deployment task
5ebaafc
Merge pull request #212 from etsauer/openshift-enterprise-3
sabre1041 d8583e2
Fixes Issue #163 if rhsm_password is not defined
vvaldez 9083495
Merge pull request #200 from JayKayy/secure-registry
etsauer 9af3a4f
Adding a post-install playbook with secure-registry and ssh key sync.
etsauer 2b6aab4
Node storage now uses node specific storage var; search for generated…
etsauer dd79283
Merge remote-tracking branch 'upstream/openshift-enterprise-3' into p…
etsauer 63f89d0
Initial commit exposing registry service
3e5d9ad
move registry_hostname to inventory
7a449e4
Merge pull request #218 from vvaldez/issue_163
etsauer 3ab18f5
Updated env_id to be a sub-domain + make the logic a bit more flexible
oybed 8412514
Enabled default subdomain/'apps'
oybed bf44935
Merge pull request #221 from etsauer/post-install-playbook
oybed ba94b7e
Merge pull request #222 from JayKayy/expose-registry
oybed f59becd
Updated inventory template file to include 'openshift_deployment_type'
oybed a2bb9ae
Merge pull request #197 from vvaldez/openstack-terminate-enhancements
etsauer 644b6de
Adding LDAP and HTPasswd examples for an auth provider to base invent…
etsauer 6b0d23b
Fixing port number in LDAP example
etsauer c788eac
Refactor OpenStack security group creation
vvaldez 645c935
Refactor to playbook and split data structure out
vvaldez 2dc69b9
Add detection of non-Neutron env
vvaldez 0ac77b4
Add UDP 8053 to default master security group
vvaldez 9afbb8a
Merge pull request #219 from vvaldez/security_groups_refactor
oybed dbce2dd
Adjusting docker role, adding support for logging/metrics, and updati…
etsauer 6083762
OpenShift Management Role
sabre1041 c5f5073
Fixing ansible impl to work with OSP9 and ansible 2.2
oybed 5cdb2ed
Correcting formatting
oybed 3d56cdc
Added process / contribution info
oybed 420ace1
Merge pull request #4 from sabre1041/openshift-ansible-management
oybed 3712685
Merge pull request #6 from oybed/process
etsauer f20eec1
Merge pull request #5 from oybed/osp9updates
etsauer db32ea2
Updated default security group rules (#7)
oybed 4ef623c
Openstack heat (#2)
etsauer 3172975
Updating PR Template with Team mention (#10)
etsauer 647260a
Install playbook defaults to the assumption that casl-ansible and ope…
etsauer bb72e04
Merge branch 'master' into openshift-ansible-relative-path
etsauer adc7f61
Removing unnecessary task
etsauer 2ad7849
Merge pull request #14 from etsauer/openshift-ansible-relative-path
sabre1041 a3408e8
Fixing two significant bugs in the HEAT deployment (#13)
etsauer cb4c053
Updated values in sample inventory (#17)
oybed 2ac876a
Adding documentation and docker containers so others can begin testin…
etsauer c7a6ed5
Fixing formatting changes for links
oybed 0cd613b
Renaming openstack images to align with CoP naming (#18)
etsauer cdd6726
Defaulting the DNS instance to a small flavor (#20)
oybed 29fa19e
Nagios (#11)
oybed ed55b71
DNS server should NOT run docker (#25)
oybed 110bb4a
Readme (#26)
oybed 357f5ba
Ensure DNS configuration has wildcards set for infra nodes (#24)
oybed e26fb90
Updated DNS server role + example playbook (#27)
oybed eec9cee
Dns selinux (#28)
oybed 5e1cfab
Openshift mgmt (#30)
oybed 26ef91d
Created initial CHANGELOG.md
oybed 0a2b678
Updating to development release of ansible 2.3.0 to pull down bug fix…
etsauer a9639bf
Workaround for Ansible 2.3 breakage (#31)
oybed 6c0bd3e
Added quotes where needed and fixed some other minor bugs (#33)
oybed 8300aa8
Fixing awk check (#34)
oybed 8b51d37
Updating client image to lock it to ansible 2.3 and install some addi…
etsauer 65cddc3
Stack refactor (#38)
etsauer 385f7a7
First attempt at a simple multi-master support (#39)
etsauer 7cd3170
Some fixes (#41)
tomassedovic f68abb3
Correcting the sample inventory for an HA cluster (#40)
etsauer bfee43b
Updating to OSP ocata repo, as there are some bugs with newton's chan…
etsauer de2e471
Use the correct variable name in create_users (#43)
tomassedovic dcce738
Upgrading jinja2 to work correctly with latest templates (#45)
oybed db06359
Fix rpm deps (#46)
oybed 07fc8bf
Conditionally set the openshift_master_default_subdomain to avoid ove…
oybed ffc71db
Update README.md
oybed bd03771
Update CASL to use nsupdate for DNS records (#48)
oybed a2446a2
Merge redhat-cop/casl-ansible into openstack-provider
tomassedovic 3d91bd3
Move the openstack provisioning playbooks
tomassedovic bbe3419
Add a single provisioning playbook
tomassedovic d3786c9
Symlink roles to provisioning/openstack/roles
tomassedovic 913d0f8
Add a sample inventory for openstack provisioning
tomassedovic 83758cc
Add license for openstack.py in inventory
tomassedovic 632db46
Add readme
tomassedovic ec28b43
Move pre_tasks from to the openstack provisioner
tomassedovic b8e98e3
Add default values to provision-openstack.yml
tomassedovic 8392aec
Fix privileges in the pre-install playbook
tomassedovic 130fa26
Always let the openshift nodes access the DNS
tomassedovic 743221b
Add a flat sec group for openstack provider
bogdando 7da0dda
Add ansible.cfg for openstack provider
bogdando ef5f461
Drop atomic-openshift-utils, update docs for origin
bogdando ce62218
Gather facts for provision playbook
bogdando caa8ca0
Update sample inventory with the latest changes
tomassedovic 5c72cec
Fix yamllint errors
tomassedovic 7bb54db
Remove the extraneous DNS directory
tomassedovic b6533c7
Fix flake8 errors with the openstack inventory
tomassedovic File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
Large diffs are not rendered by default.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,132 @@ | ||
| # OpenStack Provisioning | ||
|
|
||
| This repository contains playbooks and Heat templates to provision | ||
| OpenStack resources (servers, networking, volumes, security groups, | ||
| etc.). The result is an environment ready for openshift-ansible. | ||
|
|
||
|
|
||
| ## Dependencies | ||
|
|
||
| * [Ansible 2.3](https://pypi.python.org/pypi/ansible) | ||
| * [shade](https://pypi.python.org/pypi/shade) | ||
| * python-dns | ||
|
|
||
|
|
||
| ## What does it do | ||
|
|
||
| * Create Nova servers with floating IP addresses attached | ||
| * Assigns Cinder volumes to the servers | ||
| * Set up an `openshift` user with sudo privileges | ||
| * Optionally attach Red Hat subscriptions | ||
| * Set up a bind-based DNS server | ||
| * When deploying more than one master, set up a HAproxy server | ||
|
|
||
|
|
||
| ## Set up | ||
|
|
||
| ### Copy the sample inventory | ||
|
|
||
| cp -r openshift-ansible-contrib/playbooks/provisioning/openstack/sample-inventory inventory | ||
|
|
||
| ### Copy clouds.yaml | ||
|
|
||
| cp openshift-ansible-contrib/playbooks/provisioning/openstack/sample-inventory/clouds.yaml clouds.yaml | ||
|
|
||
| ### Copy ansible config | ||
|
|
||
| cp openshift-ansible-contrib/playbooks/provisioning/openstack/sample-inventory/ansible.cfg ansible.cfg | ||
|
|
||
| ### Update `inventory/group_vars/all.yml` | ||
|
|
||
| Pay special attention to the values in the first paragraph -- these | ||
| will depend on your OpenStack environment. | ||
|
|
||
| The `env_id` and `openstack_dns_domain` will form the DNS domain all | ||
| your servers will be under. With the default values, this will be | ||
| `openshift.example.com`. | ||
|
|
||
| `openstack_nameservers` is a list of DNS servers accessible from all | ||
| the created Nova servers. These will be serve as your DNS forwarders. | ||
|
|
||
| `openstack_ssh_key` is a Nova keypair -- you can see your keypairs with | ||
| `openstack keypair list`. | ||
|
|
||
| `openstack_default_image_name` is the name of the Glance image the | ||
| servers will use. You can | ||
| see your images with `openstack image list`. | ||
|
|
||
| `openstack_default_flavor` is the Nova flavor the servers will use. | ||
| You can see your flavors with `openstack flavor list`. | ||
|
|
||
| `openstack_external_network_name` is the name of the Neutron network | ||
| providing external connectivity. It is often called `public`, | ||
| `external` or `ext-net`. You can see your networks with `openstack | ||
| network list`. | ||
|
|
||
| The `openstack_num_masters`, `openstack_num_infra` and | ||
| `openstack_num_nodes` values specify the number of Master, Infra and | ||
| App nodes to create. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. anything to note wrt the |
||
|
|
||
| The `openstack_flat_secgrp`, controls Neutron security groups creation for Heat | ||
| stacks. Set it to true, if you experience issues with sec group rules | ||
| quotas. It trades security for number of rules, by sharing the same set | ||
| of firewall rules for master, node, etcd and infra nodes. | ||
|
|
||
| ### Update the DNS names in `inventory/hosts` | ||
|
|
||
| The different server groups are currently grouped by the domain name, | ||
| so if you end up using a different domain than | ||
| `openshift.example.com`, you will need to update the `inventory/hosts` | ||
| file. | ||
|
|
||
| For example, if your final domain is `my.cloud.com`, you can run this | ||
| command to fix update the `hosts` file: | ||
|
|
||
| sed -i 's/openshift.example.com/my.cloud.com/' inventory/hosts | ||
|
|
||
| ### Configure the OpenShift parameters | ||
|
|
||
| Finally, you need to update the DNS entry in | ||
| `inventory/group_vars/OSEv3.yml` (look at | ||
| `openshift_master_default_subdomain`). | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. this step may be removed, if the default value adjusted (see the comment below) |
||
|
|
||
| In addition, this is the place where you can customise your OpenShift | ||
| installation for example by specifying the authentication. | ||
|
|
||
| The full list of options is available in this sample inventory: | ||
|
|
||
| https://github.com/openshift/openshift-ansible/blob/master/inventory/byo/hosts.ose.example | ||
|
|
||
| Note, that in order to deploy OpenShift origin, you should update the following | ||
| variables for the `inventory/group_vars/OSEv3.yml`, `all.yml`: | ||
|
|
||
| deployment_type: origin | ||
| origin_release: 1.5.1 | ||
| openshift_deployment_type: "{{ deployment_type }}" | ||
|
|
||
| ## Deployment | ||
|
|
||
| ### Run the playbook | ||
|
|
||
| Assuming your OpenStack (Keystone) credentials are in the `keystonerc` | ||
| file, this is how you stat the provisioning process: | ||
|
|
||
| . keystonerc | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. could we make this do not rely on the stackrc file, but only the clouds.yaml? |
||
| ansible-playbook -i inventory --timeout 30 --private-key ~/.ssh/openshift openshift-ansible-contrib/playbooks/provisioning/openstack/provision.yaml | ||
|
|
||
| ### Install OpenShift | ||
|
|
||
| Once it succeeds, you can install openshift by running: | ||
|
|
||
| ansible-playbook --become --user openshift --private-key ~/.ssh/openshift -i inventory/ openshift-ansible/playbooks/byo/openshift-node/network_manager.yml | ||
| ansible-playbook --become --user openshift --private-key ~/.ssh/openshift -i inventory/ openshift-ansible/playbooks/byo/config.yml | ||
|
|
||
| Note, the `network_manager.yml` is only required if you're deploying OpenShift | ||
| origin. | ||
|
|
||
| ## License | ||
|
|
||
| As the rest of the openshift-ansible-contrib repository, the code here is | ||
| licensed under Apache 2. However, the openstack.py file under | ||
| `sample-inventory` is GPLv3+. See the INVENTORY-LICENSE.txt file for the full | ||
| text of the license. | ||
75 changes: 75 additions & 0 deletions
75
playbooks/provisioning/openstack/openstack_dns_records.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,75 @@ | ||
| --- | ||
| - name: "Generate list of private A records" | ||
| set_fact: | ||
| private_records: "{{ private_records | default([]) + [ { 'type': 'A', 'hostname': hostvars[item]['ansible_hostname'], 'ip': hostvars[item]['openstack']['private_v4'] } ] }}" | ||
| with_items: "{{ groups['cluster_hosts'] }}" | ||
|
|
||
| - name: "Set the private DNS server to use the external value (if provided)" | ||
| set_fact: | ||
| nsupdate_server_private: "{{ external_nsupdate_keys['private']['server'] }}" | ||
| nsupdate_key_secret_private: "{{ external_nsupdate_keys['private']['key_secret'] }}" | ||
| nsupdate_key_algorithm_private: "{{ external_nsupdate_keys['private']['key_algorithm'] }}" | ||
| when: | ||
| - external_nsupdate_keys is defined | ||
| - external_nsupdate_keys['private'] is defined | ||
|
|
||
| - name: "Set the private DNS server to use the provisioned value" | ||
| set_fact: | ||
| nsupdate_server_private: "{{ hostvars[groups['dns'][0]].openstack.public_v4 }}" | ||
| nsupdate_key_secret_private: "{{ hostvars[groups['dns'][0]].nsupdate_keys['private-' + full_dns_domain].key_secret }}" | ||
| nsupdate_key_algorithm_private: "{{ hostvars[groups['dns'][0]].nsupdate_keys['private-' + full_dns_domain].key_algorithm }}" | ||
| when: | ||
| - nsupdate_server_private is undefined | ||
|
|
||
| - name: "Generate the private Add section for DNS" | ||
| set_fact: | ||
| private_named_records: | ||
| - view: "private" | ||
| zone: "{{ full_dns_domain }}" | ||
| server: "{{ nsupdate_server_private }}" | ||
| key_name: "{{ ( 'private-' + full_dns_domain ) }}" | ||
| key_secret: "{{ nsupdate_key_secret_private }}" | ||
| key_algorithm: "{{ nsupdate_key_algorithm_private | lower }}" | ||
| entries: "{{ private_records }}" | ||
|
|
||
| - name: "Generate list of public A records" | ||
| set_fact: | ||
| public_records: "{{ public_records | default([]) + [ { 'type': 'A', 'hostname': hostvars[item]['ansible_hostname'], 'ip': hostvars[item]['openstack']['public_v4'] } ] }}" | ||
| with_items: "{{ groups['cluster_hosts'] }}" | ||
|
|
||
| - name: "Add wildcard records to the public A records" | ||
| set_fact: | ||
| public_records: "{{ public_records | default([]) + [ { 'type': 'A', 'hostname': '*.' + openshift_app_domain, 'ip': hostvars[item]['openstack']['public_v4'] } ] }}" | ||
| with_items: "{{ groups['infra_hosts'] }}" | ||
|
|
||
| - name: "Set the public DNS server details to use the external value (if provided)" | ||
| set_fact: | ||
| nsupdate_server_public: "{{ external_nsupdate_keys['public']['server'] }}" | ||
| nsupdate_key_secret_public: "{{ external_nsupdate_keys['public']['key_secret'] }}" | ||
| nsupdate_key_algorithm_public: "{{ external_nsupdate_keys['public']['key_algorithm'] }}" | ||
| when: | ||
| - external_nsupdate_keys is defined | ||
| - external_nsupdate_keys['public'] is defined | ||
|
|
||
| - name: "Set the public DNS server details to use the provisioned value" | ||
| set_fact: | ||
| nsupdate_server_public: "{{ hostvars[groups['dns'][0]].openstack.public_v4 }}" | ||
| nsupdate_key_secret_public: "{{ hostvars[groups['dns'][0]].nsupdate_keys['public-' + full_dns_domain].key_secret }}" | ||
| nsupdate_key_algorithm_public: "{{ hostvars[groups['dns'][0]].nsupdate_keys['public-' + full_dns_domain].key_algorithm }}" | ||
| when: | ||
| - nsupdate_server_public is undefined | ||
|
|
||
| - name: "Generate the public Add section for DNS" | ||
| set_fact: | ||
| public_named_records: | ||
| - view: "public" | ||
| zone: "{{ full_dns_domain }}" | ||
| server: "{{ nsupdate_server_public }}" | ||
| key_name: "{{ ( 'public-' + full_dns_domain ) }}" | ||
| key_secret: "{{ nsupdate_key_secret_public }}" | ||
| key_algorithm: "{{ nsupdate_key_algorithm_public | lower }}" | ||
| entries: "{{ public_records }}" | ||
|
|
||
| - name: "Generate the final dns_records_add" | ||
| set_fact: | ||
| dns_records_add: "{{ private_named_records + public_named_records }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,25 @@ | ||
| --- | ||
| - name: "Generate ACL list for DNS server" | ||
| set_fact: | ||
| acl_list: "{{ acl_list | default([]) + [ (hostvars[item]['openstack']['private_v4'] + '/32') ] }}" | ||
| with_items: "{{ groups['cluster_hosts'] }}" | ||
|
|
||
| - name: "Generate the private view" | ||
| set_fact: | ||
| private_named_view: | ||
| - name: "private" | ||
| acl_entry: "{{ acl_list }}" | ||
| zone: | ||
| - dns_domain: "{{ full_dns_domain }}" | ||
|
|
||
| - name: "Generate the public view" | ||
| set_fact: | ||
| public_named_view: | ||
| - name: "public" | ||
| zone: | ||
| - dns_domain: "{{ full_dns_domain }}" | ||
| forwarder: "{{ public_dns_nameservers }}" | ||
|
|
||
| - name: "Generate the final named_config_views" | ||
| set_fact: | ||
| named_config_views: "{{ private_named_view + public_named_view }}" |
58 changes: 58 additions & 0 deletions
58
playbooks/provisioning/openstack/post-provision-openstack.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,58 @@ | ||
| --- | ||
| # Assign hostnames | ||
| - hosts: cluster_hosts | ||
| become: true | ||
| pre_tasks: | ||
| - include: pre_tasks.yml | ||
| roles: | ||
| - role: hostnames | ||
|
|
||
| # Subscribe DNS Host to allow for configuration below | ||
| - hosts: dns | ||
| become: true | ||
| roles: | ||
| - role: subscription-manager | ||
| when: hostvars.localhost.rhsm_register | ||
| tags: 'subscription-manager' | ||
|
|
||
| # Determine which DNS server(s) to use for our generated records | ||
| - hosts: localhost | ||
| roles: | ||
| - dns-server-detect | ||
|
|
||
| # Build the DNS Server Views and Configure DNS Server(s) | ||
| - hosts: dns | ||
| become: true | ||
| pre_tasks: | ||
| - include: pre_tasks.yml | ||
| - name: "Generate dns-server views" | ||
| include: openstack_dns_views.yml | ||
| roles: | ||
| - role: dns-server | ||
|
|
||
| # Build and process DNS Records | ||
| - hosts: localhost | ||
| pre_tasks: | ||
| - include: pre_tasks.yml | ||
| - name: "Generate dns records" | ||
| include: openstack_dns_records.yml | ||
| roles: | ||
| - role: dns | ||
|
|
||
| # OpenShift Pre-Requisites | ||
| - hosts: OSEv3 | ||
| become: true | ||
| tasks: | ||
| - name: "Edit /etc/resolv.conf on masters/nodes" | ||
| lineinfile: | ||
| state: present | ||
| dest: /etc/resolv.conf | ||
| regexp: "nameserver {{ hostvars['localhost'].private_dns_server }}" | ||
| line: "nameserver {{ hostvars['localhost'].private_dns_server }}" | ||
| insertafter: search* | ||
| - name: "Include DNS configuration to ensure proper name resolution" | ||
| lineinfile: | ||
| state: present | ||
| dest: /etc/sysconfig/network | ||
| regexp: "IP4_NAMESERVERS={{ hostvars['localhost'].private_dns_server }}" | ||
| line: "IP4_NAMESERVERS={{ hostvars['localhost'].private_dns_server }}" |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| --- | ||
| ############################### | ||
| # OpenShift Pre-Requisites | ||
|
|
||
| # - subscribe hosts | ||
| # - prepare docker | ||
| # - other prep (install additional packages, etc.) | ||
| # | ||
| - hosts: OSEv3 | ||
| become: true | ||
| roles: | ||
| - { role: subscription-manager, when: hostvars.localhost.rhsm_register, tags: 'subscription-manager', ansible_sudo: true } | ||
| - { role: docker, tags: 'docker' } | ||
| - { role: openshift-prep, tags: 'openshift-prep' } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| --- | ||
| - name: Generate Environment ID | ||
| set_fact: | ||
| env_random_id: "{{ ansible_date_time.epoch }}" | ||
| run_once: true | ||
| delegate_to: localhost | ||
|
|
||
| - name: Set default Environment ID | ||
| set_fact: | ||
| default_env_id: "casl-{{ lookup('env','OS_USERNAME') }}-{{ env_random_id }}" | ||
| delegate_to: localhost | ||
|
|
||
| - name: Setting Common Facts | ||
| set_fact: | ||
| env_id: "{{ env_id | default(default_env_id) }}" | ||
| delegate_to: localhost | ||
|
|
||
| - name: Set Dynamic Inventory Filters | ||
| become: false | ||
| shell: > | ||
| export OS_INV_FILTER_KEY=clusterid && export OS_INV_FILTER_VALUE={{ env_id }} | ||
| delegate_to: localhost | ||
|
|
||
| - name: Updating DNS domain to include env_id (if not empty) | ||
| set_fact: | ||
| full_dns_domain: "{{ (env_id|trim == '') | ternary(public_dns_domain, env_id + '.' + public_dns_domain) }}" | ||
| delegate_to: localhost | ||
|
|
||
| - name: Set the APP domain for OpenShift use | ||
| set_fact: | ||
| openshift_app_domain: "{{ openshift_app_domain | default('apps') }}" | ||
| delegate_to: localhost | ||
|
|
||
| - name: Set the default app domain for routing purposes | ||
| set_fact: | ||
| openshift_master_default_subdomain: "{{ openshift_app_domain }}.{{ full_dns_domain }}" | ||
| delegate_to: localhost | ||
| when: | ||
| - openshift_master_default_subdomain is undefined |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,49 @@ | ||
| --- | ||
| - hosts: localhost | ||
| gather_facts: True | ||
| pre_tasks: | ||
| - include: pre_tasks.yml | ||
| roles: | ||
| - role: openstack-stack | ||
| stack_name: "{{ env_id }}.{{ public_dns_domain }}" | ||
| dns_domain: "{{ public_dns_domain }}" | ||
| dns_nameservers: "{{ public_dns_nameservers }}" | ||
| subnet_prefix: "{{ openstack_subnet_prefix }}" | ||
| ssh_public_key: "{{ openstack_ssh_public_key }}" | ||
| openstack_image: "{{ openstack_default_image_name }}" | ||
| lb_flavor: "{{ openstack_default_flavor | default('m1.small') }}" | ||
| etcd_flavor: "{{ openstack_default_flavor | default('m1.small') }}" | ||
| master_flavor: "{{ openstack_default_flavor | default('m1.medium') }}" | ||
| node_flavor: "{{ openstack_default_flavor | default('m1.medium') }}" | ||
| infra_flavor: "{{ openstack_default_flavor | default('m1.medium') }}" | ||
| dns_flavor: "{{ openstack_default_flavor | default('m1.small') }}" | ||
| external_network: "{{ openstack_external_network_name }}" | ||
| num_etcd: "{{ openstack_num_etcd | default(0) }}" | ||
| num_masters: "{{ openstack_num_masters }}" | ||
| num_nodes: "{{ openstack_num_nodes }}" | ||
| num_infra: "{{ openstack_num_infra }}" | ||
| num_dns: "{{ openstack_num_dns | default(1) }}" | ||
| master_volume_size: "{{ docker_volume_size }}" | ||
| app_volume_size: "{{ docker_volume_size }}" | ||
| infra_volume_size: "{{ docker_volume_size }}" | ||
|
|
||
|
|
||
| - name: Refresh Server inventory | ||
| hosts: localhost | ||
| connection: local | ||
| gather_facts: False | ||
| tasks: | ||
| - meta: refresh_inventory | ||
|
|
||
| - hosts: cluster_hosts | ||
| gather_facts: false | ||
| tasks: | ||
| - name: Debug hostvar | ||
| debug: | ||
| msg: "{{ hostvars[inventory_hostname] }}" | ||
| verbosity: 2 | ||
| - name: waiting for server to come back | ||
| local_action: wait_for host={{ hostvars[inventory_hostname]['ansible_ssh_host'] }} port=22 delay=30 timeout=300 | ||
| become: false | ||
|
|
||
| - include: post-provision-openstack.yml |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's insist for the guide to update it to something like
openshift.cluster.lc, which has nothing to publicly DNS-resolvable domains.