1 Commits
1.1.0 ... 1.2.0

Author SHA1 Message Date
a90af00f5a add new molecule scenario, add tox config 2022-08-08 10:20:43 +07:00
7 changed files with 112 additions and 0 deletions

1
.gitignore vendored
View File

@@ -1 +1,2 @@
/.idea /.idea
/.tox

View File

@@ -0,0 +1,38 @@
{% if item.registry is defined %}
FROM {{ item.registry.url }}/{{ item.image }}
{% else %}
FROM {{ item.image }}
{% endif %}
{% if item.env is defined %}
{% for var, value in item.env.items() %}
{% if value %}
ENV {{ var }} {{ value }}
{% endif %}
{% endfor %}
{% endif %}
RUN if [ $(command -v apt-get) ]; then apt-get update && apt-get upgrade -y && apt-get install -y apt-transport-https gnupg2 python3-minimal python3-apt man systemd systemd-sysv rsyslog sudo bash ca-certificates iproute2 && apt-get clean; \
elif [ $(command -v yum) ]; then sed -i 's/^\(tsflags=*\)/# \1/g' /etc/yum.conf && yum makecache fast && yum upgrade -y && yum makecache fast && yum install -y sudo python3 systemd rsyslog man yum-plugin-ovl bash iproute && sed -i 's/plugins=0/plugins=1/g' /etc/yum.conf && yum clean all; fi
RUN set -xe \
&& groupadd -r ${ANSIBLE_USER} \
&& groupadd -r ${DEPLOY_GROUP} \
&& useradd -m -g ${ANSIBLE_USER} ${ANSIBLE_USER} \
&& usermod -aG ${DEPLOY_GROUP} ${ANSIBLE_USER} \
&& echo "%${DEPLOY_GROUP} ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/ansible
RUN (cd /lib/systemd/system/sysinit.target.wants/; for i in *; do [ $i == \
systemd-tmpfiles-setup.service ] || rm -f $i; done); \
rm -rf /lib/systemd/system/multi-user.target.wants/*;\
rm -rf /etc/systemd/system/*.wants/*;\
rm -rf /lib/systemd/system/local-fs.target.wants/*; \
rm -rf /lib/systemd/system/sockets.target.wants/*udev*; \
rm -rf /lib/systemd/system/sockets.target.wants/*initctl*; \
rm -rf /lib/systemd/system/basic.target.wants/*;\
rm -rf /lib/systemd/system/anaconda.target.wants/*;
VOLUME [ "/sys/fs/cgroup" ]
CMD ["{{ item.command | default('/usr/sbin/init') }}"]

View File

@@ -0,0 +1,8 @@
---
- name: Converge
hosts: all
tasks:
- name: "Include netology_devops_vector"
ansible.builtin.include_role:
name: "dannc.netology_devops_vector"

View File

@@ -0,0 +1,35 @@
---
dependency:
name: galaxy
driver:
name: podman
platforms:
- name: centos_7
image: docker.io/library/centos:7
privileged: true
command: /usr/sbin/init
capabilities:
- SYS_ADMIN
tmpfs:
- /run
- /tmp
volumes:
- /sys/fs/cgroup:/sys/fs/cgroup
env:
ANSIBLE_USER: ansible
SUDO_GROUP: wheel
DEPLOY_GROUP: deployer
container: podman
provisioner:
name: ansible
verifier:
name: ansible
scenario:
name: podman
test_sequence:
- lint
- destroy
- create
- converge
- verify
- destroy

View File

@@ -0,0 +1,9 @@
---
- name: Verify
hosts: all
gather_facts: false
tasks:
- name: ensure vector service started
ansible.builtin.service:
name: vector
state: started

7
tox-requirements.txt Normal file
View File

@@ -0,0 +1,7 @@
selinux
ansible-lint==5.1.3
yamllint==1.26.3
lxml
molecule==3.4.0
molecule_podman
jmespath

14
tox.ini Normal file
View File

@@ -0,0 +1,14 @@
[tox]
minversion = 1.8
basepython = python3.6
envlist = py{37,39}-ansible{210,30}
skipsdist = true
[testenv]
passenv = *
deps =
-r tox-requirements.txt
ansible210: ansible<3.0
ansible30: ansible<3.1
commands =
{posargs:molecule test -s podman}