From 9563af3300b826af91d1191f83448d85c48600a9 Mon Sep 17 00:00:00 2001 From: Lukas Bednar Date: Tue, 23 Aug 2016 10:39:21 +0200 Subject: [PATCH] Add engine-config role (#49) Fix #49 --- roles/ovirt-engine-config/README.md | 63 ++++++++++++++++++++++++ roles/ovirt-engine-config/meta/main.yml | 13 +++++ roles/ovirt-engine-config/tasks/main.yml | 35 +++++++++++++ 3 files changed, 111 insertions(+) create mode 100644 roles/ovirt-engine-config/README.md create mode 100644 roles/ovirt-engine-config/meta/main.yml create mode 100644 roles/ovirt-engine-config/tasks/main.yml diff --git a/roles/ovirt-engine-config/README.md b/roles/ovirt-engine-config/README.md new file mode 100644 index 0000000..2be38b6 --- /dev/null +++ b/roles/ovirt-engine-config/README.md @@ -0,0 +1,63 @@ +oVirt engine config +=================== + +This role allows tune installed engine using ``engine-config`` CLI tool. + + +Requirements +------------ + +oVirt installed and running. + + +Role Variables +-------------- + +You can specify options one by one. + +``` +ovirt_engine_config: + - + key: "option name" + value: "option value" + version: desired-version +``` + +Or specify set of options in property file. +This way is preferable when you want to set passwords. + +``` +ovirt_engine_config_property_file: "properties content" +``` + + +Dependencies +------------ + +None + + +Example Playbook +---------------- + +```yaml +--- +hosts: engine + remote_user: root + vars: + ovirt_engine_config: + - + key: "EnableMACAntiSpoofingFilterRules" + value: false + version: "general" + roles: + - + role: "ovirt_engine_config" +``` + + +Author Information +------------------ + +Lukas Bednar +lbednar@redhat.com diff --git a/roles/ovirt-engine-config/meta/main.yml b/roles/ovirt-engine-config/meta/main.yml new file mode 100644 index 0000000..ff7be66 --- /dev/null +++ b/roles/ovirt-engine-config/meta/main.yml @@ -0,0 +1,13 @@ +--- +galaxy_info: + author: "Lukas Bednar" + description: "oVirt engine config tool" + company: "Red Hat" + license: "GPLv3" + min_ansible_version: 1.9 + platforms: + - name: EL + versions: + - all + galaxy_tags: + - installer diff --git a/roles/ovirt-engine-config/tasks/main.yml b/roles/ovirt-engine-config/tasks/main.yml new file mode 100644 index 0000000..848ec23 --- /dev/null +++ b/roles/ovirt-engine-config/tasks/main.yml @@ -0,0 +1,35 @@ +--- +- name: Tune oVirt engine with engine-config, version specific + shell: "engine-config -s {{ item.key }}='{{ item.value }}' --cver={{ item.version }}" + with_items: "{{ ovirt_engine_config | list }}" + when: ovirt_engine_config is defined and item.version != "general" + +- name: Tune oVirt engine with engine-config, regardless version + shell: "engine-config -s {{ item.key }}='{{ item.value }}'" + with_items: "{{ ovirt_engine_config | list }}" + when: ovirt_engine_config is defined and item.version == "general" + +- name: Copy property file to engine + copy: + content: "{{ ovirt_engine_config_property_file }}" + dest: "/tmp/ovirt_engine_config.properties" + when: ovirt_engine_config_property_file is defined + +- name: Tune oVirt engine with engine-config; from property file + shell: "engine-config --properties=/tmp/ovirt_engine_config.properties" + when: ovirt_engine_config_property_file is defined + +# oVirt engine restart is required +- name: restart of ovirt-engine service + service: + name: ovirt-engine + state: restarted + +- name: check health status of page + uri: + url: "http://localhost/ovirt-engine/services/health" + status_code: 200 + register: health_page + retries: 12 + delay: 10 + until: health_page|success