commit 08c8babce8523e33a0929801b12c8e54fcc3a44c Author: Robert Kaussow Date: Tue May 12 22:42:53 2020 +0200 initial commit diff --git a/.drone.jsonnet b/.drone.jsonnet new file mode 100644 index 0000000..aff5b65 --- /dev/null +++ b/.drone.jsonnet @@ -0,0 +1,117 @@ +local PipelineLinting = { + kind: 'pipeline', + name: 'linting', + platform: { + os: 'linux', + arch: 'amd64', + }, + steps: [ + { + name: 'ansible-later', + image: 'xoxys/ansible-later', + commands: [ + 'ansible-later', + ], + }, + ], + trigger: { + ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'], + }, +}; + +local PipelineDocumentation = { + kind: 'pipeline', + name: 'documentation', + platform: { + os: 'linux', + arch: 'amd64', + }, + steps: [ + { + name: 'generate', + image: 'xoxys/ansible-doctor', + environment: { + ANSIBLE_DOCTOR_LOG_LEVEL: 'INFO', + ANSIBLE_DOCTOR_FORCE_OVERWRITE: true, + ANSIBLE_DOCTOR_EXCLUDE_FILES: 'molecule/', + ANSIBLE_DOCTOR_TEMPLATE: 'hugo-book', + ANSIBLE_DOCTOR_ROLE_NAME: '${DRONE_REPO_NAME#*.}', + ANSIBLE_DOCTOR_OUTPUT_DIR: '_docs/', + }, + }, + { + name: 'publish', + image: 'plugins/gh-pages', + settings: { + remote_url: 'https://gitea.rknet.org/ansible/${DRONE_REPO_NAME}', + netrc_machine: 'gitea.rknet.org', + username: { from_secret: 'gitea_username' }, + password: { from_secret: 'gitea_token' }, + pages_directory: '_docs/', + target_branch: 'docs', + }, + when: { + ref: ['refs/heads/master'], + }, + }, + { + name: 'trigger', + image: 'plugins/downstream', + settings: { + server: 'https://drone.rknet.org', + token: { from_secret: 'drone_token' }, + fork: true, + repositories: [ + 'ansible/ansible-galaxy', + ], + }, + when: { + ref: ['refs/heads/master'], + }, + }, + ], + trigger: { + ref: ['refs/heads/master', 'refs/tags/**', 'refs/pull/**'], + }, + depends_on: [ + 'linting', + ], +}; + +local PipelineNotification = { + kind: 'pipeline', + name: 'notification', + platform: { + os: 'linux', + arch: 'amd64', + }, + clone: { + disable: true, + }, + steps: [ + { + name: 'matrix', + image: 'plugins/matrix', + settings: { + homeserver: { from_secret: 'matrix_homeserver' }, + roomid: { from_secret: 'matrix_roomid' }, + 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: [ + 'documentation', + ], + trigger: { + status: ['success', 'failure'], + ref: ['refs/heads/master', 'refs/tags/**'], + }, +}; + +[ + PipelineLinting, + PipelineDocumentation, + PipelineNotification, +] diff --git a/.drone.yml b/.drone.yml new file mode 100644 index 0000000..cef57e0 --- /dev/null +++ b/.drone.yml @@ -0,0 +1,117 @@ +--- +kind: pipeline +name: linting + +platform: + os: linux + arch: amd64 + +steps: +- name: ansible-later + image: xoxys/ansible-later + commands: + - ansible-later + +trigger: + ref: + - refs/heads/master + - refs/tags/** + - refs/pull/** + +--- +kind: pipeline +name: documentation + +platform: + os: linux + arch: amd64 + +steps: +- name: generate + image: xoxys/ansible-doctor + environment: + ANSIBLE_DOCTOR_EXCLUDE_FILES: molecule/ + ANSIBLE_DOCTOR_FORCE_OVERWRITE: true + ANSIBLE_DOCTOR_LOG_LEVEL: INFO + ANSIBLE_DOCTOR_OUTPUT_DIR: _docs/ + ANSIBLE_DOCTOR_ROLE_NAME: ${DRONE_REPO_NAME#*.} + ANSIBLE_DOCTOR_TEMPLATE: hugo-book + +- name: publish + image: plugins/gh-pages + settings: + netrc_machine: gitea.rknet.org + pages_directory: _docs/ + password: + from_secret: gitea_token + remote_url: https://gitea.rknet.org/ansible/${DRONE_REPO_NAME} + target_branch: docs + username: + from_secret: gitea_username + when: + ref: + - refs/heads/master + +- name: trigger + image: plugins/downstream + settings: + fork: true + repositories: + - ansible/ansible-galaxy + server: https://drone.rknet.org + token: + from_secret: drone_token + when: + ref: + - refs/heads/master + +trigger: + ref: + - refs/heads/master + - refs/tags/** + - refs/pull/** + +depends_on: +- linting + +--- +kind: pipeline +name: notification + +platform: + os: linux + arch: amd64 + +clone: + disable: true + +steps: +- name: matrix + image: plugins/matrix + settings: + homeserver: + from_secret: matrix_homeserver + password: + from_secret: matrix_password + roomid: + from_secret: matrix_roomid + 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: +- documentation + +--- +kind: signature +hmac: c1537e2fde6203c2ea697a7dffe7560b9e5c9a58d8de1f44d779c70b9bedc2e6 + +... diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..d97b7cd --- /dev/null +++ b/.gitignore @@ -0,0 +1,11 @@ +# ---> Ansible +*.retry +plugins +library + +# ---> Python +# Byte-compiled / optimized / DLL files +__pycache__/ +*.py[cod] +*$py.class + diff --git a/.later.yml b/.later.yml new file mode 100644 index 0000000..45911c9 --- /dev/null +++ b/.later.yml @@ -0,0 +1,18 @@ +--- +ansible: + custom_modules: + - iptables_raw + - openssl_pkcs12 + - proxmox_kvm2 + - ucr + - yum_versionlock + +rules: + exclude_files: + - molecule/ + - "LICENSE*" + - "**/*.md" + - "**/*.ini" + + exclude_filter: + - LINT0009 diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..bb3e998 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2020 Robert Kaussow + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is furnished +to do so, subject to the following conditions: + +The above copyright notice and this permission notice (including the next +paragraph) shall be included in all copies or substantial portions of the +Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS +OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, +WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF +OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/README.md b/README.md new file mode 100644 index 0000000..c217314 --- /dev/null +++ b/README.md @@ -0,0 +1,14 @@ +# xoxys.ucs_dns + +[![Build Status](https://img.shields.io/drone/build/ansible/xoxys.ucs_dns?logo=drone&server=https%3A%2F%2Fdrone.rknet.org)](https://drone.rknet.org/ansible/xoxys.ucs_dns) +[![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?label=license)](LICENSE) + +You can find the full documentation at [https://galaxy.geekdocs.de](https://galaxy.geekdocs.de/roles/cloud/ucs_dns/). + +## License + +This project is licensed under the MIT License - see the [LICENSE](LICENSE) file for details. + +## Maintainers and Contributors + +[Robert Kaussow](https://gitea.rknet.org/xoxys) diff --git a/defaults/main.yml b/defaults/main.yml new file mode 100644 index 0000000..158841f --- /dev/null +++ b/defaults/main.yml @@ -0,0 +1,8 @@ +--- +# @var ucs_dns_default_zone: $ "_unset_" + +# @var ucs_dns_become_password: $ "_unset_" +ucs_dns_delegate_to: localhost + +ucs_dns_records: [] +ucs_dns_records_extra: [] diff --git a/meta/main.yml b/meta/main.yml new file mode 100644 index 0000000..9f358a8 --- /dev/null +++ b/meta/main.yml @@ -0,0 +1,21 @@ +# Standards: 0.1 +--- +galaxy_info: +# @meta author:value: [Robert Kaussow](https://gitea.rknet.org/xoxys) + author: "Robert Kaussow " +# @meta description: > +# [![Source Code](https://img.shields.io/badge/gitea-source%20code-blue?logo=gitea&logoColor=white)](https://gitea.rknet.org/ansible/xoxys.ucs_dns) +# [![Build Status](https://img.shields.io/drone/build/ansible/xoxys.ucs_dns?logo=drone&server=https%3A%2F%2Fdrone.rknet.org)](https://drone.rknet.org/ansible/xoxys.ucs_dns) +# [![License: MIT](https://img.shields.io/badge/License-MIT-blue.svg?label=license)](LICENSE) +# +# Manage DNS records on UCS +# @end + description: Manage DNS records on UCS + license: MIT + min_ansible_version: 2.8 + platforms: + - name: EL + versions: + - 7 + galaxy_tags: +dependencies: [] diff --git a/tasks/main.yml b/tasks/main.yml new file mode 100644 index 0000000..1f69f7a --- /dev/null +++ b/tasks/main.yml @@ -0,0 +1,2 @@ +--- +- include_tasks: setup.yml diff --git a/tasks/setup.yml b/tasks/setup.yml new file mode 100644 index 0000000..5ac29b4 --- /dev/null +++ b/tasks/setup.yml @@ -0,0 +1,24 @@ +--- +- block: + - name: Delegate become password + set_fact: + ansible_become_pass: "{{ ucs_dns_become_password }}" + delegate_to: "{{ ucs_dns_delegate_to }}" + delegate_facts: True + when: + - ucs_dns_become_password is defined + - ucs_dns_become_password + + - name: Create DNS records + udm_dns_record: + name: "{{ item.name }}" + zone: "{{ item.zone | default('ucs_dns_default_zone') }}" + type: "{{ item.type | default('host_record') }}" + data: "{{ item.value | default(omit) }}" + state: "{{ item.state | default('present') }}" + loop: ucs_dns_records + ucs_dns_records_extra + loop_control: + label: "{{ item.zone }}:{{ item.name }}" + delegate_to: "{{ ucs_dns_delegate_to }}" + become: True + become_user: root