Skip to content
This repository was archived by the owner on Dec 9, 2020. It is now read-only.
Merged
Show file tree
Hide file tree
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 Nov 16, 2015
609a84b
New OSE3 docker host builder and OpenStack ansible provisioning support
sabre1041 Feb 8, 2016
57116c7
Support for supplying flavor name and moved around variables
sabre1041 Feb 9, 2016
de175e9
Refactored OpenStack provisioning to be a generic role. Created OpenS…
sabre1041 Feb 14, 2016
899dbe8
Registry Role for ansible playbooks
etsauer Feb 19, 2016
a1b414a
Added immediate=yes to have firwalld port take affect; restructured r…
etsauer Feb 19, 2016
b840281
added post_install role
Feb 22, 2016
becb578
adding playbook
Feb 22, 2016
b88f71b
Migration of CICD server provisioning to Ansible
sabre1041 Mar 22, 2016
d4bc5c9
Adding nginx auth layer
etsauer Mar 24, 2016
5295665
Removing key name from registry
etsauer Mar 25, 2016
7060037
Refactoring and renaming
etsauer Mar 29, 2016
d2668fa
adding openshift-ansible's post install roles
Mar 29, 2016
ed08161
removing deprecated files
Mar 29, 2016
7f6c10d
Shell for role variable info
Mar 29, 2016
106661e
removing extra files
Mar 29, 2016
3aa99b9
Add OpenStack SSH key parameter check
vvaldez Mar 29, 2016
b9819b2
Replacing yum commands and normalizing comments
etsauer Mar 31, 2016
d706ed6
fixed README
Apr 4, 2016
2eb3f24
Renaming template files with .j2 for clarity
etsauer Apr 4, 2016
4589279
Merge pull request #131 from JayKayy/role_info
oybed Apr 4, 2016
3300278
Merge pull request #126 from etsauer/registry-enhanced
oybed Apr 4, 2016
0933257
Add OpenStack security group detection and creation resolves #106
vvaldez Mar 29, 2016
2de1adb
Change to using split to iterate and SSH rule create only once
vvaldez Apr 7, 2016
1a09d0b
Reorder instances names to sort by env_id
vvaldez Apr 8, 2016
4065633
Change default_env_id of "testenv" to local env OS_USERNAME resolves …
vvaldez Apr 8, 2016
52025ed
Prepend 'casl' to default_env_id
vvaldez Apr 8, 2016
7bee02d
Merge pull request #149 from vvaldez/openstack-rename-for-sorting
oybed Apr 8, 2016
a49bbc0
Merge pull request #135 from vvaldez/openstack-secgroups
oybed Apr 9, 2016
5e16e66
Add connection test to OpenStack before proceeding
vvaldez Apr 10, 2016
e86888a
First cut at DNS ansible roles
oybed Apr 19, 2016
28108d3
Updated defaults and tasks for dns-server
oybed Apr 19, 2016
0789cd2
Add subscription-manager support for Hosted or Satellite
vvaldez Mar 29, 2016
a72b09f
Refactor role to dynamically determine rhsm_method
vvaldez Mar 30, 2016
2b80f53
Fix bad syntax with extra 'and' in when using rhsm_pool
vvaldez Apr 5, 2016
9754105
Refactor use of rhsm_password to prevent display to CLI
vvaldez Apr 5, 2016
dfbbeb8
Cosmetic changes to task names and move yum clean all to prereqs
vvaldez Apr 8, 2016
b71dba1
Remove vars_prompt, add info to README to re-enable and for ansible-v…
vvaldez Apr 8, 2016
0e21e8e
Add openstack pre_tasks and ansible_sudo when calling role
vvaldez Apr 20, 2016
b37972e
Add deprovision playbook using nova list with sanity checks
vvaldez Apr 7, 2016
044e684
Refactor debug flag to be dry_run and other small changes
vvaldez Apr 9, 2016
877adbb
Add ansible_sudo: true to subscription-manager task
vvaldez Apr 20, 2016
6eb5ac9
Updated to fix broken/missing 'defaults'...
oybed Apr 21, 2016
271a211
Add unique image logic and rename playbook to terminate.yml
vvaldez Apr 20, 2016
6d74a53
Add OSE provision prerequisites
vvaldez Apr 7, 2016
b847576
Add SELinux check and fail if not enforcing
vvaldez Apr 8, 2016
44e0e4a
Remove getenforce and firewall tasks and use facts
vvaldez Apr 22, 2016
654eed7
Add docker role
vvaldez Apr 8, 2016
b9e7b96
Add org parameter to Satellite with user/pass
vvaldez Apr 23, 2016
8c8362f
Fix typo in task name
vvaldez Apr 27, 2016
0b68a04
Merge pull request #147 from vvaldez/ose-provision-prereqs
etsauer May 4, 2016
0dce56a
Merge branch 'docker-ansible-role' of git://github.com/vvaldez/rhc-os…
etsauer May 4, 2016
e8365b4
Merge branch 'openshift-enterprise-3' of github.com:rhtconsulting/rhc…
etsauer May 4, 2016
44e9ceb
Updated dns-server role based on feedback
oybed May 5, 2016
4f2fe57
Merge pull request #154 from oybed/ansible-dns
etsauer May 5, 2016
126a63a
Changes by JayKayy for a full provision of OpenShift on OpenStack
etsauer May 13, 2016
7827ce8
Role for disconnected git server
sabre1041 May 22, 2016
3270472
Added additional yum dependency and corrected spelling
sabre1041 May 23, 2016
ba64ac5
Added example of disconnected git inventory file
sabre1041 May 29, 2016
a888ba5
Changes to allow runs from inside a container. Also allows for runnin…
etsauer Jun 3, 2016
fbc0984
Reverting previous commit and making template adjustments
etsauer Jun 3, 2016
0fc86a0
Subscription manager role should accomodate orgs with spaces
etsauer Jun 3, 2016
6fb7aee
Fixing unescaped newline
etsauer Jun 6, 2016
c6b533f
Channging hard coded host groups to match openshift-ansible expected …
etsauer Jun 8, 2016
4cdf1b9
Updated to run as root rather than cloud-user, for now...
oybed Jun 9, 2016
9007fbf
Updated inventory template to include openshift_hostname and openshif…
oybed Jun 9, 2016
f6cfadf
Wrapping in a script to tie the two playbooks together
etsauer Jun 10, 2016
178e9fb
Updating ose-provision with DNS workarounds / fixes
oybed Jun 13, 2016
ebf20d9
Removed spaces causing issues...
oybed Jun 13, 2016
870dfa2
DNS fix to support OSEv3.2
oybed Jun 14, 2016
e64a593
Add floating IP support when using Neutron
vvaldez Jun 5, 2016
6c1f97e
Updated to remove repos from playbook + fix typo
oybed Jun 17, 2016
d361293
Cleande up hostname role to make it more generic
oybed Jun 17, 2016
57ec31c
Image name for DNS server becomes configurable.
etsauer Jun 20, 2016
99d6e48
Merge pull request #189 from etsauer/dns-image-name-fix
oybed Jun 20, 2016
db38537
Updated inventory and template file to make cluster config optional
oybed Jun 21, 2016
9523bcd
Removing temporary file
oybed Jun 21, 2016
1ae6bff
Loosen up the DNS server a bit to allow for ETL OSP installs
oybed Jun 21, 2016
fbd9828
Merge pull request #132 from vvaldez/openstack-deprovision
etsauer Jun 22, 2016
0e003f9
Updated per latest
oybed Jun 22, 2016
72a5c7c
Merge pull request #157 from vvaldez/satellite-with-org
etsauer Jun 22, 2016
d7db503
Re-implements original subscription-manager role invokation that was
vvaldez Jun 22, 2016
237d59e
Enhanced provisioning script with better error checking, diretory awa…
etsauer Jun 27, 2016
e097330
Should be looking for generated inventory file in SCRIPTS_BASE_DIR
etsauer Jun 27, 2016
abc0e4e
Add Neutron floating IP support for Issue #195
vvaldez Jun 28, 2016
9123ec5
first attempt at securing the registry
Jun 29, 2016
35cac4c
Minor updates for ansible 2.1 compatibility
etsauer Jul 1, 2016
dbb4521
Updated CICD implementation to support ETL OSP env
oybed Jul 2, 2016
87316b8
Updated OSE inventory file with some clean-up
oybed Jul 2, 2016
63af584
Merge pull request #171 from sabre1041/ansible-disconnected-git
etsauer Jul 5, 2016
cb92b81
Merge pull request #204 from rhtconsulting/ose-inventory
etsauer Jul 5, 2016
300f592
Merge pull request #203 from rhtconsulting/cicd-updates
etsauer Jul 5, 2016
6ae639c
Merge pull request #196 from vvaldez/openstack-terminate-release-floa…
etsauer Jul 5, 2016
96bc21c
Merge pull request #194 from etsauer/provisioning-script-enhancements
sabre1041 Jul 6, 2016
436eac0
Add enhancements for for terminate playbook
vvaldez Jun 29, 2016
71325f5
Adding NFS support and fixing template labels so we get a router and …
etsauer Jul 8, 2016
169b217
testing changes
Jul 11, 2016
56853b6
tested changes
Jul 11, 2016
1fd53e4
fixing defaults and removing host from test playbook
Jul 11, 2016
8b2f5d0
adding clenaup test book and fixed typo
Jul 12, 2016
8d9c229
Allow passing of ansible extra-vars in provisioning script
etsauer Jul 12, 2016
25655e8
Change --environment to --extra-vars and add usage.
etsauer Jul 12, 2016
e7d44b8
added check for already secured registry and uses actualy openshift_c…
Jul 13, 2016
1092b12
fixed readiness probe by adding logic for 3.1 vs 3.2
Jul 14, 2016
7032aee
Fix malformed file to address Issue #210
vvaldez Jul 14, 2016
e5884db
Pulling out file paths into variables to account for containerized in…
etsauer Jul 15, 2016
16fd8d5
fixed error message logic for already secured registry
Jul 15, 2016
be89b66
Merge pull request #1 from etsauer/secure-registry
Jul 15, 2016
01ad7ee
added tasks to disable and re-enable deployment triggers, remove debu…
Jul 15, 2016
dbffb0b
added var for config dir and removed unnecessary deployment task
Jul 15, 2016
5ebaafc
Merge pull request #212 from etsauer/openshift-enterprise-3
sabre1041 Jul 15, 2016
d8583e2
Fixes Issue #163 if rhsm_password is not defined
vvaldez Jul 15, 2016
9083495
Merge pull request #200 from JayKayy/secure-registry
etsauer Jul 15, 2016
9af3a4f
Adding a post-install playbook with secure-registry and ssh key sync.
etsauer Jul 17, 2016
2b6aab4
Node storage now uses node specific storage var; search for generated…
etsauer Jul 18, 2016
dd79283
Merge remote-tracking branch 'upstream/openshift-enterprise-3' into p…
etsauer Jul 18, 2016
63f89d0
Initial commit exposing registry service
Jul 18, 2016
3e5d9ad
move registry_hostname to inventory
Jul 18, 2016
7a449e4
Merge pull request #218 from vvaldez/issue_163
etsauer Jul 18, 2016
3ab18f5
Updated env_id to be a sub-domain + make the logic a bit more flexible
oybed Aug 21, 2016
8412514
Enabled default subdomain/'apps'
oybed Aug 21, 2016
bf44935
Merge pull request #221 from etsauer/post-install-playbook
oybed Aug 24, 2016
ba94b7e
Merge pull request #222 from JayKayy/expose-registry
oybed Aug 24, 2016
f59becd
Updated inventory template file to include 'openshift_deployment_type'
oybed Aug 25, 2016
a2bb9ae
Merge pull request #197 from vvaldez/openstack-terminate-enhancements
etsauer Aug 30, 2016
644b6de
Adding LDAP and HTPasswd examples for an auth provider to base invent…
etsauer Aug 31, 2016
6b0d23b
Fixing port number in LDAP example
etsauer Aug 31, 2016
c788eac
Refactor OpenStack security group creation
vvaldez Jul 15, 2016
645c935
Refactor to playbook and split data structure out
vvaldez Jul 22, 2016
2dc69b9
Add detection of non-Neutron env
vvaldez Aug 31, 2016
0ac77b4
Add UDP 8053 to default master security group
vvaldez Aug 31, 2016
9afbb8a
Merge pull request #219 from vvaldez/security_groups_refactor
oybed Sep 1, 2016
dbce2dd
Adjusting docker role, adding support for logging/metrics, and updati…
etsauer Oct 3, 2016
6083762
OpenShift Management Role
sabre1041 Nov 15, 2016
c5f5073
Fixing ansible impl to work with OSP9 and ansible 2.2
oybed Nov 16, 2016
5cdb2ed
Correcting formatting
oybed Nov 16, 2016
3d56cdc
Added process / contribution info
oybed Nov 16, 2016
420ace1
Merge pull request #4 from sabre1041/openshift-ansible-management
oybed Nov 29, 2016
3712685
Merge pull request #6 from oybed/process
etsauer Nov 30, 2016
f20eec1
Merge pull request #5 from oybed/osp9updates
etsauer Dec 2, 2016
db32ea2
Updated default security group rules (#7)
oybed Dec 21, 2016
4ef623c
Openstack heat (#2)
etsauer Dec 21, 2016
3172975
Updating PR Template with Team mention (#10)
etsauer Dec 22, 2016
647260a
Install playbook defaults to the assumption that casl-ansible and ope…
etsauer Jan 19, 2017
bb72e04
Merge branch 'master' into openshift-ansible-relative-path
etsauer Jan 20, 2017
adc7f61
Removing unnecessary task
etsauer Jan 20, 2017
2ad7849
Merge pull request #14 from etsauer/openshift-ansible-relative-path
sabre1041 Jan 20, 2017
a3408e8
Fixing two significant bugs in the HEAT deployment (#13)
etsauer Feb 7, 2017
cb4c053
Updated values in sample inventory (#17)
oybed Feb 7, 2017
2ac876a
Adding documentation and docker containers so others can begin testin…
etsauer Feb 7, 2017
c7a6ed5
Fixing formatting changes for links
oybed Feb 8, 2017
0cd613b
Renaming openstack images to align with CoP naming (#18)
etsauer Feb 8, 2017
cdd6726
Defaulting the DNS instance to a small flavor (#20)
oybed Feb 12, 2017
29fa19e
Nagios (#11)
oybed Feb 12, 2017
ed55b71
DNS server should NOT run docker (#25)
oybed Feb 16, 2017
110bb4a
Readme (#26)
oybed Feb 20, 2017
357f5ba
Ensure DNS configuration has wildcards set for infra nodes (#24)
oybed Feb 20, 2017
e26fb90
Updated DNS server role + example playbook (#27)
oybed Mar 2, 2017
eec9cee
Dns selinux (#28)
oybed Mar 4, 2017
5e1cfab
Openshift mgmt (#30)
oybed Mar 26, 2017
26ef91d
Created initial CHANGELOG.md
oybed Mar 30, 2017
0a2b678
Updating to development release of ansible 2.3.0 to pull down bug fix…
etsauer Mar 30, 2017
a9639bf
Workaround for Ansible 2.3 breakage (#31)
oybed Apr 6, 2017
6c0bd3e
Added quotes where needed and fixed some other minor bugs (#33)
oybed Apr 7, 2017
8300aa8
Fixing awk check (#34)
oybed Apr 8, 2017
8b51d37
Updating client image to lock it to ansible 2.3 and install some addi…
etsauer Apr 21, 2017
65cddc3
Stack refactor (#38)
etsauer Apr 26, 2017
385f7a7
First attempt at a simple multi-master support (#39)
etsauer Apr 27, 2017
7cd3170
Some fixes (#41)
tomassedovic May 9, 2017
f68abb3
Correcting the sample inventory for an HA cluster (#40)
etsauer May 17, 2017
bfee43b
Updating to OSP ocata repo, as there are some bugs with newton's chan…
etsauer May 17, 2017
de2e471
Use the correct variable name in create_users (#43)
tomassedovic May 17, 2017
dcce738
Upgrading jinja2 to work correctly with latest templates (#45)
oybed May 25, 2017
db06359
Fix rpm deps (#46)
oybed May 26, 2017
07fc8bf
Conditionally set the openshift_master_default_subdomain to avoid ove…
oybed Jun 5, 2017
ffc71db
Update README.md
oybed Jun 7, 2017
bd03771
Update CASL to use nsupdate for DNS records (#48)
oybed Jun 13, 2017
a2446a2
Merge redhat-cop/casl-ansible into openstack-provider
tomassedovic Jun 14, 2017
3d91bd3
Move the openstack provisioning playbooks
tomassedovic Jun 2, 2017
bbe3419
Add a single provisioning playbook
tomassedovic Jun 2, 2017
d3786c9
Symlink roles to provisioning/openstack/roles
tomassedovic Jun 2, 2017
913d0f8
Add a sample inventory for openstack provisioning
tomassedovic Jun 2, 2017
83758cc
Add license for openstack.py in inventory
tomassedovic Jun 2, 2017
632db46
Add readme
tomassedovic Jun 2, 2017
ec28b43
Move pre_tasks from to the openstack provisioner
tomassedovic Jun 2, 2017
b8e98e3
Add default values to provision-openstack.yml
tomassedovic Jun 2, 2017
8392aec
Fix privileges in the pre-install playbook
tomassedovic Jun 2, 2017
130fa26
Always let the openshift nodes access the DNS
tomassedovic Jun 2, 2017
743221b
Add a flat sec group for openstack provider
bogdando Jun 5, 2017
7da0dda
Add ansible.cfg for openstack provider
bogdando Jun 5, 2017
ef5f461
Drop atomic-openshift-utils, update docs for origin
bogdando Jun 12, 2017
ce62218
Gather facts for provision playbook
bogdando Jun 14, 2017
caa8ca0
Update sample inventory with the latest changes
tomassedovic Jun 16, 2017
5c72cec
Fix yamllint errors
tomassedovic Jun 16, 2017
7bb54db
Remove the extraneous DNS directory
tomassedovic Jun 16, 2017
b6533c7
Fix flake8 errors with the openstack inventory
tomassedovic Jun 16, 2017
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
674 changes: 674 additions & 0 deletions playbooks/provisioning/openstack/INVENTORY-LICENSE.txt

Large diffs are not rendered by default.

132 changes: 132 additions & 0 deletions playbooks/provisioning/openstack/README.md
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`.
Copy link
Contributor

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.


`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.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

anything to note wrt the openstack_subnet_prefix defaults please?


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`).
Copy link
Contributor

Choose a reason for hiding this comment

The 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
Copy link
Contributor

Choose a reason for hiding this comment

The 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 playbooks/provisioning/openstack/openstack_dns_records.yml
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 }}"
25 changes: 25 additions & 0 deletions playbooks/provisioning/openstack/openstack_dns_views.yml
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 playbooks/provisioning/openstack/post-provision-openstack.yml
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 }}"
14 changes: 14 additions & 0 deletions playbooks/provisioning/openstack/pre-install.yml
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' }
39 changes: 39 additions & 0 deletions playbooks/provisioning/openstack/pre_tasks.yml
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
49 changes: 49 additions & 0 deletions playbooks/provisioning/openstack/provision-openstack.yml
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
Loading