From 801f215bd2cd5341d63b5dd91298d23b11dc3553 Mon Sep 17 00:00:00 2001 From: Kenny Woodson Date: Tue, 26 May 2015 14:36:14 -0400 Subject: docker-storage role added --- roles/docker_storage/README.md | 39 ++++++++++++++++++++++++++++++++++ roles/docker_storage/defaults/main.yml | 1 + roles/docker_storage/handlers/main.yml | 1 + roles/docker_storage/meta/main.yml | 9 ++++++++ roles/docker_storage/tasks/main.yml | 37 ++++++++++++++++++++++++++++++++ roles/docker_storage/vars/main.yml | 1 + 6 files changed, 88 insertions(+) create mode 100644 roles/docker_storage/README.md create mode 100644 roles/docker_storage/defaults/main.yml create mode 100644 roles/docker_storage/handlers/main.yml create mode 100644 roles/docker_storage/meta/main.yml create mode 100644 roles/docker_storage/tasks/main.yml create mode 100644 roles/docker_storage/vars/main.yml (limited to 'roles/docker_storage') diff --git a/roles/docker_storage/README.md b/roles/docker_storage/README.md new file mode 100644 index 000000000..0d8f31afc --- /dev/null +++ b/roles/docker_storage/README.md @@ -0,0 +1,39 @@ +docker_storage +========= + +Configure docker_storage options +------------ + +None + +Role Variables +-------------- + +None + +Dependencies +------------ + +None + +Example Playbook +---------------- + +Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: + + - hosts: servers + roles: + - { role/docker_storage: + - key: df.fs + value: xfs + } + +License +------- + +ASL 2.0 + +Author Information +------------------ + +Openshift operations, Red Hat, Inc diff --git a/roles/docker_storage/defaults/main.yml b/roles/docker_storage/defaults/main.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/roles/docker_storage/defaults/main.yml @@ -0,0 +1 @@ +--- diff --git a/roles/docker_storage/handlers/main.yml b/roles/docker_storage/handlers/main.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/roles/docker_storage/handlers/main.yml @@ -0,0 +1 @@ +--- diff --git a/roles/docker_storage/meta/main.yml b/roles/docker_storage/meta/main.yml new file mode 100644 index 000000000..a5d51cd3a --- /dev/null +++ b/roles/docker_storage/meta/main.yml @@ -0,0 +1,9 @@ +--- +galaxy_info: + author: Openshift + description: Setup docker_storage options + company: Red Hat, Inc + license: ASL 2.0 + min_ansible_version: 1.2 +dependencies: +- docker diff --git a/roles/docker_storage/tasks/main.yml b/roles/docker_storage/tasks/main.yml new file mode 100644 index 000000000..48a3fc208 --- /dev/null +++ b/roles/docker_storage/tasks/main.yml @@ -0,0 +1,37 @@ +--- +- lvg: + pvs: "{{ dst_device }}" + vg: "{{ dst_vg }}" + register: dst_lvg + +- lvol: + lv: data + vg: "{{ dst_vg }}" + size: 95%VG + register: dst_lvol_data + +- lvol: + lv: metadata + vg: "{{ dst_vg }}" + size: 5%VG + register: dst_lvol_metadata + + +- name: Update docker_storage options + lineinfile: + dest: /etc/sysconfig/docker-storage + backrefs: yes + regexp: "^(DOCKER_STORAGE_OPTIONS=)" + line: '\1 --storage-opt {{ dst_options | oo_combine_key_value("=") | join(" --storage-opt ") }}' + when: dst_options is defined and dst_options | length > 0 + register: dst_config + + +- name: Reload systemd units + command: systemctl daemon-reload + notify: + - restart docker + when: dst_config | changed or + dst_lvg | changed or + dst_lvol_data | changed or + dst_lvol_metadata | changed diff --git a/roles/docker_storage/vars/main.yml b/roles/docker_storage/vars/main.yml new file mode 100644 index 000000000..ed97d539c --- /dev/null +++ b/roles/docker_storage/vars/main.yml @@ -0,0 +1 @@ +--- -- cgit v1.2.3