This commit is contained in:
parent
dcdb6755c0
commit
6701873db2
@ -48,9 +48,9 @@ local PipelineDeployment = {
|
||||
image: "xoxys/molecule:ec2-linux-amd64",
|
||||
pull: "always",
|
||||
environment: {
|
||||
EC2_ACCESS_KEY: { "from_secret": "ec2_access_key" },
|
||||
EC2_SECURITY_TOKEN: { "from_secret": "ec2_security_token" },
|
||||
EC2_REGION: "eu-central-1",
|
||||
AWS_ACCESS_KEY_ID: { "from_secret": "aws_access_key_id" },
|
||||
AWS_SECRET_ACCESS_KEY: { "from_secret": "aws_secret_access_key" },
|
||||
AWS_REGION: "eu-central-1",
|
||||
MOLECULE_CUSTOM_MODULES_REPO: "https://gitea.rknet.org/ansible/custom_modules",
|
||||
PY_COLORS: 1
|
||||
},
|
||||
|
87
.drone.yml
87
.drone.yml
@ -1,41 +1,41 @@
|
||||
#---
|
||||
#kind: pipeline
|
||||
#name: linting
|
||||
#
|
||||
#platform:
|
||||
# os: linux
|
||||
# arch: amd64
|
||||
#
|
||||
#steps:
|
||||
#- name: ansible-latest
|
||||
# pull: always
|
||||
# image: python:3.7
|
||||
# commands:
|
||||
# - pip install ansible ansible-later~=0.2.0 -qq
|
||||
# - git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy
|
||||
# - ansible-later -c ~/policy/config.yml
|
||||
# environment:
|
||||
# PY_COLORS: 1
|
||||
# depends_on:
|
||||
# - clone
|
||||
#
|
||||
#- name: ansible-master
|
||||
# pull: always
|
||||
# image: python:3.7
|
||||
# commands:
|
||||
# - "pip install git+https://github.com/ansible/ansible.git@devel ansible-later~=0.2.0 -qq"
|
||||
# - git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy
|
||||
# - ansible-later -c ~/policy/config.yml
|
||||
# environment:
|
||||
# PY_COLORS: 1
|
||||
# depends_on:
|
||||
# - clone
|
||||
#
|
||||
#trigger:
|
||||
# ref:
|
||||
# - refs/heads/master
|
||||
# - "refs/tags/**"
|
||||
# - "refs/pull/**"
|
||||
---
|
||||
kind: pipeline
|
||||
name: linting
|
||||
|
||||
platform:
|
||||
os: linux
|
||||
arch: amd64
|
||||
|
||||
steps:
|
||||
- name: ansible-latest
|
||||
pull: always
|
||||
image: python:3.7
|
||||
commands:
|
||||
- pip install ansible ansible-later~=0.2.0 -qq
|
||||
- git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy
|
||||
- ansible-later -c ~/policy/config.yml
|
||||
environment:
|
||||
PY_COLORS: 1
|
||||
depends_on:
|
||||
- clone
|
||||
|
||||
- name: ansible-master
|
||||
pull: always
|
||||
image: python:3.7
|
||||
commands:
|
||||
- "pip install git+https://github.com/ansible/ansible.git@devel ansible-later~=0.2.0 -qq"
|
||||
- git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy
|
||||
- ansible-later -c ~/policy/config.yml
|
||||
environment:
|
||||
PY_COLORS: 1
|
||||
depends_on:
|
||||
- clone
|
||||
|
||||
trigger:
|
||||
ref:
|
||||
- refs/heads/master
|
||||
- "refs/tags/**"
|
||||
- "refs/pull/**"
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
@ -60,11 +60,10 @@ steps:
|
||||
- molecule destroy --scenario-name ec2-centos-7
|
||||
environment:
|
||||
AWS_ACCESS_KEY_ID:
|
||||
from_secret: ec2_access_key
|
||||
EC2_REGION: eu-central-1
|
||||
from_secret: aws_access_key_id
|
||||
AWS_REGION: eu-central-1
|
||||
AWS_SECRET_ACCESS_KEY:
|
||||
from_secret: ec2_security_token
|
||||
MOLECULE_DEBUG: True
|
||||
from_secret: aws_secret_access_key
|
||||
MOLECULE_CUSTOM_MODULES_REPO: https://gitea.rknet.org/ansible/custom_modules
|
||||
PY_COLORS: 1
|
||||
|
||||
@ -73,8 +72,8 @@ trigger:
|
||||
- refs/heads/master
|
||||
- "refs/tags/**"
|
||||
|
||||
#depends_on:
|
||||
#- linting
|
||||
depends_on:
|
||||
- linting
|
||||
|
||||
---
|
||||
kind: pipeline
|
||||
|
@ -1,5 +1,8 @@
|
||||
---
|
||||
- name: Converge
|
||||
hosts: all
|
||||
vars:
|
||||
nginx_default_page_enabled: True
|
||||
|
||||
roles:
|
||||
- role: xoxys.nginx
|
||||
|
@ -2,13 +2,30 @@ import os
|
||||
|
||||
import testinfra.utils.ansible_runner
|
||||
|
||||
import warnings
|
||||
warnings.filterwarnings("ignore", category=DeprecationWarning)
|
||||
|
||||
testinfra_hosts = testinfra.utils.ansible_runner.AnsibleRunner(
|
||||
os.environ['MOLECULE_INVENTORY_FILE']).get_hosts('all')
|
||||
|
||||
|
||||
def test_hosts_file(host):
|
||||
f = host.file('/etc/hosts')
|
||||
def test_nginx_is_installed(host):
|
||||
nginx = host.package("nginx")
|
||||
assert nginx.is_installed
|
||||
|
||||
def test_nginx_running_and_enabled(host):
|
||||
nginx = host.service("nginx")
|
||||
assert nginx.is_running
|
||||
assert nginx.is_enabled
|
||||
|
||||
def test_nginx_process(host):
|
||||
# Verify worker procs are running
|
||||
master = host.process.get(user="root", comm="nginx")
|
||||
workers = host.process.filter(ppid=master.pid)
|
||||
assert len(workers) > 0
|
||||
|
||||
def test_nginx_socket(host):
|
||||
# Verify the socket is listening for HTTP traffic
|
||||
assert host.socket("tcp://0.0.0.0:80").is_listening
|
||||
|
||||
|
||||
assert f.exists
|
||||
assert f.user == 'root'
|
||||
assert f.group == 'root'
|
||||
|
Loading…
Reference in New Issue
Block a user