add and update ansible playbooks for infra
- [openstack_user_config]: remove NFS in favor of (properly isntalled) iscsi - [openstack_user_config]: remove extraneous config in favor of shorter version - [storage] install and enable targetd (target.service) - [ansible] only run 'infra' tags on the first infra host - never on an AIO - [ansible] change roles to use the ``host`` extra var to configure where to run to mitigate accidents - [ansible] add aio steps to infra playbook - [ansible] add storage host playbook to configure volumes and iscsi - [ansible] aio: configure volume groups
This commit is contained in:
parent
98971618cd
commit
9c87fb8c87
@ -71,19 +71,19 @@ x-storage-hosts: &x-storage-hosts
|
|||||||
container_vars:
|
container_vars:
|
||||||
cinder_backends:
|
cinder_backends:
|
||||||
limit_container_types: cinder_volume
|
limit_container_types: cinder_volume
|
||||||
nfs_volume:
|
#nfs_volume:
|
||||||
volume_backend_name: NFS_VOLUME1
|
# volume_backend_name: NFS_VOLUME1
|
||||||
volume_driver: cinder.volume.drivers.nfs.NfsDriver
|
# volume_driver: cinder.volume.drivers.nfs.NfsDriver
|
||||||
nfs_mount_options: "rsize=65535,wsize=65535,timeo=1200,actimeo=120"
|
# nfs_mount_options: "rsize=65535,wsize=65535,timeo=1200,actimeo=120"
|
||||||
nfs_shares_config: /etc/cinder/nfs_shares
|
# nfs_shares_config: /etc/cinder/nfs_shares
|
||||||
shares:
|
# shares:
|
||||||
- ip: "172.29.228.7"
|
# - ip: "172.29.228.7"
|
||||||
share: "/vol/cinder"
|
# share: "/vol/cinder"
|
||||||
#lvm:
|
lvm:
|
||||||
# volume_group: cinder-volumes
|
volume_group: cinder-volumes
|
||||||
# volume_driver: cinder.volume.drivers.lvm.LVMVolumeDriver
|
volume_driver: cinder.volume.drivers.lvm.LVMVolumeDriver
|
||||||
# volume_backend_name: LVM_iSCSI
|
volume_backend_name: LVM_iSCSI
|
||||||
# iscsi_ip_address: "172.29.228.7"
|
iscsi_ip_address: "172.29.228.7"
|
||||||
|
|
||||||
##
|
##
|
||||||
## Infrastructure
|
## Infrastructure
|
||||||
@ -117,84 +117,3 @@ compute_hosts:
|
|||||||
<<: *x-compute-hosts
|
<<: *x-compute-hosts
|
||||||
storage_hosts:
|
storage_hosts:
|
||||||
<<: *x-storage-hosts
|
<<: *x-storage-hosts
|
||||||
|
|
||||||
###
|
|
||||||
### Infrastructure
|
|
||||||
###
|
|
||||||
|
|
||||||
## galera, memcache, rabbitmq, utility
|
|
||||||
#shared-infra_hosts:
|
|
||||||
# infra1:
|
|
||||||
# ip: 172.29.220.5
|
|
||||||
#
|
|
||||||
## repository (apt cache, python packages, etc)
|
|
||||||
#repo-infra_hosts:
|
|
||||||
# infra1:
|
|
||||||
# ip: 172.29.220.5
|
|
||||||
#
|
|
||||||
## load balancer
|
|
||||||
#haproxy_hosts:
|
|
||||||
# infra1:
|
|
||||||
# ip: 172.29.220.5
|
|
||||||
#
|
|
||||||
####
|
|
||||||
#### OpenStack
|
|
||||||
####
|
|
||||||
#
|
|
||||||
## keystone
|
|
||||||
#identity_hosts:
|
|
||||||
# infra1:
|
|
||||||
# ip: 172.29.220.5
|
|
||||||
#
|
|
||||||
## cinder api services
|
|
||||||
#storage-infra_hosts:
|
|
||||||
# infra1:
|
|
||||||
# ip: 172.29.220.5
|
|
||||||
#
|
|
||||||
## glance
|
|
||||||
#image_hosts:
|
|
||||||
# infra1:
|
|
||||||
# ip: 172.29.220.5
|
|
||||||
#
|
|
||||||
## placement
|
|
||||||
#placement-infra_hosts:
|
|
||||||
# infra1:
|
|
||||||
# ip: 172.29.220.5
|
|
||||||
#
|
|
||||||
## nova api, conductor, etc services
|
|
||||||
#compute-infra_hosts:
|
|
||||||
# infra1:
|
|
||||||
# ip: 172.29.220.5
|
|
||||||
#
|
|
||||||
## heat
|
|
||||||
#orchestration_hosts:
|
|
||||||
# infra1:
|
|
||||||
# ip: 172.29.220.5
|
|
||||||
#
|
|
||||||
## horizon
|
|
||||||
#dashboard_hosts:
|
|
||||||
# infra1:
|
|
||||||
# ip: 172.29.220.5
|
|
||||||
#
|
|
||||||
## neutron server, agents (L3, etc)
|
|
||||||
#network_hosts:
|
|
||||||
# infra1:
|
|
||||||
# ip: 172.29.220.5
|
|
||||||
#
|
|
||||||
## nova hypervisors
|
|
||||||
#compute_hosts:
|
|
||||||
# compute1:
|
|
||||||
# ip: 172.29.220.6
|
|
||||||
#
|
|
||||||
## cinder storage host (LVM-backed)
|
|
||||||
#storage_hosts:
|
|
||||||
# storage1:
|
|
||||||
# ip: 172.29.220.7
|
|
||||||
# container_vars:
|
|
||||||
# cinder_backends:
|
|
||||||
# limit_container_types: cinder_volume
|
|
||||||
# lvm:
|
|
||||||
# volume_group: cinder-volumes
|
|
||||||
# volume_driver: cinder.volume.drivers.lvm.LVMVolumeDriver
|
|
||||||
# volume_backend_name: LVM_iSCSI
|
|
||||||
# iscsi_ip_address: "172.29.228.7"
|
|
||||||
|
@ -3,3 +3,9 @@
|
|||||||
service:
|
service:
|
||||||
name: sshd
|
name: sshd
|
||||||
state: restarted
|
state: restarted
|
||||||
|
- name: enable_targetd
|
||||||
|
shell: "systemctl enable --now target"
|
||||||
|
- name: restart_targetd
|
||||||
|
service:
|
||||||
|
name: target
|
||||||
|
state: restarted
|
||||||
|
@ -65,7 +65,7 @@
|
|||||||
when: sshkey_register.ssh_public_key != ""
|
when: sshkey_register.ssh_public_key != ""
|
||||||
register: sshkey_fetch
|
register: sshkey_fetch
|
||||||
|
|
||||||
when: tag.find("infra") != -1
|
when: tag.find("infra") != -1 and name == "infra1"
|
||||||
tags:
|
tags:
|
||||||
- infra
|
- infra
|
||||||
- sshkey
|
- sshkey
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
---
|
---
|
||||||
|
|
||||||
- name: Bootstrap
|
- name: Bootstrap
|
||||||
hosts: infra1
|
hosts: "{{ host }}"
|
||||||
become: true
|
become: true
|
||||||
|
|
||||||
handlers:
|
handlers:
|
||||||
@ -43,6 +43,7 @@
|
|||||||
- bootstrap
|
- bootstrap
|
||||||
|
|
||||||
- name: Deploy and setup configuration
|
- name: Deploy and setup configuration
|
||||||
|
when: not aio_install | default('true') # bootstrap-AIO script instead does these things.
|
||||||
block:
|
block:
|
||||||
- name: Copy template to etc
|
- name: Copy template to etc
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
@ -50,16 +51,15 @@
|
|||||||
src: /opt/openstack-ansible/etc/openstack_deploy/
|
src: /opt/openstack-ansible/etc/openstack_deploy/
|
||||||
dest: /etc/openstack_deploy/
|
dest: /etc/openstack_deploy/
|
||||||
directory_mode: yes
|
directory_mode: yes
|
||||||
|
force: no
|
||||||
|
|
||||||
- name: Copy our openstack configs
|
- name: Copy distributed openstack configs
|
||||||
ansible.builtin.copy:
|
ansible.builtin.copy:
|
||||||
src: "files/{{ item }}.yml"
|
src: "files/{{ item }}.yml"
|
||||||
dest: /etc/openstack_deploy/
|
dest: /etc/openstack_deploy/
|
||||||
mode: '0644'
|
mode: '0644'
|
||||||
with_items:
|
with_items:
|
||||||
- openstack_user_config
|
- openstack_user_config
|
||||||
- user_lxc
|
|
||||||
- user_galera
|
|
||||||
|
|
||||||
- name: Create secrets
|
- name: Create secrets
|
||||||
become: true
|
become: true
|
||||||
@ -69,6 +69,38 @@
|
|||||||
args:
|
args:
|
||||||
creates: /etc/openstack_deploy/user_secrets.yml.tar
|
creates: /etc/openstack_deploy/user_secrets.yml.tar
|
||||||
|
|
||||||
|
- name: "[AIO] Deploy and setup configuration / bootstrap"
|
||||||
|
when: aio_install | default('false')
|
||||||
|
block:
|
||||||
|
- name: Debug - Running AIO bootstrap
|
||||||
|
debug:
|
||||||
|
var: aio_install
|
||||||
|
|
||||||
|
- name: Run bootstrap ansible with included args
|
||||||
|
ansible.builtin.shell: scripts/bootstrap-aio.sh
|
||||||
|
become: true
|
||||||
|
args:
|
||||||
|
chdir: /opt/openstack-ansible/
|
||||||
|
creates: /etc/openstack_deploy/
|
||||||
|
tags:
|
||||||
|
- bootstrap
|
||||||
|
- aio
|
||||||
|
|
||||||
|
- name: Create volume group for cinder
|
||||||
|
lvg:
|
||||||
|
pv_options: --metadatasize=2048
|
||||||
|
pvs: "{{ cinder_pv_device | default('/dev/vdb') }}"
|
||||||
|
vg: cinder-volumes
|
||||||
|
|
||||||
|
- name: Copy common openstack configs
|
||||||
|
ansible.builtin.copy:
|
||||||
|
src: "files/{{ item }}.yml"
|
||||||
|
dest: /etc/openstack_deploy/
|
||||||
|
mode: '0644'
|
||||||
|
with_items:
|
||||||
|
- user_lxc
|
||||||
|
- user_galera
|
||||||
|
|
||||||
|
|
||||||
- name: Check playbooks
|
- name: Check playbooks
|
||||||
tags: syntax
|
tags: syntax
|
||||||
|
49
ansible/playbooks/role-storage-host.yml
Normal file
49
ansible/playbooks/role-storage-host.yml
Normal file
@ -0,0 +1,49 @@
|
|||||||
|
---
|
||||||
|
# Setup the storage host. Install targetcli and make sure any volumes are mounted.
|
||||||
|
|
||||||
|
- name: Storage Host Configuration
|
||||||
|
hosts: storage1
|
||||||
|
become: true
|
||||||
|
|
||||||
|
handlers:
|
||||||
|
- import_tasks: handlers/main.yml
|
||||||
|
|
||||||
|
pre_tasks:
|
||||||
|
- name: Check if ansible cannot be run here
|
||||||
|
stat:
|
||||||
|
path: /etc/no-ansible
|
||||||
|
register: no_ansible
|
||||||
|
|
||||||
|
- name: Verify if we can run ansible
|
||||||
|
assert:
|
||||||
|
that:
|
||||||
|
- "not no_ansible.stat.exists"
|
||||||
|
success_msg: "We are able to run on this node"
|
||||||
|
fail_msg: "/etc/no-ansible exists - skipping run on this node"
|
||||||
|
|
||||||
|
tasks:
|
||||||
|
- name: Loading Variables from OS Common
|
||||||
|
import_tasks: tasks/common_vars.yml
|
||||||
|
|
||||||
|
- name: Install required packages
|
||||||
|
become: true
|
||||||
|
dnf:
|
||||||
|
name: targetcli
|
||||||
|
notify: enable_targetd
|
||||||
|
|
||||||
|
- name: Create volume group for cinder
|
||||||
|
lvg:
|
||||||
|
pv_options: --metadatasize=2048
|
||||||
|
pvs: "{{ cinder_pv_device | default('/dev/vdb') }}"
|
||||||
|
vg: cinder-volumes
|
||||||
|
|
||||||
|
|
||||||
|
post_tasks:
|
||||||
|
- name: Touching run file that ansible has ran here
|
||||||
|
file:
|
||||||
|
path: /var/log/ansible.run
|
||||||
|
state: touch
|
||||||
|
mode: '0644'
|
||||||
|
owner: root
|
||||||
|
group: root
|
||||||
|
...
|
Loading…
Reference in New Issue
Block a user