diff --git a/.drone.jsonnet b/.drone.jsonnet new file mode 100644 index 0000000..fcf5597 --- /dev/null +++ b/.drone.jsonnet @@ -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 }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}
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, +] diff --git a/.drone.yml b/.drone.yml index 289d224..32c79e1 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,22 +1,78 @@ --- kind: pipeline -name: default +name: linting + +platform: + os: linux + arch: amd64 steps: - - name: ansible-latest - image: python:2.7 - pull: always - commands: - - pip install ansible ansible-later -q - - git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy - - git ls-files *[^LICENSE,.md] | xargs ansible-later -c ~/policy/config.ini - depends_on: [ clone ] +- 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 - image: python:2.7 - pull: always - commands: - - pip install ansible ansible-later -q - - git clone https://gitea.rknet.org/ansible/ansible-later-policy.git ~/policy - - git ls-files *[^LICENSE,.md] | xargs ansible-later -c ~/policy/config.ini - 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: 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 }}**
Build: [{{ repo.Owner }}/{{ repo.Name }}]({{ build.link }}) ({{ build.branch }}) by {{ build.author }}
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 + +... diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..5becda8 --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +# ---> Ansible +*.retry +filter/plugins/ +library + +# ---> Python +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + diff --git a/defaults/main.yml b/defaults/main.yml index 39cf852..3880f6c 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -2,7 +2,7 @@ network_hostname: localhost network_fqdn: localdomain network_defaultif: eth0 -network_disable_ipv6: false +network_disable_ipv6: False network_dns_server: 8.8.8.8 network_interfaces: {} network_hosts_entries: [] diff --git a/handlers/main.yml b/handlers/main.yml index ac9b2f3..667356d 100644 --- a/handlers/main.yml +++ b/handlers/main.yml @@ -4,7 +4,7 @@ shell: sleep 2 && systemctl restart network async: 1 poll: 0 - ignore_errors: true + ignore_errors: yes when: not require_reboot | bool listen: __network_restart @@ -12,7 +12,7 @@ shell: sleep 2 && shutdown -r now "Reboot triggered by Ansible" async: 1 poll: 0 - ignore_errors: true + ignore_errors: yes when: require_reboot | bool listen: __host_reboot become: True diff --git a/templates/etc/hosts.j2 b/templates/etc/hosts.j2 index 365c69d..a36280a 100644 --- a/templates/etc/hosts.j2 +++ b/templates/etc/hosts.j2 @@ -1,7 +1,7 @@ #jinja2: lstrip_blocks: True # {{ ansible_managed }} 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 {% endif %} {% if network_hostname is defined and network_fqdn is defined and network_interfaces[network_defaultif].ipaddr is defined %}