Merge "Adds ansible code for iscsid and tgtd containers"
This commit is contained in:
commit
908a74d670
@ -37,3 +37,17 @@
|
||||
|
||||
- include: bootstrap_service.yml
|
||||
when: database_created
|
||||
|
||||
- name: Creating cinder targets volume
|
||||
kolla_docker:
|
||||
action: "create_volume"
|
||||
common_options: "{{ docker_common_options }}"
|
||||
name: "cinder"
|
||||
when: "{{ enable_iscsi | bool }}"
|
||||
|
||||
- name: Creating iscsi info volume
|
||||
kolla_docker:
|
||||
action: "create_volume"
|
||||
common_options: "{{ docker_common_options }}"
|
||||
name: "iscsi_info"
|
||||
when: "{{ enable_iscsi | bool }}"
|
||||
|
@ -21,6 +21,16 @@
|
||||
- "kolla_logs:/var/log/kolla/"
|
||||
when: inventory_hostname in groups['cinder-scheduler']
|
||||
|
||||
- name: Prepare volumes list
|
||||
set_fact:
|
||||
mounts:
|
||||
- "{{ node_config_directory }}/cinder-volume/:{{ container_config_directory }}/:ro"
|
||||
- "/dev/:/dev/"
|
||||
- "/run/:/run/"
|
||||
- "{% if enable_iscsi | bool %}cinder:/var/lib/cinder{% endif %}"
|
||||
- "{% if enable_iscsi | bool %}iscsi_info:/etc/iscsi{% endif %}"
|
||||
- "kolla_logs:/var/log/kolla/"
|
||||
|
||||
- name: Starting cinder-volume container
|
||||
kolla_docker:
|
||||
action: "start_container"
|
||||
@ -28,11 +38,8 @@
|
||||
name: "cinder_volume"
|
||||
image: "{{ cinder_volume_image_full }}"
|
||||
privileged: True
|
||||
volumes:
|
||||
- "{{ node_config_directory }}/cinder-volume/:{{ container_config_directory }}/:ro"
|
||||
- "/dev/:/dev/"
|
||||
- "/run/:/run/"
|
||||
- "kolla_logs:/var/log/kolla/"
|
||||
ipc_mode: "host"
|
||||
volumes: '{{ mounts | reject("equalto", "") | list}}'
|
||||
when: inventory_hostname in groups['cinder-volume']
|
||||
|
||||
- name: Starting cinder-backup container
|
||||
|
13
ansible/roles/iscsi/defaults/main.yml
Normal file
13
ansible/roles/iscsi/defaults/main.yml
Normal file
@ -0,0 +1,13 @@
|
||||
---
|
||||
project_name: "iscsi"
|
||||
|
||||
####################
|
||||
# Docker
|
||||
####################
|
||||
iscsid_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-iscsid"
|
||||
iscsid_tag: "{{ openstack_release }}"
|
||||
iscsid_image_full: "{{ iscsid_image }}:{{ iscsid_tag }}"
|
||||
|
||||
tgtd_image: "{{ docker_registry ~ '/' if docker_registry else '' }}{{ docker_namespace }}/{{ kolla_base_distro }}-{{ kolla_install_type }}-tgtd"
|
||||
tgtd_tag: "{{ openstack_release }}"
|
||||
tgtd_image_full: "{{ tgtd_image }}:{{ tgtd_tag }}"
|
34
ansible/roles/iscsi/tasks/config.yml
Normal file
34
ansible/roles/iscsi/tasks/config.yml
Normal file
@ -0,0 +1,34 @@
|
||||
---
|
||||
- name: Ensuring config directories exist
|
||||
file:
|
||||
path: "{{ node_config_directory }}/{{ item }}"
|
||||
state: "directory"
|
||||
recurse: yes
|
||||
when: inventory_hostname in groups['compute']
|
||||
with_items:
|
||||
- "iscsid"
|
||||
|
||||
- name: Copying over config.json files for services
|
||||
template:
|
||||
src: "{{ item }}.json.j2"
|
||||
dest: "{{ node_config_directory }}/{{ item }}/config.json"
|
||||
when: inventory_hostname in groups['compute']
|
||||
with_items:
|
||||
- "iscsid"
|
||||
|
||||
- name: Ensuring config directories exist
|
||||
file:
|
||||
path: "{{ node_config_directory }}/{{ item }}"
|
||||
state: "directory"
|
||||
recurse: yes
|
||||
when: inventory_hostname in groups['tgtd']
|
||||
with_items:
|
||||
- "tgtd"
|
||||
|
||||
- name: Copying over config.json files for services
|
||||
template:
|
||||
src: "{{ item }}.json.j2"
|
||||
dest: "{{ node_config_directory }}/{{ item }}/config.json"
|
||||
when: inventory_hostname in groups['tgtd']
|
||||
with_items:
|
||||
- "tgtd"
|
4
ansible/roles/iscsi/tasks/deploy.yml
Normal file
4
ansible/roles/iscsi/tasks/deploy.yml
Normal file
@ -0,0 +1,4 @@
|
||||
---
|
||||
- include: config.yml
|
||||
|
||||
- include: start.yml
|
2
ansible/roles/iscsi/tasks/main.yml
Normal file
2
ansible/roles/iscsi/tasks/main.yml
Normal file
@ -0,0 +1,2 @@
|
||||
---
|
||||
- include: "{{ action }}.yml"
|
7
ansible/roles/iscsi/tasks/pull.yml
Normal file
7
ansible/roles/iscsi/tasks/pull.yml
Normal file
@ -0,0 +1,7 @@
|
||||
---
|
||||
- name: Pulling iscsi image
|
||||
kolla_docker:
|
||||
action: "pull_image"
|
||||
common_options: "{{ docker_common_options }}"
|
||||
image: "{{ iscsi_image_full }}"
|
||||
when: inventory_hostname in groups['iscsi']
|
1
ansible/roles/iscsi/tasks/reconfigure.yml
Normal file
1
ansible/roles/iscsi/tasks/reconfigure.yml
Normal file
@ -0,0 +1 @@
|
||||
---
|
40
ansible/roles/iscsi/tasks/start.yml
Normal file
40
ansible/roles/iscsi/tasks/start.yml
Normal file
@ -0,0 +1,40 @@
|
||||
---
|
||||
- name: Starting iscsid container
|
||||
kolla_docker:
|
||||
action: "start_container"
|
||||
common_options: "{{ docker_common_options }}"
|
||||
image: "{{ iscsid_image_full }}"
|
||||
name: "iscsid"
|
||||
ipc_mode: "host"
|
||||
privileged: True
|
||||
volumes:
|
||||
- "{{ node_config_directory }}/iscsid/:{{ container_config_directory }}/:ro"
|
||||
- "kolla_logs:/var/log/kolla/"
|
||||
- "/dev/:/dev/"
|
||||
- "/run/:/run/"
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
||||
- "/lib/modules:/lib/modules:ro"
|
||||
- "/sys/kernel/config:/configfs"
|
||||
- "cinder:/var/lib/cinder"
|
||||
- "iscsi_info:/etc/iscsi"
|
||||
when: inventory_hostname in groups['compute']
|
||||
|
||||
- name: Starting tgtd container
|
||||
kolla_docker:
|
||||
action: "start_container"
|
||||
common_options: "{{ docker_common_options }}"
|
||||
image: "{{ tgtd_image_full }}"
|
||||
name: "tgtd"
|
||||
ipc_mode: "host"
|
||||
privileged: True
|
||||
volumes:
|
||||
- "{{ node_config_directory }}/tgtd/:{{ container_config_directory }}/:ro"
|
||||
- "kolla_logs:/var/log/kolla/"
|
||||
- "/dev/:/dev/"
|
||||
- "/run/:/run/"
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup:ro"
|
||||
- "/lib/modules:/lib/modules:ro"
|
||||
- "/sys/kernel/config:/configfs"
|
||||
- "cinder:/var/lib/cinder"
|
||||
- "iscsi_info:/etc/iscsi"
|
||||
when: inventory_hostname in groups['tgtd']
|
1
ansible/roles/iscsi/tasks/upgrade.yml
Normal file
1
ansible/roles/iscsi/tasks/upgrade.yml
Normal file
@ -0,0 +1 @@
|
||||
---
|
4
ansible/roles/iscsi/templates/iscsid.json.j2
Normal file
4
ansible/roles/iscsi/templates/iscsid.json.j2
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"command": "iscsid -d 8 -f --pid=/run/iscsid.pid",
|
||||
"config_files": []
|
||||
}
|
4
ansible/roles/iscsi/templates/tgtd.json.j2
Normal file
4
ansible/roles/iscsi/templates/tgtd.json.j2
Normal file
@ -0,0 +1,4 @@
|
||||
{
|
||||
"command": "tgtd -d 1 -f --iscsi portal={{ hostvars[inventory_hostname]['ansible_' + network_interface]['ipv4']['address'] }}:{{ iscsi_port }}",
|
||||
"config_files": []
|
||||
}
|
@ -11,12 +11,25 @@
|
||||
- "{{ node_config_directory }}/nova-libvirt/:{{ container_config_directory }}/:ro"
|
||||
- "/lib/modules:/lib/modules:ro"
|
||||
- "/run/:/run/"
|
||||
- "/dev:/dev"
|
||||
- "/sys/fs/cgroup:/sys/fs/cgroup"
|
||||
- "kolla_logs:/var/log/kolla/"
|
||||
- "libvirtd:/var/lib/libvirt"
|
||||
- "nova_compute:/var/lib/nova/"
|
||||
when: inventory_hostname in groups['compute']
|
||||
|
||||
- name: Prepare volumes list
|
||||
set_fact:
|
||||
mounts:
|
||||
- "{{ node_config_directory }}/nova-compute/:{{ container_config_directory }}/:ro"
|
||||
- "/lib/modules:/lib/modules:ro"
|
||||
- "/run:/run"
|
||||
- "/dev:/dev"
|
||||
- "kolla_logs:/var/log/kolla/"
|
||||
- "{% if enable_iscsi | bool %}iscsi_info:/etc/iscsi{% endif %}"
|
||||
- "libvirtd:/var/lib/libvirt"
|
||||
- "nova_compute:/var/lib/nova/"
|
||||
|
||||
- name: Starting nova-compute container
|
||||
kolla_docker:
|
||||
action: "start_container"
|
||||
@ -24,13 +37,7 @@
|
||||
image: "{{ nova_compute_image_full }}"
|
||||
name: "nova_compute"
|
||||
privileged: True
|
||||
volumes:
|
||||
- "{{ node_config_directory }}/nova-compute/:{{ container_config_directory }}/:ro"
|
||||
- "/lib/modules:/lib/modules:ro"
|
||||
- "/run:/run"
|
||||
- "kolla_logs:/var/log/kolla/"
|
||||
- "libvirtd:/var/lib/libvirt"
|
||||
- "nova_compute:/var/lib/nova/"
|
||||
volumes: '{{ mounts | reject("equalto", "") | list}}'
|
||||
when:
|
||||
- inventory_hostname in groups['compute']
|
||||
- not enable_nova_fake | bool
|
||||
|
Loading…
Reference in New Issue
Block a user