Initial testing commit
This commit is contained in:
commit
0273bf5fd0
23
playbooks/test-install-galera.yml
Normal file
23
playbooks/test-install-galera.yml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2015, Rackspace US, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
- name: Deploy galera
|
||||||
|
hosts: galera_all
|
||||||
|
user: root
|
||||||
|
gather_facts: true
|
||||||
|
roles:
|
||||||
|
- role: "galera_server"
|
||||||
|
vars_files:
|
||||||
|
- test-vars.yml
|
20
playbooks/test-install-infra.yml
Normal file
20
playbooks/test-install-infra.yml
Normal file
@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2015, Rackspace US, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
- include: test-install-memcached.yml
|
||||||
|
|
||||||
|
- include: test-install-rabbitmq.yml
|
||||||
|
|
||||||
|
- include: test-install-galera.yml
|
53
playbooks/test-install-keystone.yml
Normal file
53
playbooks/test-install-keystone.yml
Normal file
@ -0,0 +1,53 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2015, Rackspace US, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
- name: Playbook for deploying keystone
|
||||||
|
hosts: keystone_all
|
||||||
|
user: root
|
||||||
|
gather_facts: true
|
||||||
|
pre_tasks:
|
||||||
|
- name: Create DB for service
|
||||||
|
mysql_db:
|
||||||
|
login_user: "root"
|
||||||
|
login_password: "secrete"
|
||||||
|
login_host: "localhost"
|
||||||
|
name: "{{ keystone_galera_database }}"
|
||||||
|
state: "present"
|
||||||
|
delegate_to: "{{ groups['galera_all'][0] }}"
|
||||||
|
when: inventory_hostname == groups['keystone_all'][0]
|
||||||
|
tags:
|
||||||
|
- mysql-db-setup
|
||||||
|
- name: Grant access to the DB for the service
|
||||||
|
mysql_user:
|
||||||
|
login_user: "{{ galera_root_user }}"
|
||||||
|
login_password: "{{ galera_root_password }}"
|
||||||
|
login_host: "localhost"
|
||||||
|
name: "{{ keystone_galera_database }}"
|
||||||
|
password: "{{ keystone_container_mysql_password }}"
|
||||||
|
host: "{{ item }}"
|
||||||
|
state: "present"
|
||||||
|
priv: "{{ keystone_galera_database }}.*:ALL"
|
||||||
|
with_items:
|
||||||
|
- "localhost"
|
||||||
|
- "%"
|
||||||
|
delegate_to: "{{ groups['galera_all'][0] }}"
|
||||||
|
when: inventory_hostname == groups['keystone_all'][0]
|
||||||
|
tags:
|
||||||
|
- mysql-db-setup
|
||||||
|
roles:
|
||||||
|
- role: os_keystone
|
||||||
|
vars_files:
|
||||||
|
- test-vars.yml
|
||||||
|
|
23
playbooks/test-install-memcached.yml
Normal file
23
playbooks/test-install-memcached.yml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2015, Rackspace US, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
- name: Deploy galera
|
||||||
|
hosts: memcached_all
|
||||||
|
user: root
|
||||||
|
gather_facts: true
|
||||||
|
roles:
|
||||||
|
- role: "memcached_server"
|
||||||
|
vars_files:
|
||||||
|
- test-vars.yml
|
23
playbooks/test-install-rabbitmq.yml
Normal file
23
playbooks/test-install-rabbitmq.yml
Normal file
@ -0,0 +1,23 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2015, Rackspace US, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
- name: Deploy Rabbitmq
|
||||||
|
hosts: rabbitmq_all
|
||||||
|
user: root
|
||||||
|
gather_facts: true
|
||||||
|
roles:
|
||||||
|
- role: "rabbitmq_server"
|
||||||
|
vars_files:
|
||||||
|
- test-vars.yml
|
32
playbooks/test-install-swift.yml
Normal file
32
playbooks/test-install-swift.yml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2015, Rackspace US, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
- include: test-setup-swifthosts.yml
|
||||||
|
|
||||||
|
- name: Playbook for deploying swift
|
||||||
|
hosts: swift_all
|
||||||
|
user: root
|
||||||
|
gather_facts: true
|
||||||
|
pre_tasks:
|
||||||
|
- name: Set swift replication address (container)
|
||||||
|
set_fact:
|
||||||
|
replication_address: "{{ hostvars[inventory_hostname]['container_networks']['replication_address']['address'] }}"
|
||||||
|
when:
|
||||||
|
- inventory_hostname in groups['swift_all']
|
||||||
|
- hostvars[inventory_hostname]['container_networks']['replication_address']['address'] is defined
|
||||||
|
roles:
|
||||||
|
- role: "{{ rolename | basename }}"
|
||||||
|
vars_files:
|
||||||
|
- test-vars.yml
|
32
playbooks/test-prepare-containers.yml
Normal file
32
playbooks/test-prepare-containers.yml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2015, Rackspace US, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
- name: Playbook for creating containers
|
||||||
|
hosts: all_containers
|
||||||
|
gather_facts: false
|
||||||
|
roles:
|
||||||
|
- role: "lxc_container_create"
|
||||||
|
lxc_container_release: trusty
|
||||||
|
lxc_container_backing_store: dir
|
||||||
|
global_environment_variables:
|
||||||
|
PATH: "/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin"
|
||||||
|
post_tasks:
|
||||||
|
- name: Wait for ssh to be available
|
||||||
|
local_action:
|
||||||
|
module: wait_for
|
||||||
|
port: "{{ ansible_ssh_port | default('22') }}"
|
||||||
|
host: "{{ ansible_ssh_host | default(inventory_hostname) }}"
|
||||||
|
search_regex: OpenSSH
|
||||||
|
delay: 1
|
60
playbooks/test-prepare-host.yml
Normal file
60
playbooks/test-prepare-host.yml
Normal file
@ -0,0 +1,60 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2015, Rackspace US, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
- name: Playbook for configuring the LXC host
|
||||||
|
hosts: localhost
|
||||||
|
pre_tasks:
|
||||||
|
- name: Update apt cache
|
||||||
|
apt:
|
||||||
|
update_cache: yes
|
||||||
|
when: ansible_os_family == 'Debian'
|
||||||
|
- name: Ensure roots new public ssh key is in authorized_keys
|
||||||
|
authorized_key:
|
||||||
|
user: root
|
||||||
|
key: "{{ hostvars['localhost']['lxc_container_ssh_key'] }}"
|
||||||
|
manage_dir: no
|
||||||
|
- set_fact:
|
||||||
|
lxc_container_ssh_key: "{{ hostvars['localhost']['lxc_container_ssh_key'] }}"
|
||||||
|
- name: Check if this is an OpenStack-CI nodepool instance
|
||||||
|
stat:
|
||||||
|
path: /etc/nodepool/provider
|
||||||
|
register: nodepool
|
||||||
|
- name: Set the files to copy into the container cache for OpenStack-CI instances
|
||||||
|
set_fact:
|
||||||
|
lxc_container_cache_files:
|
||||||
|
- { src: '/etc/pip.conf', dest: '/etc/pip.conf' }
|
||||||
|
- { src: '/etc/apt/apt.conf.d/99unauthenticated', dest: '/etc/apt/apt.conf.d/99unauthenticated' }
|
||||||
|
when: nodepool.stat.exists | bool
|
||||||
|
- name: Determine the existing Ubuntu repo configuration
|
||||||
|
shell: 'awk "/^deb .*ubuntu\/? {{ ansible_distribution_release }} main/ {print \$2; exit}" /etc/apt/sources.list'
|
||||||
|
register: ubuntu_repo
|
||||||
|
changed_when: false
|
||||||
|
- name: Set apt repo facts based on discovered information
|
||||||
|
set_fact:
|
||||||
|
lxc_container_template_main_apt_repo: "{{ ubuntu_repo.stdout }}"
|
||||||
|
lxc_container_template_security_apt_rep: "{{ ubuntu_repo.stdout }}"
|
||||||
|
post_tasks:
|
||||||
|
- name: Create bridges
|
||||||
|
shell: /sbin/brctl addbr {{ item.name }} || true
|
||||||
|
with_items: bridges
|
||||||
|
- name: IP bridges
|
||||||
|
command: /sbin/ifconfig {{ item.name }} {{ item.ip_addr }} netmask 255.255.255.0
|
||||||
|
with_items: bridges
|
||||||
|
- name: Add iptables rule to ensure ssh checksum is correct
|
||||||
|
command: /sbin/iptables -A POSTROUTING -t mangle -p tcp --dport 22 -j CHECKSUM --checksum-fill
|
||||||
|
roles:
|
||||||
|
- role: "lxc_hosts"
|
||||||
|
vars_files:
|
||||||
|
- test-vars.yml
|
33
playbooks/test-prepare-keys.yml
Normal file
33
playbooks/test-prepare-keys.yml
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2015, Rackspace US, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# NOTE: we use become_user because setting become: no or become: false
|
||||||
|
# doesn't seem to override the ansible_become=true in the
|
||||||
|
# inventory
|
||||||
|
- name: Playbook for establishing ssh keys
|
||||||
|
hosts: localhost
|
||||||
|
become_user: "{{ ansible_ssh_user }}"
|
||||||
|
pre_tasks:
|
||||||
|
- name: Create ssh key pair for root
|
||||||
|
user:
|
||||||
|
name: "{{ ansible_ssh_user }}"
|
||||||
|
generate_ssh_key: "yes"
|
||||||
|
ssh_key_bits: 2048
|
||||||
|
ssh_key_file: ".ssh/id_rsa"
|
||||||
|
- name: Get the calling user's key
|
||||||
|
command: cat ~/.ssh/id_rsa.pub
|
||||||
|
register: key_get
|
||||||
|
- set_fact:
|
||||||
|
lxc_container_ssh_key: "{{ key_get.stdout }}"
|
86
playbooks/test-setup-swifthosts.yml
Normal file
86
playbooks/test-setup-swifthosts.yml
Normal file
@ -0,0 +1,86 @@
|
|||||||
|
---
|
||||||
|
# Copyright 2015, Rackspace US, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
- name: Swift setup
|
||||||
|
hosts: swift_hosts
|
||||||
|
user: root
|
||||||
|
gather_facts: true
|
||||||
|
pre_tasks:
|
||||||
|
- name: Ensure xfsprogs is installed on localhost
|
||||||
|
apt:
|
||||||
|
name: xfsprogs
|
||||||
|
state: present
|
||||||
|
delegate_to: "{{ physical_host }}"
|
||||||
|
run_once: true
|
||||||
|
- name: Ensure xfsprogs is installed on containers
|
||||||
|
apt:
|
||||||
|
name: xfsprogs
|
||||||
|
state: present
|
||||||
|
- name: Openstack directory Create
|
||||||
|
file:
|
||||||
|
state: directory
|
||||||
|
path: "/openstack/{{ item }}"
|
||||||
|
with_items:
|
||||||
|
- 'swift1'
|
||||||
|
- 'swift2'
|
||||||
|
- name: Create sparse Swift files
|
||||||
|
shell: "truncate -s 1024G /opt/{{container_name}}_{{ item }}.img"
|
||||||
|
args:
|
||||||
|
creates: "/opt/{{ container_name}}_{{ item }}.img"
|
||||||
|
with_items:
|
||||||
|
- 'swift1'
|
||||||
|
- 'swift2'
|
||||||
|
register: swift_create
|
||||||
|
delegate_to: "{{ physical_host }}"
|
||||||
|
- name: Format the Swift files
|
||||||
|
filesystem:
|
||||||
|
fstype: xfs
|
||||||
|
dev: "/opt/{{ container_name}}_{{ item }}.img"
|
||||||
|
when: swift_create | changed
|
||||||
|
with_items:
|
||||||
|
- 'swift1'
|
||||||
|
- 'swift2'
|
||||||
|
delegate_to: "{{ physical_host }}"
|
||||||
|
- name: Create the Swift fstab entries and mount the file systems
|
||||||
|
mount:
|
||||||
|
name: "/srv/{{ container_name }}_{{ item }}"
|
||||||
|
src: "/opt/{{ container_name }}_{{ item }}.img"
|
||||||
|
fstype: xfs
|
||||||
|
opts: 'loop,noatime,nodiratime,nobarrier,logbufs=8'
|
||||||
|
passno: 0
|
||||||
|
dump: 0
|
||||||
|
state: mounted
|
||||||
|
with_items:
|
||||||
|
- 'swift1'
|
||||||
|
- 'swift2'
|
||||||
|
register: mount_status
|
||||||
|
until: mount_status | success
|
||||||
|
retries: 5
|
||||||
|
delay: 2
|
||||||
|
delegate_to: "{{ physical_host }}"
|
||||||
|
- name: Swift extra lxc config
|
||||||
|
lxc_container:
|
||||||
|
name: "{{ container_name }}"
|
||||||
|
container_config:
|
||||||
|
- "lxc.mount.entry=/srv/{{ container_name }}_swift1 openstack/swift1 none bind 0 0"
|
||||||
|
- "lxc.mount.entry=/srv/{{ container_name }}_swift2 openstack/swift2 none bind 0 0"
|
||||||
|
delegate_to: "{{ physical_host }}"
|
||||||
|
- name: Wait for ssh to be available
|
||||||
|
local_action:
|
||||||
|
module: wait_for
|
||||||
|
port: "{{ ansible_ssh_port | default('22') }}"
|
||||||
|
host: "{{ ansible_ssh_host | default(inventory_hostname) }}"
|
||||||
|
search_regex: OpenSSH
|
||||||
|
delay: 1
|
31
playbooks/test.yml
Normal file
31
playbooks/test.yml
Normal file
@ -0,0 +1,31 @@
|
|||||||
|
opyright 2015, Rackspace US, Inc.
|
||||||
|
#
|
||||||
|
# Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
# you may not use this file except in compliance with the License.
|
||||||
|
# You may obtain a copy of the License at
|
||||||
|
#
|
||||||
|
# http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
#
|
||||||
|
# Unless required by applicable law or agreed to in writing, software
|
||||||
|
# distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
# See the License for the specific language governing permissions and
|
||||||
|
# limitations under the License.
|
||||||
|
|
||||||
|
# Prepare the user ssh keys
|
||||||
|
- include: test-prepare-keys.yml
|
||||||
|
|
||||||
|
# Prepare the host
|
||||||
|
- include: test-prepare-host.yml
|
||||||
|
|
||||||
|
# Prepare the containers
|
||||||
|
- include: test-prepare-containers.yml
|
||||||
|
|
||||||
|
# Install MariaDB/Memcached
|
||||||
|
- include: test-install-infra.yml
|
||||||
|
|
||||||
|
# Install Keystone
|
||||||
|
- include: test-install-keystone.yml
|
||||||
|
|
||||||
|
# Install Swift
|
||||||
|
- include: test-install-swift.yml
|
Loading…
x
Reference in New Issue
Block a user