This commit is contained in:
2020-08-17 12:06:41 -04:00
parent 9fa09f26bd
commit 6eb48873e6
455 changed files with 45184 additions and 14 deletions

View File

@@ -0,0 +1,29 @@
---
language: python
python: "2.7"
# Use the new container infrastructure
sudo: false
# Install ansible
addons:
apt:
packages:
- python-pip
install:
# Install ansible
- pip install ansible
# Check ansible version
- ansible --version
# Create ansible.cfg with correct roles_path
- printf '[defaults]\nroles_path=../' >ansible.cfg
script:
# Basic role syntax check
- ansible-playbook tests/test.yml -i tests/inventory --syntax-check
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/

View File

@@ -0,0 +1,21 @@
MIT License
Copyright (c) 2019 Orcun Atakan
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

View File

@@ -0,0 +1,41 @@
# ansible-role-windows_ovirt_guest_agent
This repo contains an Ansible role that installs ovirt agent for Windows images.
Role Name
Requirements
------------
Any pre-requisites that may not be covered by Ansible itself or the role should be mentioned here. For instance, if the role uses the EC2 module, it may be a good idea to mention in this section that the boto package is required.
Role Variables
--------------
A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well.
Dependencies
------------
A list of roles that this role utilizes:
- oatakan.windows_virtio
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:
- oatakan.windows_ovirt_guest_agent
License
-------
MIT
Author Information
------------------
Orcun Atakan

View File

@@ -0,0 +1,13 @@
---
ovirt_package: ovirt-guest-agent
ovirt_guest_agent_service_name: ovirt-guest-agent
ovirt_win_iso_url: https://resources.ovirt.org/pub/ovirt-4.3/iso/oVirt-toolsSetup/4.3-3/el7/oVirt-toolsSetup-4.3-3.el7.iso
ovirt_win_iso_name: oVirt-toolsSetup.iso
virtio_role: oatakan.windows_virtio
windows_service_status_code:
1: Stopped
4: Running
9: Not Installed

View File

@@ -0,0 +1,7 @@
---
- name: restart Ovirt Guest Agent
service: name={{ ovirt_guest_agent_service_name }} state=restarted
- name: enabled Ovirt Guest Agent
service: name={{ ovirt_guest_agent_service_name }} enabled=yes

View File

@@ -0,0 +1,2 @@
install_date: Wed Jun 24 18:44:35 2020
version: master

View File

@@ -0,0 +1,28 @@
---
galaxy_info:
author: Orcun Atakan
description: Ansible galaxy role for installing ovirt agent on Windows images.
role_name: windows_ovirt_guest_agent
company: Red Hat
license: MIT
min_ansible_version: 2.5
platforms:
- name: Windows
versions:
- all
cloud_platforms:
- ovirt
galaxy_tags:
- windows
- ovirt
- rhev
- rhv
- cloud
- multicloud
dependencies: []

View File

@@ -0,0 +1,10 @@
---
- name: install Ovirt Guest Agent
become: true
package:
name: "{{ item }}"
with_items: "{{ ovirt_package }}"
notify:
- enabled Ovirt Guest Agent
- restart Ovirt Guest Agent

View File

@@ -0,0 +1,61 @@
---
- name: "{{ ansible_distribution | lower }} | import virtio role"
import_role:
name: "{{ virtio_role }}"
vars:
virtio_win_iso_url: "{{ ovirt_win_iso_url }}"
virtio_win_iso_name: "{{ ovirt_win_iso_name }}"
virtio_win_ovirt: true
virtio_win_iso_path: ''
- debug:
var: virtio_win_iso_path
#- name: "{{ ansible_distribution | lower }} | install Ovirt Guest Agent"
# win_dsc:
# resource_name: Package
# Path: '{{ virtio_win_iso_path }}\ovirt-guest-tools-setup.exe'
# ProductId: '{9B265631-958D-415B-9925-53DEEC43E31D}'
# Name: QEMU guest agent
# Arguments: >
# /S
- name: "{{ ansible_distribution | lower }} | install Ovirt Guest Agent"
win_shell: '{{ virtio_win_iso_path }}\ovirt-guest-tools-setup.exe /S'
args:
executable: cmd
creates: "{{ ansible_env['ProgramFiles(x86)'] }}\\oVirt Guest Tools"
async: 1
poll: 0
ignore_errors: yes
- name: "{{ ansible_distribution | lower }} | wait for system to be online"
wait_for_connection:
connect_timeout: 10
sleep: 5
delay: 90
timeout: 300
- name: "{{ ansible_distribution | lower }} | get service information"
win_shell: Get-Service OVirtGuestService | ConvertTo-Json
register: register_service_info
ignore_errors: yes
- name: "{{ ansible_distribution | lower }} | set fact from service info"
set_fact:
ovirt_guest_agent_service_status: "{{ register_service_info.stdout | default('DEFAULT') | from_json }}"
when: register_service_info is success
ignore_errors: yes
- name: "{{ ansible_distribution | lower }} | set fact as not installed"
set_fact:
ovirt_guest_agent_service_status:
DisplayName: 'ovirt-guest-agent'
Status: 9
when: register_service_info is undefined
- name: "{{ ansible_distribution | lower }} | service display status"
debug:
msg: "{{ ovirt_guest_agent_service_status['DisplayName'] }} is {{ windows_service_status_code[ovirt_guest_agent_service_status['Status']] | lower }}"
when: ovirt_guest_agent_service_status is defined

View File

@@ -0,0 +1,7 @@
---
- name: include distribution task
include_tasks: "{{ ansible_os_family }}.yml"
- name: force all notified handlers to run here
meta: flush_handlers

View File

@@ -0,0 +1 @@
localhost

View File

@@ -0,0 +1,10 @@
---
- hosts: localhost
remote_user: Administrator
vars:
ansible_port: 5986
ansible_connection: winrm
ansible_winrm_transport: credssp
ansible_winrm_server_cert_validation: ignore
roles:
- oatakan.windows_ovirt_guest_agent