Skip to content
Snippets Groups Projects
Commit b7bdf51c authored by Benjamin Bertrand's avatar Benjamin Bertrand
Browse files

Initial commit

parents
No related branches found
No related tags found
No related merge requests found
Pipeline #10416 passed
[flake8]
ignore = E501
.molecule
.vagrant
.cache
*.swp
.DS_Store
__pycache__
*.pyc
playbook.retry
.vault_pass
---
include: 'https://gitlab.esss.lu.se/ics-infrastructure/gitlab-ci-yml/raw/master/Molecule.gitlab-ci.yml'
extends: default
rules:
braces:
max-spaces-inside: 1
level: error
brackets:
max-spaces-inside: 1
level: error
line-length: disable
# NOTE(retr0h): Templates no longer fail this lint rule.
# Uncomment if running old Molecule templates.
# truthy: disable
LICENSE 0 → 100644
BSD 2-Clause License
Copyright (c) 2019, European Spallation Source ERIC
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
* Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# ics-ans-ioc-base
Ansible playbook to setup the base requirements for an IOC.
## Requirements
- ansible >= 2.4
- molecule >= 2.6
## License
BSD 2-clause
# Molecule managed
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get install -y python sudo bash ca-certificates && apt-get clean; \
elif [ $(command -v dnf) ]; then dnf makecache && dnf --assumeyes install python sudo python-devel python2-dnf bash && dnf clean all; \
elif [ $(command -v yum) ]; then yum makecache fast && yum install -y python sudo yum-plugin-ovl bash && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; \
elif [ $(command -v zypper) ]; then zypper refresh && zypper install -y python sudo bash python-xml && zypper clean -a; \
elif [ $(command -v apk) ]; then apk update && apk add --no-cache python sudo bash ca-certificates; \
elif [ $(command -v xbps-install) ]; then xbps-install -Syu && xbps-install -y python sudo bash ca-certificates && xbps-remove -O; fi
---
dependency:
name: galaxy
options:
role-file: roles/requirements.yml
lint:
name: yamllint
provisioner:
name: ansible
lint:
name: ansible-lint
playbooks:
converge: ../../playbook.yml
inventory:
group_vars:
ioc_base:
eee_is_anaconda_installation: true
eee_dev: false
eee_use_autofs: false
eee_nfs_mountpoints: []
scenario:
name: default
verifier:
name: testinfra
lint:
name: flake8
driver:
name: docker
platforms:
- name: ics-ans-ioc-base-default
image: registry.esss.lu.se/ics-docker/centos-systemd:7
# SYS_ADMIN required to run systemctl
# SYS_TIME required for ntpd to run ntp_adjtime()
capabilities:
- SYS_ADMIN
- SYS_TIME
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup:ro
tmpfs:
- /run
command: /sbin/init
groups:
- ioc_base
---
- name: Prepare
hosts: all
gather_facts: false
tasks: []
import os
import testinfra.utils.ansible_runner
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('ioc_base')
def test_chronyd_running(host):
service = host.service("chronyd")
assert service.is_running
assert service.is_enabled
def test_procserv_installed(host):
cmd = host.run('/usr/bin/procServ --version')
assert cmd.stdout.startswith('procServ Process Server')
def test_autostart_ioc_service_enabled(host):
for name in ('ess-boot.service', 'ioc-master.service', 'procServ-vacuum.timer'):
assert host.service(name).is_enabled
---
- hosts: ioc_base
become: true
roles:
- role: ics-ans-role-repository
- role: ics-ans-role-ntpclient
- role: ics-ans-role-eee
---
- src: git+https://gitlab.esss.lu.se/ics-ansible-galaxy/ics-ans-role-repository.git
version: v0.9.0
- src: git+https://gitlab.esss.lu.se/ics-ansible-galaxy/ics-ans-role-ntpclient.git
version: v0.2.0
- src: git+https://gitlab.esss.lu.se/ics-ansible-galaxy/ics-ans-role-eee.git
version: v1.3.0
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment