mirror of
https://github.com/atosatto/ansible-minio.git
synced 2024-11-25 11:55:10 +01:00
commit
0de61d0ab1
@ -10,18 +10,13 @@ sudo: required
|
||||
services:
|
||||
- docker
|
||||
|
||||
# Ensure docker is updated
|
||||
before_install:
|
||||
- sudo apt-get -qq update
|
||||
- sudo apt-get install -o Dpkg::Options::="--force-confold" --force-yes -y docker-engine
|
||||
|
||||
# Install molecule
|
||||
install:
|
||||
- pip install -r test-requirements.txt
|
||||
|
||||
# Execute the tests using the molecule docker driver
|
||||
script:
|
||||
- molecule test --driver docker
|
||||
- molecule test --all
|
||||
|
||||
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
|
@ -16,6 +16,7 @@ minio_server_addr: ":9091"
|
||||
|
||||
# Minio server data directories
|
||||
minio_server_datadirs: [ ]
|
||||
minio_server_make_datadirs: true
|
||||
|
||||
# Additional minio server CLI options
|
||||
minio_server_opts: ""
|
||||
@ -25,5 +26,5 @@ minio_access_key: ""
|
||||
minio_secret_key: ""
|
||||
|
||||
# Switches to disable minio server and/or minio client installation
|
||||
skip_server: False
|
||||
skip_client: False
|
||||
skip_server: false
|
||||
skip_client: false
|
||||
|
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 }}"
|
51
molecule/default/molecule.yml
Normal file
51
molecule/default/molecule.yml
Normal file
@ -0,0 +1,51 @@
|
||||
---
|
||||
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-fedora-27
|
||||
image: paulfantom/fedora-molecule:27
|
||||
privileged: true
|
||||
volumes:
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||
- name: minio-debian-9
|
||||
image: paulfantom/debian-molecule:9
|
||||
privileged: true
|
||||
volumes:
|
||||
- /sys/fs/cgroup:/sys/fs/cgroup:ro
|
||||
- name: minio-ubuntu-18.04
|
||||
image: paulfantom/ubuntu-molecule:18.04
|
||||
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: []
|
@ -12,6 +12,18 @@ def AnsibleDefaults(Ansible):
|
||||
return yaml.load(stream)
|
||||
|
||||
|
||||
@pytest.mark.parametrize("dirs", [
|
||||
"/minio-test"
|
||||
])
|
||||
def test_directories(host, dirs):
|
||||
d = host.file(dirs)
|
||||
assert d.is_directory
|
||||
assert d.exists
|
||||
assert d.user == AnsibleDefaults['minio_user']
|
||||
assert d.group == AnsibleDefaults['minio_group']
|
||||
assert oct(d.mode) == '0750'
|
||||
|
||||
|
||||
@pytest.mark.parametrize('minio_bin_var', [
|
||||
'minio_server_bin',
|
||||
'minio_client_bin',
|
@ -1,6 +0,0 @@
|
||||
---
|
||||
|
||||
- hosts: all
|
||||
roles:
|
||||
- { role: ansible-minio,
|
||||
minio_server_datadirs: [ "/tmp" ] }
|
@ -6,8 +6,8 @@
|
||||
# add the python sni support to legacy python installations
|
||||
- include: python_sni.yml
|
||||
when: ansible_os_family == 'Debian'
|
||||
and ansible_python_version | version_compare('2.6.0', '>=')
|
||||
and ansible_python_version | version_compare('2.7.9', '<')
|
||||
and ansible_python_version is version_compare('2.6.0', '>=')
|
||||
and ansible_python_version is version_compare('2.7.9', '<')
|
||||
|
||||
# install additional ansible dependencies
|
||||
- name: install ansible support packages
|
||||
|
@ -1,5 +1,15 @@
|
||||
---
|
||||
|
||||
- name: create data storage directories
|
||||
file:
|
||||
path: "{{ item }}"
|
||||
state: directory
|
||||
owner: "{{ minio_user }}"
|
||||
group: "{{ minio_group }}"
|
||||
mode: 0750
|
||||
when: minio_server_make_datadirs
|
||||
with_items: "{{ minio_server_datadirs }}"
|
||||
|
||||
- name: download minio server
|
||||
get_url:
|
||||
url: "{{ minio_server_download_url }}"
|
||||
@ -24,11 +34,11 @@
|
||||
template:
|
||||
src: minio.init.j2
|
||||
dest: "{{ initd_conf_dir }}/minio"
|
||||
mode: 0755
|
||||
mode: 0750
|
||||
when: ansible_service_mgr != "systemd"
|
||||
|
||||
- name: enable and start the minio service
|
||||
service:
|
||||
name: minio
|
||||
state: started
|
||||
enabled: yes
|
||||
enabled: true
|
||||
|
@ -1,3 +1,4 @@
|
||||
molecule==1.17.3
|
||||
docker-py==1.10.6
|
||||
molecule>=2.15.0
|
||||
docker-py>=1.10.0
|
||||
PyYAML==3.12
|
||||
ansible-lint>=3.4.0
|
||||
|
Loading…
Reference in New Issue
Block a user