mirror of
https://github.com/mrlesmithjr/ansible-manage-lvm.git
synced 2026-09-06 07:28:24 +03:00
Compare commits
4 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
| 25dc548acb | |||
| b3ef85d4f7 | |||
| 9f4afa7afb | |||
| 5603c5f6b0 |
+61
@@ -0,0 +1,61 @@
|
|||||||
|
---
|
||||||
|
language: python
|
||||||
|
python: "2.7"
|
||||||
|
|
||||||
|
# Use the new container infrastructure
|
||||||
|
sudo: required
|
||||||
|
|
||||||
|
services:
|
||||||
|
- docker
|
||||||
|
|
||||||
|
env:
|
||||||
|
- distribution: centos
|
||||||
|
init: /usr/lib/systemd/systemd
|
||||||
|
version: 7
|
||||||
|
- distribution: fedora
|
||||||
|
init: /usr/lib/systemd/systemd
|
||||||
|
version: 26
|
||||||
|
- distribution: fedora
|
||||||
|
init: /usr/lib/systemd/systemd
|
||||||
|
version: 25
|
||||||
|
- distribution: fedora
|
||||||
|
init: /usr/lib/systemd/systemd
|
||||||
|
version: 24
|
||||||
|
- distribution: ubuntu
|
||||||
|
init: /lib/systemd/systemd
|
||||||
|
version: bionic
|
||||||
|
- distribution: ubuntu
|
||||||
|
init: /lib/systemd/systemd
|
||||||
|
version: xenial
|
||||||
|
- distribution: ubuntu
|
||||||
|
init: /sbin/init
|
||||||
|
version: trusty
|
||||||
|
- distribution: debian
|
||||||
|
init: /lib/systemd/systemd
|
||||||
|
version: stretch
|
||||||
|
- distribution: debian
|
||||||
|
init: /lib/systemd/systemd
|
||||||
|
version: jessie
|
||||||
|
|
||||||
|
before_install:
|
||||||
|
- 'sudo pip install yamllint'
|
||||||
|
- yamllint -c .yamllint.yml .
|
||||||
|
- 'sudo docker pull ${distribution}:${version}'
|
||||||
|
- 'sudo docker build --no-cache --rm --file=tests/Dockerfile.${distribution}-${version} --tag=${distribution}-${version}:ansible tests'
|
||||||
|
|
||||||
|
script:
|
||||||
|
- container_id=$(mktemp)
|
||||||
|
- role_name="ansible-manage-lvm"
|
||||||
|
- 'sudo docker run --detach --privileged -v /sys/fs/cgroup:/sys/fs/cgroup:ro --volume="${PWD}":/etc/ansible/roles/${role_name}:ro ${distribution}-${version}:ansible ${init} > "${container_id}"'
|
||||||
|
- 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-lint -c /.ansible-lint /etc/ansible/roles/${role_name}/tests/test.yml'
|
||||||
|
- 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/${role_name}/tests/test.yml --syntax-check'
|
||||||
|
- 'sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/${role_name}/tests/test.yml'
|
||||||
|
- >
|
||||||
|
sudo docker exec "$(cat ${container_id})" env ANSIBLE_FORCE_COLOR=1 ansible-playbook -v /etc/ansible/roles/${role_name}/tests/test.yml
|
||||||
|
| grep -q 'changed=0.*failed=0'
|
||||||
|
&& (echo 'Idempotence test: pass' && exit 0)
|
||||||
|
|| (echo 'Idempotence test: fail' && exit 1)
|
||||||
|
- 'sudo docker rm -f "$(cat ${container_id})"'
|
||||||
|
|
||||||
|
notifications:
|
||||||
|
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
||||||
@@ -0,0 +1,58 @@
|
|||||||
|
---
|
||||||
|
extends: default
|
||||||
|
|
||||||
|
rules:
|
||||||
|
braces:
|
||||||
|
# Defaults
|
||||||
|
# min-spaces-inside: 0
|
||||||
|
# max-spaces-inside: 0
|
||||||
|
|
||||||
|
# Keeping 0 min-spaces to not error on empty collection definitions
|
||||||
|
min-spaces-inside: 0
|
||||||
|
# Allowing one space inside braces to improve code readability
|
||||||
|
max-spaces-inside: 1
|
||||||
|
|
||||||
|
brackets:
|
||||||
|
# Defaults
|
||||||
|
# min-spaces-inside: 0
|
||||||
|
# max-spaces-inside: 0
|
||||||
|
|
||||||
|
# Keeping 0 min-spaces to not error on empty collection definitions
|
||||||
|
min-spaces-inside: 0
|
||||||
|
# Allowing one space inside braces to improve code readability
|
||||||
|
max-spaces-inside: 1
|
||||||
|
|
||||||
|
colons:
|
||||||
|
# Defaults
|
||||||
|
# max-spaces-before: 0
|
||||||
|
# max-spaces-after: 1
|
||||||
|
|
||||||
|
max-spaces-before: 0
|
||||||
|
# Allowing more than one space for code readability
|
||||||
|
max-spaces-after: -1
|
||||||
|
|
||||||
|
comments:
|
||||||
|
# Defaults
|
||||||
|
# level: warning
|
||||||
|
# require-starting-space: true
|
||||||
|
# min-spaces-from-content: 2
|
||||||
|
|
||||||
|
# Disabling to allow for code comment blocks and #!/usr/bin/ansible-playbook
|
||||||
|
require-starting-space: false
|
||||||
|
|
||||||
|
indentation:
|
||||||
|
# Defaults
|
||||||
|
# spaces: consistent
|
||||||
|
# indent-sequences: true
|
||||||
|
# check-multi-line-strings: false
|
||||||
|
|
||||||
|
# Requiring 2 space indentation
|
||||||
|
spaces: 2
|
||||||
|
# Requiring consistent indentation within a file, either indented or not
|
||||||
|
indent-sequences: consistent
|
||||||
|
|
||||||
|
# Disabling due to copious amounts of long lines in the code which would
|
||||||
|
# require a code style change to resolve
|
||||||
|
line-length: disable
|
||||||
|
|
||||||
|
truthy: disable
|
||||||
+7
-20
@@ -2,36 +2,23 @@
|
|||||||
galaxy_info:
|
galaxy_info:
|
||||||
author: Larry Smith Jr.
|
author: Larry Smith Jr.
|
||||||
description: Role to manage LVM Groups/Logical Volumes. Can be used to create, extend or resize LVM.
|
description: Role to manage LVM Groups/Logical Volumes. Can be used to create, extend or resize LVM.
|
||||||
#company: your company (optional)
|
|
||||||
# If the issue tracker for your role is not on github, uncomment the
|
|
||||||
# next line and provide a value
|
|
||||||
# issue_tracker_url: http://example.com/issue/tracker
|
|
||||||
# Some suggested licenses:
|
|
||||||
# - BSD (default)
|
|
||||||
# - MIT
|
|
||||||
# - GPLv2
|
|
||||||
# - GPLv3
|
|
||||||
# - Apache
|
|
||||||
# - CC-BY
|
|
||||||
license: license (GPLv2, CC-BY, etc)
|
license: license (GPLv2, CC-BY, etc)
|
||||||
min_ansible_version: 1.2
|
min_ansible_version: 1.2
|
||||||
platforms:
|
platforms:
|
||||||
- name: EL
|
- name: EL
|
||||||
versions:
|
versions:
|
||||||
- 6
|
- 6
|
||||||
- 7
|
- 7
|
||||||
- name: Ubuntu
|
- name: Ubuntu
|
||||||
versions:
|
versions:
|
||||||
- precise
|
- precise
|
||||||
- trusty
|
- trusty
|
||||||
- name: Debian
|
- name: Debian
|
||||||
versions:
|
versions:
|
||||||
- jessie
|
- jessie
|
||||||
- wheezy
|
- wheezy
|
||||||
|
|
||||||
categories:
|
categories:
|
||||||
- system
|
- system
|
||||||
dependencies: []
|
dependencies: []
|
||||||
# List your role dependencies here, one per line.
|
|
||||||
# Be sure to remove the '[]' above if you add dependencies
|
|
||||||
# to this list.
|
|
||||||
|
|||||||
Executable
+17
@@ -0,0 +1,17 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
|
||||||
|
TAR_FILE="v1.6.0.tar.gz"
|
||||||
|
|
||||||
|
# Prompt for Ansible role name
|
||||||
|
read -p "Enter the Ansible role name: " input
|
||||||
|
|
||||||
|
# Update .travis.yml with Ansible role name
|
||||||
|
sed -i '' "s/replace_role/${input}/g" ".travis.yml"
|
||||||
|
|
||||||
|
# Update tests/test.yml with Ansible role name
|
||||||
|
sed -i '' "s/replace_role/${input}/g" "tests/test.yml"
|
||||||
|
|
||||||
|
# Cleanup
|
||||||
|
if [ -f $TAR_FILE ]; then
|
||||||
|
rm $TAR_FILE
|
||||||
|
fi
|
||||||
+3
-3
@@ -5,9 +5,9 @@
|
|||||||
state: "present"
|
state: "present"
|
||||||
become: true
|
become: true
|
||||||
with_items:
|
with_items:
|
||||||
- 'lvm2'
|
- lvm2
|
||||||
- 'scsitools'
|
- scsitools
|
||||||
- 'xfsprogs'
|
- xfsprogs
|
||||||
|
|
||||||
- name: debian | checking for scsi devices
|
- name: debian | checking for scsi devices
|
||||||
shell: "sg_scan"
|
shell: "sg_scan"
|
||||||
|
|||||||
@@ -35,7 +35,7 @@
|
|||||||
filesystem:
|
filesystem:
|
||||||
fstype: "{{ item[1]['filesystem'] }}"
|
fstype: "{{ item[1]['filesystem'] }}"
|
||||||
dev: "/dev/{{ item[0]['vgname'] }}/{{ item[1]['lvname'] }}"
|
dev: "/dev/{{ item[0]['vgname'] }}/{{ item[1]['lvname'] }}"
|
||||||
# resizefs: yes #coming in 2.0 which will replace the resizing filesystem task below
|
# resizefs: yes #coming in 2.0 which will replace the resizing filesystem task below
|
||||||
become: true
|
become: true
|
||||||
with_subelements:
|
with_subelements:
|
||||||
- "{{ lvm_groups }}"
|
- "{{ lvm_groups }}"
|
||||||
|
|||||||
@@ -0,0 +1 @@
|
|||||||
|
skip_list: ['305','503']
|
||||||
@@ -0,0 +1,27 @@
|
|||||||
|
FROM centos:7
|
||||||
|
ENV container=docker
|
||||||
|
|
||||||
|
RUN yum -y install epel-release && \
|
||||||
|
yum -y install gmp-devel libffi-devel openssl-devel python-crypto \
|
||||||
|
python-devel python-pip python-setuptools python-virtualenv \
|
||||||
|
redhat-rpm-config && \
|
||||||
|
yum -y group install "Development Tools"
|
||||||
|
|
||||||
|
# Install systemd -- See https://hub.docker.com/_/centos/
|
||||||
|
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
|
||||||
|
rm -f /lib/systemd/system/multi-user.target.wants/*;\
|
||||||
|
rm -f /etc/systemd/system/*.wants/*;\
|
||||||
|
rm -f /lib/systemd/system/local-fs.target.wants/*; \
|
||||||
|
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
|
||||||
|
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
|
||||||
|
rm -f /lib/systemd/system/basic.target.wants/*;\
|
||||||
|
rm -f /lib/systemd/system/anaconda.target.wants/*;
|
||||||
|
|
||||||
|
RUN pip install enum34 ipaddress wheel && \
|
||||||
|
pip install ansible ansible-lint
|
||||||
|
|
||||||
|
COPY .ansible-lint /
|
||||||
|
|
||||||
|
VOLUME ["/sys/fs/cgroup"]
|
||||||
|
|
||||||
|
CMD ["/usr/sbin/init"]
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
FROM debian:jessie
|
||||||
|
ENV container=docker
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends build-essential libffi-dev \
|
||||||
|
libssl-dev python-dev python-minimal python-pip python-setuptools \
|
||||||
|
python-virtualenv && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN pip install --upgrade pip setuptools && \
|
||||||
|
pip install enum34 ipaddress wheel && \
|
||||||
|
pip install ansible ansible-lint
|
||||||
|
|
||||||
|
COPY .ansible-lint /
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
FROM debian:stretch
|
||||||
|
ENV container=docker
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends build-essential libffi-dev \
|
||||||
|
libssl-dev python-dev python-minimal python-pip python-setuptools \
|
||||||
|
python-virtualenv systemd && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN pip install enum34 ipaddress wheel && \
|
||||||
|
pip install ansible ansible-lint
|
||||||
|
|
||||||
|
COPY .ansible-lint /
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
FROM fedora:24
|
||||||
|
ENV container=docker
|
||||||
|
|
||||||
|
RUN dnf -y install gmp-devel libffi-devel openssl-devel python-crypto \
|
||||||
|
python-devel python-dnf python-pip python-setuptools python-virtualenv \
|
||||||
|
redhat-rpm-config systemd && \
|
||||||
|
dnf -y group install "C Development Tools and Libraries"
|
||||||
|
|
||||||
|
# Install systemd -- See https://hub.docker.com/_/centos/
|
||||||
|
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
|
||||||
|
rm -f /lib/systemd/system/multi-user.target.wants/*;\
|
||||||
|
rm -f /etc/systemd/system/*.wants/*;\
|
||||||
|
rm -f /lib/systemd/system/local-fs.target.wants/*; \
|
||||||
|
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
|
||||||
|
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
|
||||||
|
rm -f /lib/systemd/system/basic.target.wants/*;\
|
||||||
|
rm -f /lib/systemd/system/anaconda.target.wants/*;
|
||||||
|
|
||||||
|
RUN pip install enum34 ipaddress wheel && \
|
||||||
|
pip install ansible ansible-lint
|
||||||
|
|
||||||
|
COPY .ansible-lint /
|
||||||
|
|
||||||
|
VOLUME ["/sys/fs/cgroup"]
|
||||||
|
|
||||||
|
CMD ["/usr/sbin/init"]
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
FROM fedora:25
|
||||||
|
ENV container=docker
|
||||||
|
|
||||||
|
RUN dnf -y install gmp-devel libffi-devel openssl-devel python-crypto \
|
||||||
|
python-devel python-dnf python-pip python-setuptools python-virtualenv \
|
||||||
|
redhat-rpm-config systemd && \
|
||||||
|
dnf -y group install "C Development Tools and Libraries"
|
||||||
|
|
||||||
|
# Install systemd -- See https://hub.docker.com/_/centos/
|
||||||
|
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
|
||||||
|
rm -f /lib/systemd/system/multi-user.target.wants/*;\
|
||||||
|
rm -f /etc/systemd/system/*.wants/*;\
|
||||||
|
rm -f /lib/systemd/system/local-fs.target.wants/*; \
|
||||||
|
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
|
||||||
|
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
|
||||||
|
rm -f /lib/systemd/system/basic.target.wants/*;\
|
||||||
|
rm -f /lib/systemd/system/anaconda.target.wants/*;
|
||||||
|
|
||||||
|
RUN pip install enum34 ipaddress wheel && \
|
||||||
|
pip install ansible ansible-lint
|
||||||
|
|
||||||
|
COPY .ansible-lint /
|
||||||
|
|
||||||
|
VOLUME ["/sys/fs/cgroup"]
|
||||||
|
|
||||||
|
CMD ["/usr/sbin/init"]
|
||||||
@@ -0,0 +1,26 @@
|
|||||||
|
FROM fedora:26
|
||||||
|
ENV container=docker
|
||||||
|
|
||||||
|
RUN dnf -y install gmp-devel libffi-devel openssl-devel python-crypto \
|
||||||
|
python-devel python-dnf python-pip python-setuptools python-virtualenv \
|
||||||
|
redhat-rpm-config systemd && \
|
||||||
|
dnf -y group install "C Development Tools and Libraries"
|
||||||
|
|
||||||
|
# Install systemd -- See https://hub.docker.com/_/centos/
|
||||||
|
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == systemd-tmpfiles-setup.service ] || rm -f $i; done); \
|
||||||
|
rm -f /lib/systemd/system/multi-user.target.wants/*;\
|
||||||
|
rm -f /etc/systemd/system/*.wants/*;\
|
||||||
|
rm -f /lib/systemd/system/local-fs.target.wants/*; \
|
||||||
|
rm -f /lib/systemd/system/sockets.target.wants/*udev*; \
|
||||||
|
rm -f /lib/systemd/system/sockets.target.wants/*initctl*; \
|
||||||
|
rm -f /lib/systemd/system/basic.target.wants/*;\
|
||||||
|
rm -f /lib/systemd/system/anaconda.target.wants/*;
|
||||||
|
|
||||||
|
RUN pip install enum34 ipaddress wheel && \
|
||||||
|
pip install ansible ansible-lint
|
||||||
|
|
||||||
|
COPY .ansible-lint /
|
||||||
|
|
||||||
|
VOLUME ["/sys/fs/cgroup"]
|
||||||
|
|
||||||
|
CMD ["/usr/sbin/init"]
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
FROM ubuntu:bionic
|
||||||
|
ENV container=docker
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends build-essential libffi-dev \
|
||||||
|
libssl-dev python-dev python-minimal python-pip python-setuptools \
|
||||||
|
python-virtualenv systemd && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN pip install enum34 ipaddress wheel && \
|
||||||
|
pip install ansible ansible-lint
|
||||||
|
|
||||||
|
COPY .ansible-lint /
|
||||||
@@ -0,0 +1,14 @@
|
|||||||
|
FROM ubuntu:trusty
|
||||||
|
ENV container=docker
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends build-essential libffi-dev \
|
||||||
|
libssl-dev python-dev python-minimal python-pip python-setuptools \
|
||||||
|
python-virtualenv && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN pip install --upgrade pip setuptools && \
|
||||||
|
pip install enum34 ipaddress wheel && \
|
||||||
|
pip install ansible ansible-lint
|
||||||
|
|
||||||
|
COPY .ansible-lint /
|
||||||
@@ -0,0 +1,13 @@
|
|||||||
|
FROM ubuntu:xenial
|
||||||
|
ENV container=docker
|
||||||
|
|
||||||
|
RUN apt-get update && \
|
||||||
|
apt-get install -y --no-install-recommends build-essential libffi-dev \
|
||||||
|
libssl-dev python-dev python-minimal python-pip python-setuptools \
|
||||||
|
python-virtualenv && \
|
||||||
|
rm -rf /var/lib/apt/lists/*
|
||||||
|
|
||||||
|
RUN pip install enum34 ipaddress wheel && \
|
||||||
|
pip install ansible ansible-lint
|
||||||
|
|
||||||
|
COPY .ansible-lint /
|
||||||
@@ -0,0 +1 @@
|
|||||||
|
localhost
|
||||||
@@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- hosts: localhost
|
||||||
|
connection: local
|
||||||
|
roles:
|
||||||
|
- ansible-manage-lvm
|
||||||
Reference in New Issue
Block a user