Skip to content

Commit

Permalink
initial implementation
Browse files Browse the repository at this point in the history
  • Loading branch information
hswong3i committed Feb 19, 2020
1 parent b152c8e commit ed970fe
Show file tree
Hide file tree
Showing 58 changed files with 1,651 additions and 2 deletions.
6 changes: 6 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
*.log
*.orig
*.pyc
*.rej
*.retry
__pycache__
57 changes: 57 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
---

os: linux

dist: bionic

language: shell

env:
jobs:
- MOLECULE_SCENARIO_NAME="centos-7"
- MOLECULE_SCENARIO_NAME="suse-15"
- MOLECULE_SCENARIO_NAME="ubuntu-16.04"
- MOLECULE_SCENARIO_NAME="ubuntu-18.04"
- MOLECULE_SCENARIO_NAME="ubuntu-19.10"

jobs:
allow_failures:
- env: MOLECULE_SCENARIO_NAME="centos-7"
- env: MOLECULE_SCENARIO_NAME="suse-15"

before_install:
- |
curl -Os https://releases.hashicorp.com/vagrant/2.2.7/vagrant_2.2.7_x86_64.deb
curl -Os https://releases.hashicorp.com/vagrant/2.2.7/vagrant_2.2.7_SHA256SUMS
curl -Os https://releases.hashicorp.com/vagrant/2.2.7/vagrant_2.2.7_SHA256SUMS.sig
gpg --receive-key 51852D87348FFC4C
gpg --verify vagrant_2.2.7_SHA256SUMS.sig vagrant_2.2.7_SHA256SUMS
sha256sum -c vagrant_2.2.7_SHA256SUMS 2>&1 | grep OK
sudo apt-get update && sudo apt-get install -y bridge-utils dnsmasq-base ebtables libvirt-bin libvirt-dev qemu-kvm qemu-utils ruby-dev
sudo dpkg -i vagrant_2.2.7_x86_64.deb
sudo vagrant plugin install vagrant-libvirt
- |
sudo apt-get -y purge python3-openssl && sudo apt-get -y autoremove
sudo apt-get update && sudo apt-get install -y ca-certificates curl gcc iproute2 pwgen python3 python3-dev sudo
curl -skL https://bootstrap.pypa.io/get-pip.py | sudo -H python3
sudo -H pip3 install --upgrade --ignore-installed --requirement requirements.txt
install:
- |
export ROLE=$(echo $TRAVIS_REPO_SLUG | sed 's/^.*\/ansible-role-/\//g')
mkdir -p $HOME/.ansible/roles
ln -s $TRAVIS_BUILD_DIR $HOME/.ansible/roles/$ROLE
script:
- |
source ./scripts/run-tests.sh
sudo -E molecule dependency -s $MOLECULE_SCENARIO_NAME
sudo -E molecule lint -s $MOLECULE_SCENARIO_NAME
sudo -E molecule syntax -s $MOLECULE_SCENARIO_NAME
sudo -E molecule converge -s $MOLECULE_SCENARIO_NAME
travis_wait 120 sudo -E molecule idempotence -s $MOLECULE_SCENARIO_NAME
sudo -E molecule verify -s $MOLECULE_SCENARIO_NAME
notifications:
webhooks: https://galaxy.ansible.com/api/v1/notifications/
35 changes: 35 additions & 0 deletions .yamllint
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
---

extends: default

rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
colons:
max-spaces-after: -1
level: error
commas:
max-spaces-after: -1
level: error
comments: disable
comments-indentation: disable
document-start: disable
empty-lines:
max: 3
level: error
hyphens:
level: error
indentation:
spaces: 2
indent-sequences: true
key-duplicates: enable
line-length: disable
new-line-at-end-of-file: disable
new-lines:
type: unix
trailing-spaces: disable
truthy: disable
10 changes: 10 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Ansible Role for libvirt

## 4.3.0 - TBC

### Major Changes

## 4.2.0 - 2020-02-20

- Ininitial release for Ansible 2.9 or higher
- Support both Ubuntu 16.04/18.04/19.10 or RHEL/CentOS 7 or openSUSE Leap 15.1
39 changes: 37 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,37 @@
# ansible-role-libvirt
Ansible Role for libvirt Installation
# Ansible Role for libvirt

