-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #1 from hostdime/deployment_updates
Deployment updates
- Loading branch information
Showing
30 changed files
with
236 additions
and
219 deletions.
There are no files selected for viewing
This file contains 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 |
---|---|---|
@@ -1,5 +1,6 @@ | ||
# Ansible | ||
external_roles/* | ||
*.retry | ||
|
||
# Byte-compiled / optimized / DLL files | ||
__pycache__/ | ||
|
This file contains 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 |
---|---|---|
@@ -1,30 +1,100 @@ | ||
# autodeploy | ||
Deployment automation efforts for PF9 pre-reqs, host agent, and authorization. | ||
|
||
Deployment automation efforts for Platform9's prerequisites, host agent(s), and authorization via the use of Ansible. | ||
|
||
|
||
## Requirements | ||
|
||
* Ansible 2 | ||
* Python 2 | ||
* shade | ||
|
||
|
||
## Instructions | ||
|
||
After cloning the repo you'll need to create the following files. | ||
Clone the repository. | ||
``` | ||
$ git clone https://github.com/platform9/autodeploy.git | ||
$ cd autodeploy/ | ||
``` | ||
|
||
After cloning the repository, it is required to configure the variables for deployment. | ||
``` | ||
# cp -a group_vars/all_example.yml group_vars/all.yml | ||
# vim group_vars/all.yml | ||
``` | ||
|
||
The SSH connection details for the hypervisor (Nova) and/or image (Glance) nodes should be defined in a new inventory file. | ||
``` | ||
# vim production | ||
``` | ||
|
||
Finally, the Playbook can be run. | ||
``` | ||
# ansible-playbook -i production site.yml | ||
``` | ||
|
||
|
||
### Variables | ||
|
||
Hypervisor required variables: | ||
|
||
### group_vars/all.yml | ||
* group_vars/all.yml | ||
* os_region = OpenStack region. | ||
* os_username = OpenStack admin username. | ||
* os_password: OpenStack password. | ||
* os_tenant: OpenStack admin project. | ||
* du_url = The unique URL provided by Platform9 to access the controller resources. | ||
|
||
ssh_user: root | ||
os_region: <OS region> | ||
os_username: <username> | ||
os_password: <password> | ||
os_tenant: <tenant name> | ||
du_url: <DU_UR> | ||
Image node required variable: | ||
|
||
### inventory/hypervisors | ||
* group_vars/all.yml | ||
* pf9_id | ||
|
||
[hypervisors] | ||
<fqdn> ansible_host=<ip> | ||
Optional variables: | ||
|
||
## Example Playbook | ||
* group_vars/all.yml | ||
* manage_hostname = Boolean value. Set the hostname equal to the Ansible inventory_hostname for the host. | ||
* manage_resolvers = Boolean value. Append servers listed in the "dns_resolvers" variable to the resolvers file. | ||
* dns_resolvers = The DNS resolvers to use for the remote node. | ||
|
||
|
||
### Inventory | ||
|
||
All of the hypervisor nodes should be listed in the inventory file. They should be under the "hypervisors" group. Each node should be named after their fully qualified domain name (FQDN) that will be used as the hostname. Here are a few examples for creating Ansible inventory connection details based on common scenarios. | ||
|
||
* SSH directly in as root. | ||
``` | ||
<FQDN> ansible_host=<IP> ansible_port=<SSH_PORT> ansible_user=root | ||
``` | ||
|
||
* SSH in as a privileged user and run Ansible tasks using "sudo." | ||
``` | ||
<FQDN> ansible_host=<IP> ansible_port=<SSH_PORT> ansible_become=True ansible_user=<SSH_USER> ansible_become_method=sudo | ||
``` | ||
|
||
* SSH in as a privileged user and then switch to the root user with "su" to run Ansible tasks. | ||
``` | ||
<FQDN> ansible_host=<IP> ansible_port=<SSH_PORT> ansible_become=True ansible_user=<SSH_USER> ansible_become_method=su ansible_user=<SSH_USER> | ||
``` | ||
|
||
* Hypervisor and image storage group inventory example: | ||
``` | ||
# vim production | ||
compute01.domain.tld ansible_host=10.0.0.11 ansible_port=2222 ansibler_user=root | ||
compute02.domain.tld ansible_host=10.0.0.12 ansible_become=True ansible_user=bob ansible_become_method=sudo | ||
compute03.domain.tld ansible_host=10.0.0.13 ansible_port=2222 ansible_become=True ansible_user=joe ansible_become_method=su | ||
image01.domain.tld ansible_host=10.0.0.71 | ||
image02.domain.tld ansible_host=10.0.0.72 | ||
[hypervisors] | ||
compute[01:03].domain.tld | ||
[image_storage] | ||
image[01:02].domain.tld | ||
``` | ||
|
||
- hosts: hypervisors | ||
roles: | ||
- neutron-prerequisites | ||
- pf9-hostagent | ||
|
||
## License | ||
|
||
Commerical |
This file contains 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,2 @@ | ||
all.yml | ||
all.yaml |
This file was deleted.
Oops, something went wrong.
This file contains 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 @@ | ||
--- | ||
# Set hostname equal to inventory_hostname | ||
manage_hostname: False | ||
# Append DNS resolvers to /etc/resolv.conf | ||
manage_resolvers: False | ||
dns_resolvers: | ||
- 8.8.8.8 | ||
- 8.8.4.4 | ||
# these variables are required to be filled in for the end-user's environment | ||
os_username: | ||
os_password: | ||
os_region: | ||
os_tenant: | ||
du_url: |
This file contains 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
This file contains 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,40 @@ | ||
--- | ||
- name: Check for hardware virtualization support | ||
# svm - AMD SVM | ||
# vmx - Intel VT-x | ||
command: "grep -Eiq '(svm|vmx)' /proc/cpuinfo" | ||
ignore_errors: True | ||
changed_when: hw_virt.rc != 0 | ||
register: hw_virt | ||
when: inventory_hostname in groups.hypervisors | ||
|
||
- name: Quitting if hardware virtualization is not enabled | ||
fail: | ||
msg: "Hardware virtualization is not present, or not enabled." | ||
when: hw_virt|failed and | ||
inventory_hostname in groups.hypervisors | ||
|
||
- name: Set system hostname | ||
hostname: | ||
name: "{{ inventory_hostname }}" | ||
register: hostname_result | ||
|
||
- name: Update /etc/hosts to reflect hostname change | ||
lineinfile: | ||
state: present | ||
dest: /etc/hosts | ||
regexp: "^(127.0.0.1).*$" | ||
line: "127.0.0.1\t{{ inventory_hostname_short }}\t{{ inventory_hostname }}\tlocalhost" | ||
register: etc_hosts_result | ||
|
||
- name: Set DNS resolvers | ||
lineinfile: | ||
state: present | ||
dest: /etc/resolv.conf | ||
create: yes | ||
line: "nameserver {{ item }}" | ||
with_items: "{{ dns_resolvers }}" | ||
when: manage_resolvers == True | ||
|
||
- include: redhat.yml | ||
when: ansible_os_family == "RedHat" |
This file contains 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,20 @@ | ||
--- | ||
- name: Install libselinux-python | ||
yum: | ||
state: present | ||
name: libselinux-python | ||
|
||
- name: Modify devpts mount point | ||
mount: | ||
state: present | ||
name: /dev/pts | ||
src: devpts | ||
fstype: devpts | ||
opts: gid=5,mode=620 | ||
dump: 0 | ||
passno: 0 | ||
register: devpts_result | ||
|
||
- name: Remount devpts mount point | ||
command: mount -o remount devpts | ||
when: devpts_result|changed |
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file was deleted.
Oops, something went wrong.
This file contains 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
This file contains 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
Oops, something went wrong.