refactoring, testing, policy fixes
Some checks failed
continuous-integration/drone/push Build is failing

This commit is contained in:
Robert Kaussow 2019-06-21 08:06:43 +02:00
parent 6b9c1665ff
commit 097012e96d
6 changed files with 157 additions and 21 deletions

69
.drone.jsonnet Normal file
View File

@ -0,0 +1,69 @@
local AnsibleVersions(version="latest", package="ansible") = {
name: "ansible-" + version,
image: "python:3.7",
pull: "always",
environment: {
PY_COLORS: 1
},
commands: [
"pip install " + package + " ansible-later~=0.2.0 -qq",
"git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy",
"ansible-later -c ~/policy/config.yml"
],
depends_on: [
"clone",
],
};
local PipelineLinting = {
kind: "pipeline",
name: "linting",
platform: {
os: "linux",
arch: "amd64",
},
steps: [
AnsibleVersions(version="latest", package="ansible"),
AnsibleVersions(version="master", package="git+https://github.com/ansible/ansible.git@devel"),
],
trigger: {
ref: ["refs/heads/master", "refs/tags/**", "refs/pull/**"],
},
};
local PipelineNotifications = {
kind: "pipeline",
name: "notifications",
platform: {
os: "linux",
arch: "amd64",
},
clone: {
disable: true,
},
steps: [
{
name: "matrix",
image: "plugins/matrix",
settings: {
homeserver: "https://matrix.rknet.org",
roomid: "MtidqQXWWAtQcByBhH:rknet.org",
template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}",
username: { "from_secret": "matrix_username" },
password: { "from_secret": "matrix_password" },
},
},
],
depends_on: [
"linting",
],
trigger: {
status: [ "success", "failure" ],
ref: ["refs/heads/master", "refs/tags/**"],
},
};
[
PipelineLinting,
PipelineNotifications,
]

View File

@ -1,22 +1,78 @@
--- ---
kind: pipeline kind: pipeline
name: default name: linting
platform:
os: linux
arch: amd64
steps: steps:
- name: ansible-latest - name: ansible-latest
image: python:2.7
pull: always pull: always
image: python:3.7
commands: commands:
- pip install ansible ansible-later -q - pip install ansible ansible-later~=0.2.0 -qq
- git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy - git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy
- git ls-files *[^LICENSE,.md] | xargs ansible-later -c ~/policy/config.ini - ansible-later -c ~/policy/config.yml
depends_on: [ clone ] environment:
PY_COLORS: 1
depends_on:
- clone
- name: ansible-master - name: ansible-master
image: python:2.7
pull: always pull: always
image: python:3.7
commands: commands:
- pip install ansible ansible-later -q - "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 - git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy
- git ls-files *[^LICENSE,.md] | xargs ansible-later -c ~/policy/config.ini - ansible-later -c ~/policy/config.yml
depends_on: [ clone ] environment:
PY_COLORS: 1
depends_on:
- clone
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
- "refs/pull/**"
---
kind: pipeline
name: notifications
platform:
os: linux
arch: amd64
clone:
disable: true
steps:
- name: matrix
image: plugins/matrix
settings:
homeserver: https://matrix.rknet.org
password:
from_secret: matrix_password
roomid: MtidqQXWWAtQcByBhH:rknet.org
template: "Status: **{{ build.status }}**<br/> Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}<br/> Message: {{ build.message }}"
username:
from_secret: matrix_username
trigger:
ref:
- refs/heads/master
- "refs/tags/**"
status:
- success
- failure
depends_on:
- linting
---
kind: signature
hmac: fc95a40878c5f235dd36806435dce17a67b5e706410e8150b2339b67a1717f7e
...

11
.gitignore vendored Normal file
View File

@ -0,0 +1,11 @@
# ---> Ansible
*.retry
filter/plugins/
library
# ---> Python
# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
*$py.class

View File

@ -2,7 +2,7 @@
network_hostname: localhost network_hostname: localhost
network_fqdn: localdomain network_fqdn: localdomain
network_defaultif: eth0 network_defaultif: eth0
network_disable_ipv6: false network_disable_ipv6: False
network_dns_server: 8.8.8.8 network_dns_server: 8.8.8.8
network_interfaces: {} network_interfaces: {}
network_hosts_entries: [] network_hosts_entries: []

View File

@ -4,7 +4,7 @@
shell: sleep 2 && systemctl restart network shell: sleep 2 && systemctl restart network
async: 1 async: 1
poll: 0 poll: 0
ignore_errors: true ignore_errors: yes
when: not require_reboot | bool when: not require_reboot | bool
listen: __network_restart listen: __network_restart
@ -12,7 +12,7 @@
shell: sleep 2 && shutdown -r now "Reboot triggered by Ansible" shell: sleep 2 && shutdown -r now "Reboot triggered by Ansible"
async: 1 async: 1
poll: 0 poll: 0
ignore_errors: true ignore_errors: yes
when: require_reboot | bool when: require_reboot | bool
listen: __host_reboot listen: __host_reboot
become: True become: True

View File

@ -1,7 +1,7 @@
#jinja2: lstrip_blocks: True #jinja2: lstrip_blocks: True
# {{ ansible_managed }} # {{ ansible_managed }}
127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4 127.0.0.1 localhost localhost.localdomain localhost4 localhost4.localdomain4
{% if network_disable_ipv6 == false %} {% if not network_disable_ipv6 %}
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
{% endif %} {% endif %}
{% if network_hostname is defined and network_fqdn is defined and network_interfaces[network_defaultif].ipaddr is defined %} {% if network_hostname is defined and network_fqdn is defined and network_interfaces[network_defaultif].ipaddr is defined %}