mirror of
https://github.com/atosatto/ansible-minio.git
synced 2025-01-21 20:51:22 +01:00
Update molecule to 2.x
* Adds yamllint. * Use working docker images.
This commit is contained in:
parent
f1e919f3ee
commit
08e82da1a4
@ -16,7 +16,7 @@ install:
|
|||||||
|
|
||||||
# Execute the tests using the molecule docker driver
|
# Execute the tests using the molecule docker driver
|
||||||
script:
|
script:
|
||||||
- molecule test --driver docker
|
- molecule test --all
|
||||||
|
|
||||||
notifications:
|
notifications:
|
||||||
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
webhooks: https://galaxy.ansible.com/api/v1/notifications/
|
||||||
|
14
.yamllint
Normal file
14
.yamllint
Normal file
@ -0,0 +1,14 @@
|
|||||||
|
extends: default
|
||||||
|
ignore: |
|
||||||
|
.travis/
|
||||||
|
.travis.yml
|
||||||
|
meta/
|
||||||
|
|
||||||
|
rules:
|
||||||
|
braces:
|
||||||
|
max-spaces-inside: 1
|
||||||
|
level: error
|
||||||
|
brackets:
|
||||||
|
max-spaces-inside: 1
|
||||||
|
level: error
|
||||||
|
line-length: disable
|
48
molecule.yml
48
molecule.yml
@ -1,48 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
# docker driver configuration (CI)
|
|
||||||
docker:
|
|
||||||
containers:
|
|
||||||
- name: minio-centos-7
|
|
||||||
image: atosatto/centos
|
|
||||||
image_version: 7-systemd
|
|
||||||
privileged: True
|
|
||||||
- name: minio-ubuntu-16.04
|
|
||||||
image: atosatto/ubuntu
|
|
||||||
image_version: 16.04
|
|
||||||
privileged: True
|
|
||||||
# TODO: Find a workaround to
|
|
||||||
# https://github.com/ansible/ansible/issues/18894
|
|
||||||
# and add ubuntu-14.04 to CI.
|
|
||||||
# - name: minio-ubuntu-14.04
|
|
||||||
# image: ubuntu
|
|
||||||
# image_version: 14.04
|
|
||||||
# privileged: True
|
|
||||||
|
|
||||||
|
|
||||||
# vagrant driver configuration (development)
|
|
||||||
vagrant:
|
|
||||||
platforms:
|
|
||||||
- name: centos-7
|
|
||||||
box: centos/7
|
|
||||||
- name: ubuntu-16.04
|
|
||||||
box: bento/ubuntu-16.04
|
|
||||||
- name: ubuntu-14.04
|
|
||||||
box: bento/ubuntu-14.04
|
|
||||||
providers:
|
|
||||||
- name: virtualbox
|
|
||||||
type: virtualbox
|
|
||||||
options:
|
|
||||||
memory: 2048
|
|
||||||
cpus: 2
|
|
||||||
instances:
|
|
||||||
- name: ansible-minio-01
|
|
||||||
interfaces:
|
|
||||||
- network_name: private_network
|
|
||||||
type: dhcp
|
|
||||||
auto_config: true
|
|
||||||
options:
|
|
||||||
append_platform_to_hostname: yes
|
|
||||||
|
|
||||||
verifier:
|
|
||||||
name: testinfra
|
|
37
molecule/default/create.yml
Normal file
37
molecule/default/create.yml
Normal file
@ -0,0 +1,37 @@
|
|||||||
|
---
|
||||||
|
- name: Create
|
||||||
|
hosts: localhost
|
||||||
|
connection: local
|
||||||
|
gather_facts: false
|
||||||
|
no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
|
||||||
|
tasks:
|
||||||
|
- name: Create molecule instance(s)
|
||||||
|
docker_container:
|
||||||
|
name: "{{ item.name }}"
|
||||||
|
docker_host: "{{ item.docker_host | default('unix://var/run/docker.sock') }}"
|
||||||
|
hostname: "{{ item.name }}"
|
||||||
|
image: "{{ item.image }}"
|
||||||
|
state: started
|
||||||
|
recreate: false
|
||||||
|
log_driver: json-file
|
||||||
|
command: "{{ item.command | default(omit) }}"
|
||||||
|
privileged: "{{ item.privileged | default(omit) }}"
|
||||||
|
volumes: "{{ item.volumes | default(omit) }}"
|
||||||
|
capabilities: "{{ item.capabilities | default(omit) }}"
|
||||||
|
exposed_ports: "{{ item.exposed_ports | default(omit) }}"
|
||||||
|
published_ports: "{{ item.published_ports | default(omit) }}"
|
||||||
|
ulimits: "{{ item.ulimits | default(omit) }}"
|
||||||
|
networks: "{{ item.networks | default(omit) }}"
|
||||||
|
dns_servers: "{{ item.dns_servers | default(omit) }}"
|
||||||
|
register: server
|
||||||
|
with_items: "{{ molecule_yml.platforms }}"
|
||||||
|
async: 7200
|
||||||
|
poll: 0
|
||||||
|
|
||||||
|
- name: Wait for instance(s) creation to complete
|
||||||
|
async_status:
|
||||||
|
jid: "{{ item.ansible_job_id }}"
|
||||||
|
register: docker_jobs
|
||||||
|
until: docker_jobs.finished
|
||||||
|
retries: 300
|
||||||
|
with_items: "{{ server.results }}"
|
32
molecule/default/destroy.yml
Normal file
32
molecule/default/destroy.yml
Normal file
@ -0,0 +1,32 @@
|
|||||||
|
---
|
||||||
|
- name: Destroy
|
||||||
|
hosts: localhost
|
||||||
|
connection: local
|
||||||
|
gather_facts: false
|
||||||
|
no_log: "{{ not lookup('env', 'MOLECULE_DEBUG') | bool }}"
|
||||||
|
tasks:
|
||||||
|
- name: Destroy molecule instance(s)
|
||||||
|
docker_container:
|
||||||
|
name: "{{ item.name }}"
|
||||||
|
docker_host: "{{ item.docker_host | default('unix://var/run/docker.sock') }}"
|
||||||
|
state: absent
|
||||||
|
force_kill: "{{ item.force_kill | default(true) }}"
|
||||||
|
register: server
|
||||||
|
with_items: "{{ molecule_yml.platforms }}"
|
||||||
|
async: 7200
|
||||||
|
poll: 0
|
||||||
|
|
||||||
|
- name: Wait for instance(s) deletion to complete
|
||||||
|
async_status:
|
||||||
|
jid: "{{ item.ansible_job_id }}"
|
||||||
|
register: docker_jobs
|
||||||
|
until: docker_jobs.finished
|
||||||
|
retries: 300
|
||||||
|
with_items: "{{ server.results }}"
|
||||||
|
|
||||||
|
- name: Delete docker network(s)
|
||||||
|
docker_network:
|
||||||
|
name: "{{ item }}"
|
||||||
|
docker_host: "{{ item.docker_host | default('unix://var/run/docker.sock') }}"
|
||||||
|
state: absent
|
||||||
|
with_items: "{{ molecule_yml.platforms | molecule_get_docker_networks }}"
|
35
molecule/default/molecule.yml
Normal file
35
molecule/default/molecule.yml
Normal file
@ -0,0 +1,35 @@
|
|||||||
|
---
|
||||||
|
driver:
|
||||||
|
name: docker
|
||||||
|
lint:
|
||||||
|
name: yamllint
|
||||||
|
|
||||||
|
platforms:
|
||||||
|
- name: minio-centos-7
|
||||||
|
image: paulfantom/centos-molecule:7
|
||||||
|
privileged: true
|
||||||
|
volumes:
|
||||||
|
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||||
|
- name: minio-ubuntu-16.04
|
||||||
|
image: paulfantom/ubuntu-molecule:16.04
|
||||||
|
privileged: true
|
||||||
|
volumes:
|
||||||
|
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||||
|
|
||||||
|
provisioner:
|
||||||
|
name: ansible
|
||||||
|
lint:
|
||||||
|
name: ansible-lint
|
||||||
|
playbooks:
|
||||||
|
create: create.yml
|
||||||
|
prepare: prepare.yml
|
||||||
|
converge: playbook.yml
|
||||||
|
destroy: destroy.yml
|
||||||
|
|
||||||
|
scenario:
|
||||||
|
name: default
|
||||||
|
verifier:
|
||||||
|
name: testinfra
|
||||||
|
lint:
|
||||||
|
name: flake8
|
||||||
|
enabled: true
|
8
molecule/default/playbook.yml
Normal file
8
molecule/default/playbook.yml
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
---
|
||||||
|
|
||||||
|
- hosts: all
|
||||||
|
any_errors_fatal: true
|
||||||
|
roles:
|
||||||
|
- ansible-minio
|
||||||
|
vars:
|
||||||
|
minio_server_datadirs: [ "/minio-test" ]
|
5
molecule/default/prepare.yml
Normal file
5
molecule/default/prepare.yml
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
---
|
||||||
|
- name: Prepare
|
||||||
|
hosts: all
|
||||||
|
gather_facts: false
|
||||||
|
tasks: []
|
@ -1,6 +0,0 @@
|
|||||||
---
|
|
||||||
|
|
||||||
- hosts: all
|
|
||||||
roles:
|
|
||||||
- { role: ansible-minio,
|
|
||||||
minio_server_datadirs: [ "/minio-test" ] }
|
|
@ -1,3 +1,4 @@
|
|||||||
molecule==1.17.3
|
molecule>=2.15.0
|
||||||
docker-py==1.10.6
|
docker-py>=1.10.0
|
||||||
PyYAML==3.12
|
PyYAML==3.12
|
||||||
|
ansible-lint>=3.4.0
|
||||||
|
Loading…
Reference in New Issue
Block a user