AdvancedLinuxAdmin/ansible/playbooks/role-storage-host.yml

50 lines
1.2 KiB
YAML
Raw Normal View History

---
# 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
...