[![Travis](https://img.shields.io/travis/alvistack/ansible-role-libvirt.svg)](https://travis-ci.org/alvistack/ansible-role-libvirt)
[![GitHub release](https://img.shields.io/github/release/alvistack/ansible-role-libvirt.svg)](https://github.com/alvistack/ansible-role-libvirt)
[![GitHub license](https://img.shields.io/github/license/alvistack/ansible-role-libvirt.svg)](https://github.com/alvistack/ansible-role-libvirt/blob/master/LICENSE)
[![Ansible Role](https://img.shields.io/badge/galaxy-alvistack.libvirt-blue.svg)](https://galaxy.ansible.com/alvistack/libvirt)

Ansible Role for libvirt Installation.

## Requirements

This role require Ansible 2.9 or higher.

This role was designed for Ubuntu 16.04/18.04/19.10 or RHEL/CentOS 7 or openSUSE Leap 15.1.

## Role Variables

[defaults/main.yml](defaults/main.yml)

## Dependencies

[meta/main.yml](meta/main.yml)

## Example Playbook

[molecule/ubuntu-18.04/playbook.yml](molecule/ubuntu-18.04/playbook.yml)

## License

- Code released under [Apache License 2.0](LICENSE)
- Docs released under [CC BY 4.0](http://creativecommons.org/licenses/by/4.0/)

## Author Information

- Wong Hoi Sing Edison
- <https://twitter.com/hswong3i>
- <https://github.com/hswong3i>
14 changes: 14 additions & 0 deletions ansible.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
[ssh_connection]
control_path = %(directory)s/%%h-%%p-%%r
pipelining = true
scp_if_ssh = true
ssh_args = -o ControlMaster=auto -o ControlPersist=600s

[defaults]
ansible_managed = Ansible managed: Do NOT edit this file manually!
display_failed_stderr = true
forks = 20
host_key_checking = false
interpreter_python = auto
nocows = 1
retry_files_enabled = false
15 changes: 15 additions & 0 deletions defaults/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---

# (c) Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
15 changes: 15 additions & 0 deletions handlers/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---

# (c) Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
38 changes: 38 additions & 0 deletions meta/main.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
---

# (c) Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

galaxy_info:
role_name: libvirt
author: Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
description: Ansible Role for libvirt Installation
company: PantaRei Design
license: Apache-2.0
min_ansible_version: 2.9
platforms:
- name: Ubuntu
versions:
- xenial
- bionic
- eoan
- name: EL
versions:
- 7
- name: opensuse
versions:
- all
galaxy_tags:
- system
dependencies: []
1 change: 1 addition & 0 deletions molecule/centos-7/group_vars/all/00-defaults.yml
15 changes: 15 additions & 0 deletions molecule/centos-7/group_vars/all/99-molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---

# (c) Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
63 changes: 63 additions & 0 deletions molecule/centos-7/molecule.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,63 @@
---

# (c) Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

driver:
name: vagrant
provider:
name: libvirt
platforms:
- name: ${MOLECULE_INSTANCE_NAME}-1
box: generic/centos7
cpu: 2
memory: 2048
interfaces:
- auto_config: true
network_name: private_network
type: dhcp
provider_raw_config_args:
- 'nic_model_type = "virtio"'
- 'disk_bus = "virtio"'
- 'volume_cache = "none"'
- 'storage :file, bus: "virtio", cache: "none"'
lint:
name: yamllint
dependency:
name: galaxy
options:
role-file: ansible-role-requirements.yml
roles-path: ${ANSIBLE_ROLES_PATH}
ignore-errors: true
provisioner:
name: ansible
env:
ANSIBLE_ROLES_PATH: ${ANSIBLE_ROLES_PATH}
config_options:
defaults:
forks: 20
ssh_connection:
pipelining: true
ssh_args: -o ControlMaster=auto -o ControlPersist=600s
lint:
name: ansible-lint
inventory:
links:
group_vars: group_vars
playbooks:
prepare: prepare.yml
verifier:
name: ansible
lint:
name: ansible-lint
21 changes: 21 additions & 0 deletions molecule/centos-7/playbook.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
---

# (c) Wong Hoi Sing Edison <hswong3i@pantarei-design.com>
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

- hosts: all
remote_user: root
become: true
roles:
- role: libvirt
Loading

0 comments on commit ed970fe

Please sign in to comment.