Last active
May 17, 2020 14:51
-
-
Save freeseacher/e2e154259471a487e60506df45a6abaa to your computer and use it in GitHub Desktop.
molecule setup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
variables: | |
MOLECULE_VERSION: 3.0.4 | |
LC_ALL: C.UTF-8 | |
LANG: C.UTF-8 | |
PY_COLORS: 1 | |
ANSIBLE_FORCE_COLOR: "True" | |
stages: | |
- test | |
.molecule: | |
stage: test | |
image: molecule-docker:$MOLECULE_VERSION-$ANSIBLE_VERSION | |
before_script: | |
- pip3 install ansible==$ANSIBLE_VERSION molecule[docker]==$MOLECULE_VERSION | |
- ansible --version | |
- molecule --version | |
script: | |
- molecule test --parallel | |
ansible_2.8: | |
extends: [.molecule] | |
variables: | |
ANSIBLE_VERSION: 2.8.10 | |
ansible_2.9: | |
extends: [.molecule] | |
variables: | |
ANSIBLE_VERSION: 2.9.9 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/sh | |
envsubst < molecule/default/requirements.tmpl > molecule/default/requirements.yaml | |
ansible-galaxy install --force -r molecule/default/requirements.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
FROM debian:buster | |
ENV container docker | |
ENV LC_ALL C | |
ENV DEBIAN_FRONTEND noninteractive | |
RUN apt-get update \ | |
&& apt-get install -y systemd systemd-sysv procps python3 \ | |
&& apt-get clean \ | |
&& rm -rf /var/lib/apt/lists/* /tmp/* /var/tmp/* | |
RUN rm -f /lib/systemd/system/multi-user.target.wants/* \ | |
/etc/systemd/system/*.wants/* \ | |
/lib/systemd/system/local-fs.target.wants/* \ | |
/lib/systemd/system/sockets.target.wants/*udev* \ | |
/lib/systemd/system/sockets.target.wants/*initctl* \ | |
/lib/systemd/system/sysinit.target.wants/systemd-tmpfiles-setup* \ | |
/lib/systemd/system/systemd-update-utmp* | |
VOLUME [ "/sys/fs/cgroup" ] | |
CMD ["/lib/systemd/systemd"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
dependency: | |
name: shell | |
command: $PWD/molecule/default/deps.sh | |
driver: | |
name: docker | |
platforms: | |
- name: instance | |
image: instance | |
pre_build_image: no | |
command: /sbin/init | |
privileged: True | |
tmpfs: | |
- /run | |
- /tmp | |
volumes: | |
- /sys/fs/cgroup:/sys/fs/cgroup:ro | |
provisioner: | |
name: ansible | |
options: | |
diff: True | |
env: | |
.... | |
verifier: | |
name: ansible |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: somename | |
scm: git | |
src: https://gitlab-ci-token:${CI_JOB_TOKEN}@gitlab.....git | |
version: 0.1.1 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
- name: Verify | |
hosts: all | |
vars_files: | |
- ../../defaults/main.yml | |
tasks: | |
- name: check service is running | |
service: | |
name: name | |
state: started | |
register: service_state | |
- name: checi if config file exists | |
stat: | |
path: "{{ config }}" | |
register: pc | |
- name: read config into var | |
slurp: | |
src: "{{ config }}" | |
register: pcc | |
- name: check if config is valid yaml | |
set_fact: | |
promxy_conf: "{{ pcc.content | b64decode | from_yaml }}" | |
- name: Check | |
assert: | |
that: | |
- "service_state.state == 'started'" | |
- "pc.stat.exists" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment