From d688eec102f843a94fc641833cc1bf8b139dc4dd Mon Sep 17 00:00:00 2001 From: Tobias Hoge Date: Tue, 29 Nov 2022 11:02:54 +0100 Subject: [PATCH 01/15] change to collection --- {library => plugins/modules}/dokku_acl_app.py | 0 {library => plugins/modules}/dokku_acl_service.py | 0 {module_utils => plugins/modules}/dokku_app.py | 0 {library => plugins/modules}/dokku_builder.py | 0 {library => plugins/modules}/dokku_certs.py | 0 {library => plugins/modules}/dokku_checks.py | 0 {library => plugins/modules}/dokku_clone.py | 0 {library => plugins/modules}/dokku_config.py | 0 {library => plugins/modules}/dokku_docker_options.py | 0 {library => plugins/modules}/dokku_domains.py | 0 {module_utils => plugins/modules}/dokku_git.py | 0 {library => plugins/modules}/dokku_git_sync.py | 0 {library => plugins/modules}/dokku_global_cert.py | 0 {library => plugins/modules}/dokku_http_auth.py | 0 {library => plugins/modules}/dokku_image.py | 0 {library => plugins/modules}/dokku_letsencrypt.py | 0 {library => plugins/modules}/dokku_network.py | 0 {library => plugins/modules}/dokku_network_property.py | 0 {library => plugins/modules}/dokku_ports.py | 0 {library => plugins/modules}/dokku_proxy.py | 0 {library => plugins/modules}/dokku_ps_scale.py | 0 {library => plugins/modules}/dokku_registry.py | 0 {library => plugins/modules}/dokku_resource_limit.py | 0 {library => plugins/modules}/dokku_resource_reserve.py | 0 {library => plugins/modules}/dokku_service_create.py | 0 {library => plugins/modules}/dokku_service_link.py | 0 {library => plugins/modules}/dokku_storage.py | 0 {module_utils => plugins/modules}/dokku_utils.py | 0 {defaults => roles/install_dokku/defaults}/main.yml | 0 {defaults => roles/install_dokku/defaults}/main.yml.base | 0 {files => roles/install_dokku/files}/nginx.default | 0 {handlers => roles/install_dokku/handlers}/main.yml | 0 {meta => roles/install_dokku/meta}/main.yml | 0 {molecule => roles/install_dokku/molecule}/default/converge.yml | 0 {molecule => roles/install_dokku/molecule}/default/molecule.yml | 0 {molecule => roles/install_dokku/molecule}/default/verify.yml | 0 {tasks => roles/install_dokku/tasks}/dokku-daemon.yml | 0 {tasks => roles/install_dokku/tasks}/init.yml | 0 {tasks => roles/install_dokku/tasks}/install-pin.yml | 0 {tasks => roles/install_dokku/tasks}/install.yml | 0 {tasks => roles/install_dokku/tasks}/main.yml | 0 {tasks => roles/install_dokku/tasks}/nginx.yml | 0 {tasks => roles/install_dokku/tasks}/ssh-key.yml | 0 {tasks => roles/install_dokku/tasks}/ssh-keys.yml | 0 44 files changed, 0 insertions(+), 0 deletions(-) rename {library => plugins/modules}/dokku_acl_app.py (100%) rename {library => plugins/modules}/dokku_acl_service.py (100%) rename {module_utils => plugins/modules}/dokku_app.py (100%) rename {library => plugins/modules}/dokku_builder.py (100%) rename {library => plugins/modules}/dokku_certs.py (100%) rename {library => plugins/modules}/dokku_checks.py (100%) rename {library => plugins/modules}/dokku_clone.py (100%) rename {library => plugins/modules}/dokku_config.py (100%) rename {library => plugins/modules}/dokku_docker_options.py (100%) rename {library => plugins/modules}/dokku_domains.py (100%) rename {module_utils => plugins/modules}/dokku_git.py (100%) rename {library => plugins/modules}/dokku_git_sync.py (100%) rename {library => plugins/modules}/dokku_global_cert.py (100%) rename {library => plugins/modules}/dokku_http_auth.py (100%) rename {library => plugins/modules}/dokku_image.py (100%) rename {library => plugins/modules}/dokku_letsencrypt.py (100%) rename {library => plugins/modules}/dokku_network.py (100%) rename {library => plugins/modules}/dokku_network_property.py (100%) rename {library => plugins/modules}/dokku_ports.py (100%) rename {library => plugins/modules}/dokku_proxy.py (100%) rename {library => plugins/modules}/dokku_ps_scale.py (100%) rename {library => plugins/modules}/dokku_registry.py (100%) rename {library => plugins/modules}/dokku_resource_limit.py (100%) rename {library => plugins/modules}/dokku_resource_reserve.py (100%) rename {library => plugins/modules}/dokku_service_create.py (100%) rename {library => plugins/modules}/dokku_service_link.py (100%) rename {library => plugins/modules}/dokku_storage.py (100%) rename {module_utils => plugins/modules}/dokku_utils.py (100%) rename {defaults => roles/install_dokku/defaults}/main.yml (100%) rename {defaults => roles/install_dokku/defaults}/main.yml.base (100%) rename {files => roles/install_dokku/files}/nginx.default (100%) rename {handlers => roles/install_dokku/handlers}/main.yml (100%) rename {meta => roles/install_dokku/meta}/main.yml (100%) rename {molecule => roles/install_dokku/molecule}/default/converge.yml (100%) rename {molecule => roles/install_dokku/molecule}/default/molecule.yml (100%) rename {molecule => roles/install_dokku/molecule}/default/verify.yml (100%) rename {tasks => roles/install_dokku/tasks}/dokku-daemon.yml (100%) rename {tasks => roles/install_dokku/tasks}/init.yml (100%) rename {tasks => roles/install_dokku/tasks}/install-pin.yml (100%) rename {tasks => roles/install_dokku/tasks}/install.yml (100%) rename {tasks => roles/install_dokku/tasks}/main.yml (100%) rename {tasks => roles/install_dokku/tasks}/nginx.yml (100%) rename {tasks => roles/install_dokku/tasks}/ssh-key.yml (100%) rename {tasks => roles/install_dokku/tasks}/ssh-keys.yml (100%) diff --git a/library/dokku_acl_app.py b/plugins/modules/dokku_acl_app.py similarity index 100% rename from library/dokku_acl_app.py rename to plugins/modules/dokku_acl_app.py diff --git a/library/dokku_acl_service.py b/plugins/modules/dokku_acl_service.py similarity index 100% rename from library/dokku_acl_service.py rename to plugins/modules/dokku_acl_service.py diff --git a/module_utils/dokku_app.py b/plugins/modules/dokku_app.py similarity index 100% rename from module_utils/dokku_app.py rename to plugins/modules/dokku_app.py diff --git a/library/dokku_builder.py b/plugins/modules/dokku_builder.py similarity index 100% rename from library/dokku_builder.py rename to plugins/modules/dokku_builder.py diff --git a/library/dokku_certs.py b/plugins/modules/dokku_certs.py similarity index 100% rename from library/dokku_certs.py rename to plugins/modules/dokku_certs.py diff --git a/library/dokku_checks.py b/plugins/modules/dokku_checks.py similarity index 100% rename from library/dokku_checks.py rename to plugins/modules/dokku_checks.py diff --git a/library/dokku_clone.py b/plugins/modules/dokku_clone.py similarity index 100% rename from library/dokku_clone.py rename to plugins/modules/dokku_clone.py diff --git a/library/dokku_config.py b/plugins/modules/dokku_config.py similarity index 100% rename from library/dokku_config.py rename to plugins/modules/dokku_config.py diff --git a/library/dokku_docker_options.py b/plugins/modules/dokku_docker_options.py similarity index 100% rename from library/dokku_docker_options.py rename to plugins/modules/dokku_docker_options.py diff --git a/library/dokku_domains.py b/plugins/modules/dokku_domains.py similarity index 100% rename from library/dokku_domains.py rename to plugins/modules/dokku_domains.py diff --git a/module_utils/dokku_git.py b/plugins/modules/dokku_git.py similarity index 100% rename from module_utils/dokku_git.py rename to plugins/modules/dokku_git.py diff --git a/library/dokku_git_sync.py b/plugins/modules/dokku_git_sync.py similarity index 100% rename from library/dokku_git_sync.py rename to plugins/modules/dokku_git_sync.py diff --git a/library/dokku_global_cert.py b/plugins/modules/dokku_global_cert.py similarity index 100% rename from library/dokku_global_cert.py rename to plugins/modules/dokku_global_cert.py diff --git a/library/dokku_http_auth.py b/plugins/modules/dokku_http_auth.py similarity index 100% rename from library/dokku_http_auth.py rename to plugins/modules/dokku_http_auth.py diff --git a/library/dokku_image.py b/plugins/modules/dokku_image.py similarity index 100% rename from library/dokku_image.py rename to plugins/modules/dokku_image.py diff --git a/library/dokku_letsencrypt.py b/plugins/modules/dokku_letsencrypt.py similarity index 100% rename from library/dokku_letsencrypt.py rename to plugins/modules/dokku_letsencrypt.py diff --git a/library/dokku_network.py b/plugins/modules/dokku_network.py similarity index 100% rename from library/dokku_network.py rename to plugins/modules/dokku_network.py diff --git a/library/dokku_network_property.py b/plugins/modules/dokku_network_property.py similarity index 100% rename from library/dokku_network_property.py rename to plugins/modules/dokku_network_property.py diff --git a/library/dokku_ports.py b/plugins/modules/dokku_ports.py similarity index 100% rename from library/dokku_ports.py rename to plugins/modules/dokku_ports.py diff --git a/library/dokku_proxy.py b/plugins/modules/dokku_proxy.py similarity index 100% rename from library/dokku_proxy.py rename to plugins/modules/dokku_proxy.py diff --git a/library/dokku_ps_scale.py b/plugins/modules/dokku_ps_scale.py similarity index 100% rename from library/dokku_ps_scale.py rename to plugins/modules/dokku_ps_scale.py diff --git a/library/dokku_registry.py b/plugins/modules/dokku_registry.py similarity index 100% rename from library/dokku_registry.py rename to plugins/modules/dokku_registry.py diff --git a/library/dokku_resource_limit.py b/plugins/modules/dokku_resource_limit.py similarity index 100% rename from library/dokku_resource_limit.py rename to plugins/modules/dokku_resource_limit.py diff --git a/library/dokku_resource_reserve.py b/plugins/modules/dokku_resource_reserve.py similarity index 100% rename from library/dokku_resource_reserve.py rename to plugins/modules/dokku_resource_reserve.py diff --git a/library/dokku_service_create.py b/plugins/modules/dokku_service_create.py similarity index 100% rename from library/dokku_service_create.py rename to plugins/modules/dokku_service_create.py diff --git a/library/dokku_service_link.py b/plugins/modules/dokku_service_link.py similarity index 100% rename from library/dokku_service_link.py rename to plugins/modules/dokku_service_link.py diff --git a/library/dokku_storage.py b/plugins/modules/dokku_storage.py similarity index 100% rename from library/dokku_storage.py rename to plugins/modules/dokku_storage.py diff --git a/module_utils/dokku_utils.py b/plugins/modules/dokku_utils.py similarity index 100% rename from module_utils/dokku_utils.py rename to plugins/modules/dokku_utils.py diff --git a/defaults/main.yml b/roles/install_dokku/defaults/main.yml similarity index 100% rename from defaults/main.yml rename to roles/install_dokku/defaults/main.yml diff --git a/defaults/main.yml.base b/roles/install_dokku/defaults/main.yml.base similarity index 100% rename from defaults/main.yml.base rename to roles/install_dokku/defaults/main.yml.base diff --git a/files/nginx.default b/roles/install_dokku/files/nginx.default similarity index 100% rename from files/nginx.default rename to roles/install_dokku/files/nginx.default diff --git a/handlers/main.yml b/roles/install_dokku/handlers/main.yml similarity index 100% rename from handlers/main.yml rename to roles/install_dokku/handlers/main.yml diff --git a/meta/main.yml b/roles/install_dokku/meta/main.yml similarity index 100% rename from meta/main.yml rename to roles/install_dokku/meta/main.yml diff --git a/molecule/default/converge.yml b/roles/install_dokku/molecule/default/converge.yml similarity index 100% rename from molecule/default/converge.yml rename to roles/install_dokku/molecule/default/converge.yml diff --git a/molecule/default/molecule.yml b/roles/install_dokku/molecule/default/molecule.yml similarity index 100% rename from molecule/default/molecule.yml rename to roles/install_dokku/molecule/default/molecule.yml diff --git a/molecule/default/verify.yml b/roles/install_dokku/molecule/default/verify.yml similarity index 100% rename from molecule/default/verify.yml rename to roles/install_dokku/molecule/default/verify.yml diff --git a/tasks/dokku-daemon.yml b/roles/install_dokku/tasks/dokku-daemon.yml similarity index 100% rename from tasks/dokku-daemon.yml rename to roles/install_dokku/tasks/dokku-daemon.yml diff --git a/tasks/init.yml b/roles/install_dokku/tasks/init.yml similarity index 100% rename from tasks/init.yml rename to roles/install_dokku/tasks/init.yml diff --git a/tasks/install-pin.yml b/roles/install_dokku/tasks/install-pin.yml similarity index 100% rename from tasks/install-pin.yml rename to roles/install_dokku/tasks/install-pin.yml diff --git a/tasks/install.yml b/roles/install_dokku/tasks/install.yml similarity index 100% rename from tasks/install.yml rename to roles/install_dokku/tasks/install.yml diff --git a/tasks/main.yml b/roles/install_dokku/tasks/main.yml similarity index 100% rename from tasks/main.yml rename to roles/install_dokku/tasks/main.yml diff --git a/tasks/nginx.yml b/roles/install_dokku/tasks/nginx.yml similarity index 100% rename from tasks/nginx.yml rename to roles/install_dokku/tasks/nginx.yml diff --git a/tasks/ssh-key.yml b/roles/install_dokku/tasks/ssh-key.yml similarity index 100% rename from tasks/ssh-key.yml rename to roles/install_dokku/tasks/ssh-key.yml diff --git a/tasks/ssh-keys.yml b/roles/install_dokku/tasks/ssh-keys.yml similarity index 100% rename from tasks/ssh-keys.yml rename to roles/install_dokku/tasks/ssh-keys.yml From 86c463a362cd258be939c7b536379788cb3ccc5a Mon Sep 17 00:00:00 2001 From: Tobias Hoge Date: Tue, 29 Nov 2022 11:33:23 +0100 Subject: [PATCH 02/15] add galaxy file --- .ssh/id_rsa.pub | 0 galaxy.yml | 61 +++++++++++++++++++++++++++++++++++++++++++++++ plugins/README.md | 31 ++++++++++++++++++++++++ 3 files changed, 92 insertions(+) create mode 100755 .ssh/id_rsa.pub create mode 100644 galaxy.yml create mode 100644 plugins/README.md diff --git a/.ssh/id_rsa.pub b/.ssh/id_rsa.pub new file mode 100755 index 0000000..e69de29 diff --git a/galaxy.yml b/galaxy.yml new file mode 100644 index 0000000..654c9e9 --- /dev/null +++ b/galaxy.yml @@ -0,0 +1,61 @@ +### REQUIRED +# The namespace of the collection. This can be a company/brand/organization or product namespace under which all +# content lives. May only contain alphanumeric lowercase characters and underscores. Namespaces cannot start with +# underscores or numbers and cannot contain consecutive underscores +namespace: dokku_bot + +# The name of the collection. Has the same character restrictions as 'namespace' +name: ansible_dokku + +# The version of the collection. Must be compatible with semantic versioning +version: 1.0.0 + +# The path to the Markdown (.md) readme file. This path is relative to the root of the collection +readme: README.md + +# A list of the collection's content authors. Can be just the name or in the format 'Full Name (url) +# @nicks:irc/im.site#channel' +authors: +- your name + + +### OPTIONAL but strongly recommended +# A short summary description of the collection +description: your collection description + +# Either a single license or a list of licenses for content inside of a collection. Ansible Galaxy currently only +# accepts L(SPDX,https://spdx.org/licenses/) licenses. This key is mutually exclusive with 'license_file' +license: +- GPL-2.0-or-later + +# The path to the license file for the collection. This path is relative to the root of the collection. This key is +# mutually exclusive with 'license' +license_file: '' + +# A list of tags you want to associate with the collection for indexing/searching. A tag name has the same character +# requirements as 'namespace' and 'name' +tags: [] + +# Collections that this collection requires to be installed for it to be usable. The key of the dict is the +# collection label 'namespace.name'. The value is a version range +# L(specifiers,https://python-semanticversion.readthedocs.io/en/latest/#requirement-specification). Multiple version +# range specifiers can be set and are separated by ',' +dependencies: {} + +# The URL of the originating SCM repository +repository: http://example.com/repository + +# The URL to any online docs +documentation: http://docs.example.com + +# The URL to the homepage of the collection/project +homepage: http://example.com + +# The URL to the collection issue tracker +issues: http://example.com/issue/tracker + +# A list of file glob-like patterns used to filter any files or directories that should not be included in the build +# artifact. A pattern is matched from the relative path of the file or directory of the collection directory. This +# uses 'fnmatch' to match the files or directories. Some directories and files like 'galaxy.yml', '*.pyc', '*.retry', +# and '.git' are always filtered +build_ignore: [] diff --git a/plugins/README.md b/plugins/README.md new file mode 100644 index 0000000..29aa319 --- /dev/null +++ b/plugins/README.md @@ -0,0 +1,31 @@ +# Collections Plugins Directory + +This directory can be used to ship various plugins inside an Ansible collection. Each plugin is placed in a folder that +is named after the type of plugin it is in. It can also include the `module_utils` and `modules` directory that +would contain module utils and modules respectively. + +Here is an example directory of the majority of plugins currently supported by Ansible: + +``` +└── plugins + ├── action + ├── become + ├── cache + ├── callback + ├── cliconf + ├── connection + ├── filter + ├── httpapi + ├── inventory + ├── lookup + ├── module_utils + ├── modules + ├── netconf + ├── shell + ├── strategy + ├── terminal + ├── test + └── vars +``` + +A full list of plugin types can be found at [Working With Plugins](https://docs.ansible.com/ansible-core/2.13/plugins/plugins.html). From 5d85768750ec43ec15e67879baa8d031b95cf29c Mon Sep 17 00:00:00 2001 From: Tobias Hoge Date: Tue, 29 Nov 2022 13:32:35 +0100 Subject: [PATCH 03/15] fix dokku_app --- library/dokku_app.py | 69 ------------------ plugins/modules/dokku_app.py | 113 +++++++++++++++--------------- plugins/modules/dokku_util_app.py | 66 +++++++++++++++++ 3 files changed, 124 insertions(+), 124 deletions(-) delete mode 100644 library/dokku_app.py create mode 100644 plugins/modules/dokku_util_app.py diff --git a/library/dokku_app.py b/library/dokku_app.py deleted file mode 100644 index 4dc1c6d..0000000 --- a/library/dokku_app.py +++ /dev/null @@ -1,69 +0,0 @@ -#!/usr/bin/python -# -*- coding: utf-8 -*- -from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_app import ( - dokku_app_ensure_present, - dokku_app_ensure_absent, -) - -DOCUMENTATION = """ ---- -module: dokku_app -short_description: Create or destroy dokku apps -options: - app: - description: - - The name of the app - required: True - default: null - aliases: [] - state: - description: - - The state of the app - required: False - default: present - choices: [ "present", "absent" ] - aliases: [] -author: Jose Diaz-Gonzalez -requirements: [ ] -""" - -EXAMPLES = """ -- name: Create a dokku app - dokku_app: - app: hello-world - -- name: Delete that repo - dokku_app: - app: hello-world - state: absent -""" - - -def main(): - fields = { - "app": {"required": True, "type": "str"}, - "state": { - "required": False, - "default": "present", - "choices": ["present", "absent"], - "type": "str", - }, - } - choice_map = { - "present": dokku_app_ensure_present, - "absent": dokku_app_ensure_absent, - } - - module = AnsibleModule(argument_spec=fields, supports_check_mode=False) - is_error, has_changed, result = choice_map.get(module.params["state"])( - module.params - ) - - if is_error: - module.fail_json(msg=result["error"], meta=result) - module.exit_json(changed=has_changed, meta=result) - - -if __name__ == "__main__": - main() diff --git a/plugins/modules/dokku_app.py b/plugins/modules/dokku_app.py index a02a8c2..935eedc 100644 --- a/plugins/modules/dokku_app.py +++ b/plugins/modules/dokku_app.py @@ -1,66 +1,69 @@ #!/usr/bin/python # -*- coding: utf-8 -*- -"""Shared functions for managing dokku apps""" +from ansible.module_utils.basic import AnsibleModule +from ansible.module_utils.dokku_util_app import ( + dokku_app_ensure_present, + dokku_app_ensure_absent, +) -import subprocess +DOCUMENTATION = """ +--- +module: dokku_app +short_description: Create or destroy dokku apps +options: + app: + description: + - The name of the app + required: True + default: null + aliases: [] + state: + description: + - The state of the app + required: False + default: present + choices: [ "present", "absent" ] + aliases: [] +author: Jose Diaz-Gonzalez +requirements: [ ] +""" +EXAMPLES = """ +- name: Create a dokku app + dokku_app: + app: hello-world -def dokku_apps_exists(app): - exists = False - error = None - command = "dokku --quiet apps:exists {0}".format(app) - try: - subprocess.check_call(command, shell=True) - exists = True - except subprocess.CalledProcessError as e: - # we do not distinguish non-zero exit codes - error = str(e) - return exists, error +- name: Delete that repo + dokku_app: + app: hello-world + state: absent +""" -def dokku_app_ensure_present(data): - """Create app if it does not exist.""" - is_error = True - has_changed = False - meta = {"present": False} +def main(): + fields = { + "app": {"required": True, "type": "str"}, + "state": { + "required": False, + "default": "present", + "choices": ["present", "absent"], + "type": "str", + }, + } + choice_map = { + "present": dokku_app_ensure_present, + "absent": dokku_app_ensure_absent, + } - exists, _error = dokku_apps_exists(data["app"]) - if exists: - is_error = False - meta["present"] = True - return (is_error, has_changed, meta) + module = AnsibleModule(argument_spec=fields, supports_check_mode=False) + is_error, has_changed, result = choice_map.get(module.params["state"])( + module.params + ) - command = "dokku apps:create {0}".format(data["app"]) - try: - subprocess.check_call(command, shell=True) - is_error = False - has_changed = True - meta["present"] = True - except subprocess.CalledProcessError as e: - meta["error"] = str(e.output) + if is_error: + module.fail_json(msg=result["error"], meta=result) + module.exit_json(changed=has_changed, meta=result) - return (is_error, has_changed, meta) - -def dokku_app_ensure_absent(data=None): - """Remove app if it exists.""" - is_error = True - has_changed = False - meta = {"present": True} - - exists, _error = dokku_apps_exists(data["app"]) - if not exists: - is_error = False - meta["present"] = False - return (is_error, has_changed, meta) - - command = "dokku --force apps:destroy {0}".format(data["app"]) - try: - subprocess.check_call(command, shell=True) - is_error = False - has_changed = True - meta["present"] = False - except subprocess.CalledProcessError as e: - meta["error"] = str(e) - - return (is_error, has_changed, meta) +if __name__ == "__main__": + main() diff --git a/plugins/modules/dokku_util_app.py b/plugins/modules/dokku_util_app.py new file mode 100644 index 0000000..a02a8c2 --- /dev/null +++ b/plugins/modules/dokku_util_app.py @@ -0,0 +1,66 @@ +#!/usr/bin/python +# -*- coding: utf-8 -*- +"""Shared functions for managing dokku apps""" + +import subprocess + + +def dokku_apps_exists(app): + exists = False + error = None + command = "dokku --quiet apps:exists {0}".format(app) + try: + subprocess.check_call(command, shell=True) + exists = True + except subprocess.CalledProcessError as e: + # we do not distinguish non-zero exit codes + error = str(e) + return exists, error + + +def dokku_app_ensure_present(data): + """Create app if it does not exist.""" + is_error = True + has_changed = False + meta = {"present": False} + + exists, _error = dokku_apps_exists(data["app"]) + if exists: + is_error = False + meta["present"] = True + return (is_error, has_changed, meta) + + command = "dokku apps:create {0}".format(data["app"]) + try: + subprocess.check_call(command, shell=True) + is_error = False + has_changed = True + meta["present"] = True + except subprocess.CalledProcessError as e: + meta["error"] = str(e.output) + + return (is_error, has_changed, meta) + + +def dokku_app_ensure_absent(data=None): + """Remove app if it exists.""" + is_error = True + has_changed = False + meta = {"present": True} + + exists, _error = dokku_apps_exists(data["app"]) + if not exists: + is_error = False + meta["present"] = False + return (is_error, has_changed, meta) + + command = "dokku --force apps:destroy {0}".format(data["app"]) + try: + subprocess.check_call(command, shell=True) + is_error = False + has_changed = True + meta["present"] = False + except subprocess.CalledProcessError as e: + meta["error"] = str(e) + + return (is_error, has_changed, meta) From 0eb7e79aa0178f24fb6bb3d1095491038a92d383 Mon Sep 17 00:00:00 2001 From: Tobias Hoge Date: Tue, 29 Nov 2022 13:49:20 +0100 Subject: [PATCH 04/15] fix module_utils --- plugins/modules/dokku_util_app.py => module_utils/dokku_app.py | 0 {plugins/modules => module_utils}/dokku_git.py | 0 {plugins/modules => module_utils}/dokku_utils.py | 0 plugins/modules/dokku_app.py | 3 ++- 4 files changed, 2 insertions(+), 1 deletion(-) rename plugins/modules/dokku_util_app.py => module_utils/dokku_app.py (100%) rename {plugins/modules => module_utils}/dokku_git.py (100%) rename {plugins/modules => module_utils}/dokku_utils.py (100%) diff --git a/plugins/modules/dokku_util_app.py b/module_utils/dokku_app.py similarity index 100% rename from plugins/modules/dokku_util_app.py rename to module_utils/dokku_app.py diff --git a/plugins/modules/dokku_git.py b/module_utils/dokku_git.py similarity index 100% rename from plugins/modules/dokku_git.py rename to module_utils/dokku_git.py diff --git a/plugins/modules/dokku_utils.py b/module_utils/dokku_utils.py similarity index 100% rename from plugins/modules/dokku_utils.py rename to module_utils/dokku_utils.py diff --git a/plugins/modules/dokku_app.py b/plugins/modules/dokku_app.py index 935eedc..308d0e8 100644 --- a/plugins/modules/dokku_app.py +++ b/plugins/modules/dokku_app.py @@ -1,7 +1,8 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_util_app import ( + +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_app import ( dokku_app_ensure_present, dokku_app_ensure_absent, ) From 7b3acbc036284b8cec7e0b206854358c4438335e Mon Sep 17 00:00:00 2001 From: Tobias Hoge Date: Tue, 29 Nov 2022 13:57:31 +0100 Subject: [PATCH 05/15] fix module_utils --- {module_utils => plugins/module_utils}/dokku_app.py | 0 {module_utils => plugins/module_utils}/dokku_git.py | 0 {module_utils => plugins/module_utils}/dokku_utils.py | 0 3 files changed, 0 insertions(+), 0 deletions(-) rename {module_utils => plugins/module_utils}/dokku_app.py (100%) rename {module_utils => plugins/module_utils}/dokku_git.py (100%) rename {module_utils => plugins/module_utils}/dokku_utils.py (100%) diff --git a/module_utils/dokku_app.py b/plugins/module_utils/dokku_app.py similarity index 100% rename from module_utils/dokku_app.py rename to plugins/module_utils/dokku_app.py diff --git a/module_utils/dokku_git.py b/plugins/module_utils/dokku_git.py similarity index 100% rename from module_utils/dokku_git.py rename to plugins/module_utils/dokku_git.py diff --git a/module_utils/dokku_utils.py b/plugins/module_utils/dokku_utils.py similarity index 100% rename from module_utils/dokku_utils.py rename to plugins/module_utils/dokku_utils.py From 571284255f3441906edc88e0aa9bbc235eeafa37 Mon Sep 17 00:00:00 2001 From: Tobias Hoge Date: Tue, 29 Nov 2022 14:27:24 +0100 Subject: [PATCH 06/15] fix module_utils imports --- plugins/modules/dokku_acl_app.py | 2 +- plugins/modules/dokku_acl_service.py | 2 +- plugins/modules/dokku_certs.py | 2 +- plugins/modules/dokku_checks.py | 2 +- plugins/modules/dokku_clone.py | 4 ++-- plugins/modules/dokku_config.py | 2 +- plugins/modules/dokku_docker_options.py | 2 +- plugins/modules/dokku_domains.py | 2 +- plugins/modules/dokku_git_sync.py | 2 +- plugins/modules/dokku_global_cert.py | 2 +- plugins/modules/dokku_http_auth.py | 2 +- plugins/modules/dokku_image.py | 4 ++-- plugins/modules/dokku_letsencrypt.py | 2 +- plugins/modules/dokku_ports.py | 2 +- plugins/modules/dokku_proxy.py | 2 +- plugins/modules/dokku_ps_scale.py | 2 +- plugins/modules/dokku_registry.py | 2 +- plugins/modules/dokku_resource_limit.py | 2 +- plugins/modules/dokku_resource_reserve.py | 2 +- plugins/modules/dokku_storage.py | 2 +- 20 files changed, 22 insertions(+), 22 deletions(-) diff --git a/plugins/modules/dokku_acl_app.py b/plugins/modules/dokku_acl_app.py index 4af5ac5..ab57659 100644 --- a/plugins/modules/dokku_acl_app.py +++ b/plugins/modules/dokku_acl_app.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output DOCUMENTATION = """ --- diff --git a/plugins/modules/dokku_acl_service.py b/plugins/modules/dokku_acl_service.py index c6e01b8..250bfbf 100644 --- a/plugins/modules/dokku_acl_service.py +++ b/plugins/modules/dokku_acl_service.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output DOCUMENTATION = """ --- diff --git a/plugins/modules/dokku_certs.py b/plugins/modules/dokku_certs.py index 75fa669..08c76ed 100644 --- a/plugins/modules/dokku_certs.py +++ b/plugins/modules/dokku_certs.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output import subprocess import re diff --git a/plugins/modules/dokku_checks.py b/plugins/modules/dokku_checks.py index d6faad6..5648117 100644 --- a/plugins/modules/dokku_checks.py +++ b/plugins/modules/dokku_checks.py @@ -3,7 +3,7 @@ import subprocess from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output DOCUMENTATION = """ --- diff --git a/plugins/modules/dokku_clone.py b/plugins/modules/dokku_clone.py index 0b38040..76bf655 100644 --- a/plugins/modules/dokku_clone.py +++ b/plugins/modules/dokku_clone.py @@ -3,8 +3,8 @@ import subprocess from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_app import dokku_app_ensure_present -from ansible.module_utils.dokku_git import dokku_git_sha +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_app import dokku_app_ensure_present +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_git import dokku_git_sha DOCUMENTATION = """ --- diff --git a/plugins/modules/dokku_config.py b/plugins/modules/dokku_config.py index 167d8a6..cc44536 100644 --- a/plugins/modules/dokku_config.py +++ b/plugins/modules/dokku_config.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output import json import pipes import subprocess diff --git a/plugins/modules/dokku_docker_options.py b/plugins/modules/dokku_docker_options.py index cc79c00..5dc777d 100644 --- a/plugins/modules/dokku_docker_options.py +++ b/plugins/modules/dokku_docker_options.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output import pipes import subprocess import re diff --git a/plugins/modules/dokku_domains.py b/plugins/modules/dokku_domains.py index 3cef986..dac7c1f 100644 --- a/plugins/modules/dokku_domains.py +++ b/plugins/modules/dokku_domains.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output import pipes import subprocess diff --git a/plugins/modules/dokku_git_sync.py b/plugins/modules/dokku_git_sync.py index 162bd5c..ba4c703 100644 --- a/plugins/modules/dokku_git_sync.py +++ b/plugins/modules/dokku_git_sync.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output import pipes import re import subprocess diff --git a/plugins/modules/dokku_global_cert.py b/plugins/modules/dokku_global_cert.py index 018f42f..6f67793 100644 --- a/plugins/modules/dokku_global_cert.py +++ b/plugins/modules/dokku_global_cert.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output import re import subprocess diff --git a/plugins/modules/dokku_http_auth.py b/plugins/modules/dokku_http_auth.py index 8270384..36e386b 100644 --- a/plugins/modules/dokku_http_auth.py +++ b/plugins/modules/dokku_http_auth.py @@ -3,7 +3,7 @@ import subprocess from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output DOCUMENTATION = """ --- diff --git a/plugins/modules/dokku_image.py b/plugins/modules/dokku_image.py index b38be37..0d48619 100644 --- a/plugins/modules/dokku_image.py +++ b/plugins/modules/dokku_image.py @@ -3,8 +3,8 @@ import subprocess from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_app import dokku_app_ensure_present -from ansible.module_utils.dokku_git import dokku_git_sha +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_app import dokku_app_ensure_present +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_git import dokku_git_sha DOCUMENTATION = """ --- diff --git a/plugins/modules/dokku_letsencrypt.py b/plugins/modules/dokku_letsencrypt.py index 87a9ad5..5b409fe 100644 --- a/plugins/modules/dokku_letsencrypt.py +++ b/plugins/modules/dokku_letsencrypt.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output import subprocess DOCUMENTATION = """ diff --git a/plugins/modules/dokku_ports.py b/plugins/modules/dokku_ports.py index 630f45c..9379f1e 100644 --- a/plugins/modules/dokku_ports.py +++ b/plugins/modules/dokku_ports.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output import pipes import re import subprocess diff --git a/plugins/modules/dokku_proxy.py b/plugins/modules/dokku_proxy.py index f558da0..31a524b 100644 --- a/plugins/modules/dokku_proxy.py +++ b/plugins/modules/dokku_proxy.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output import subprocess DOCUMENTATION = """ diff --git a/plugins/modules/dokku_ps_scale.py b/plugins/modules/dokku_ps_scale.py index 11c491f..a9c6600 100644 --- a/plugins/modules/dokku_ps_scale.py +++ b/plugins/modules/dokku_ps_scale.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output import subprocess import re diff --git a/plugins/modules/dokku_registry.py b/plugins/modules/dokku_registry.py index 8f1b149..8ed0b88 100644 --- a/plugins/modules/dokku_registry.py +++ b/plugins/modules/dokku_registry.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output import pipes import re import subprocess diff --git a/plugins/modules/dokku_resource_limit.py b/plugins/modules/dokku_resource_limit.py index e240677..7749bf6 100644 --- a/plugins/modules/dokku_resource_limit.py +++ b/plugins/modules/dokku_resource_limit.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output import subprocess import re diff --git a/plugins/modules/dokku_resource_reserve.py b/plugins/modules/dokku_resource_reserve.py index e219d95..de3bbd5 100644 --- a/plugins/modules/dokku_resource_reserve.py +++ b/plugins/modules/dokku_resource_reserve.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output import subprocess import re diff --git a/plugins/modules/dokku_storage.py b/plugins/modules/dokku_storage.py index 487697d..5553ead 100644 --- a/plugins/modules/dokku_storage.py +++ b/plugins/modules/dokku_storage.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output import os import pwd import subprocess From 354ad180a17463aed1786927206b5715fc28ab14 Mon Sep 17 00:00:00 2001 From: Tobias Hoge Date: Tue, 29 Nov 2022 14:30:22 +0100 Subject: [PATCH 07/15] fix module_utils imports --- plugins/modules/dokku_service_link.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/modules/dokku_service_link.py b/plugins/modules/dokku_service_link.py index c33ca3a..ba61452 100644 --- a/plugins/modules/dokku_service_link.py +++ b/plugins/modules/dokku_service_link.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible.module_utils.dokku_app import dokku_apps_exists +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_app import dokku_apps_exists import subprocess DOCUMENTATION = """ From bcd1c8e77d62de9b1f9798b9f327a126f726f747 Mon Sep 17 00:00:00 2001 From: Tobias Hoge Date: Tue, 29 Nov 2022 14:57:27 +0100 Subject: [PATCH 08/15] remove wrongly commited files --- .ssh/id_rsa.pub | 0 1 file changed, 0 insertions(+), 0 deletions(-) delete mode 100755 .ssh/id_rsa.pub diff --git a/.ssh/id_rsa.pub b/.ssh/id_rsa.pub deleted file mode 100755 index e69de29..0000000 From f9f5300c0e4cc454b28453570716e37981c44f3e Mon Sep 17 00:00:00 2001 From: Tobias Hoge Date: Wed, 30 Nov 2022 14:20:49 +0100 Subject: [PATCH 09/15] fix readme generator --- .pre-commit-config.yaml | 2 +- README.md | 6 ++-- bin/generate | 34 +++++++++++-------- .../defaults => defaults}/main.yml.base | 0 galaxy.yml | 4 +-- {roles/install_dokku/meta => meta}/main.yml | 0 .../default/converge.yml | 7 +++- .../default/molecule.yml | 2 +- .../molecule => molecule}/default/verify.yml | 4 +-- 9 files changed, 34 insertions(+), 25 deletions(-) rename {roles/install_dokku/defaults => defaults}/main.yml.base (100%) rename {roles/install_dokku/meta => meta}/main.yml (100%) rename {roles/install_dokku/molecule => molecule}/default/converge.yml (92%) rename {roles/install_dokku/molecule => molecule}/default/molecule.yml (84%) rename {roles/install_dokku/molecule => molecule}/default/verify.yml (99%) diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 6a82398..57ff48a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -18,7 +18,7 @@ repos: hooks: - id: black -- repo: https://gitlab.com/pycqa/flake8 +- repo: https://github.com/PyCQA/flake8 rev: 5.0.4 hooks: - id: flake8 diff --git a/README.md b/README.md index 25b462a..73dbe45 100644 --- a/README.md +++ b/README.md @@ -12,7 +12,7 @@ used to interface with dokku from your own Ansible playbooks. - [Requirements](#requirements) - [Dependencies](#dependencies) - [Role Variables](#role-variables) -- [Libraries](#libraries) +- [Plugins](#Plugins) - [Example Playbooks](#example-playbooks) - [Contributing](#contributing) - [License](#license) @@ -39,7 +39,7 @@ Supported Platforms - geerlingguy.docker ansible role - nginxinc.nginx ansible role -- Dokku (for library usage) +- Dokku (for plugin usage) ## Role Variables @@ -154,7 +154,7 @@ Scheduled for deletion after 07/2021. Use `dokku_packages_state` instead. - description: The version of sshcommand to install. Scheduled for deletion after 07/2021. Use `dokku_packages_state` instead. -## Libraries +## Plugins ### dokku_acl_app diff --git a/bin/generate b/bin/generate index 6821a47..038bca5 100755 --- a/bin/generate +++ b/bin/generate @@ -15,17 +15,17 @@ def section_header(text, level=1): return "{0} {1}".format("#" * level, text) -def get_libraries(role_path): - libraries_path = os.path.join(role_path, "library") +def get_plugins(role_path): + plugins_path = os.path.join(role_path, "plugins", "modules") files = [] - for (dirpath, dirnames, filenames) in os.walk(libraries_path): + for (dirpath, dirnames, filenames) in os.walk(plugins_path): files.extend(filenames) break data = {} for f in files: data[f] = {} - M = ast.parse("".join(open(os.path.join(libraries_path, f)))) + M = ast.parse("".join(open(os.path.join(plugins_path, f)))) for child in M.body: if isinstance(child, ast.Assign): for t in child.targets: @@ -53,7 +53,7 @@ def add_table_of_contents(text): "- [Requirements](#requirements)", "- [Dependencies](#dependencies)", "- [Role Variables](#role-variables)", - "- [Libraries](#libraries)", + "- [Plugins](#Plugins)", "- [Example Playbooks](#example-playbooks)", "- [Contributing](#contributing)", "- [License](#license)", @@ -63,18 +63,18 @@ def add_table_of_contents(text): return text -def add_libraries(text, role_path): - libraries = get_libraries(role_path) +def add_plugins(text, role_path): + plugins = get_plugins(role_path) def chosen(choice, default): if choice == default: return "**{0}** (default)".format(choice) return "{0}".format(choice) - library_keys = sorted(libraries.keys()) - text.append(section_header("Libraries", 2)) - for library in library_keys: - data = libraries[library] + plugin_keys = sorted(plugins.keys()) + text.append(section_header("Plugins", 2)) + for plugin in plugin_keys: + data = plugins[plugin] options = [ "|Parameter|Choices/Defaults|Comments|", "|---------|----------------|--------|", @@ -152,7 +152,7 @@ def add_requirements(text, meta, defaults): "- {0} ansible role".format(dependency["role"]) for dependency in meta["dependencies"] ] - dependencies.append("- Dokku (for library usage)") + dependencies.append("- Dokku (for plugin usage)") text.append("\n".join(dependencies)) return text @@ -214,7 +214,9 @@ def generate_readme(): meta = yaml.load(f.read(), Loader=yaml.SafeLoader) defaults = {} - defaults_file = os.path.join(role_path, "defaults", "main.yml") + defaults_file = os.path.join( + role_path, "roles", "install_dokku", "defaults", "main.yml" + ) with open(defaults_file) as f: defaults = yaml.load(f.read(), Loader=yaml.SafeLoader) @@ -231,7 +233,7 @@ def generate_readme(): text = add_table_of_contents(text) text = add_requirements(text, meta, defaults) text = add_variables(text, role_path) - text = add_libraries(text, role_path) + text = add_plugins(text, role_path) text = add_examples(text, role_path) text.append(section_header("Contributing", 2)) @@ -262,7 +264,9 @@ def generate_defaults(): continue defaults[variable] = config["default"] - defaults_file = os.path.join(role_path, "defaults", "main.yml") + defaults_file = os.path.join( + role_path, "roles", "install_dokku", "defaults", "main.yml" + ) with open(defaults_file, "w") as f: f.write(yaml.dump(defaults, explicit_start=False)) diff --git a/roles/install_dokku/defaults/main.yml.base b/defaults/main.yml.base similarity index 100% rename from roles/install_dokku/defaults/main.yml.base rename to defaults/main.yml.base diff --git a/galaxy.yml b/galaxy.yml index 654c9e9..55940a8 100644 --- a/galaxy.yml +++ b/galaxy.yml @@ -5,7 +5,7 @@ namespace: dokku_bot # The name of the collection. Has the same character restrictions as 'namespace' -name: ansible_dokku +name: dokku_collection # The version of the collection. Must be compatible with semantic versioning version: 1.0.0 @@ -16,7 +16,7 @@ readme: README.md # A list of the collection's content authors. Can be just the name or in the format 'Full Name (url) # @nicks:irc/im.site#channel' authors: -- your name +- Jose Diaz-Gonzalez ### OPTIONAL but strongly recommended diff --git a/roles/install_dokku/meta/main.yml b/meta/main.yml similarity index 100% rename from roles/install_dokku/meta/main.yml rename to meta/main.yml diff --git a/roles/install_dokku/molecule/default/converge.yml b/molecule/default/converge.yml similarity index 92% rename from roles/install_dokku/molecule/default/converge.yml rename to molecule/default/converge.yml index 8a33f3f..78fa830 100644 --- a/roles/install_dokku/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -7,8 +7,13 @@ apt: update_cache=yes cache_valid_time=600 when: ansible_os_family == 'Debian' + - name: Install gpg-agent + apt: + name: + - gpg-agent + roles: - - role: dokku_bot.ansible_dokku # noqa + - role: install_dokku # noqa vars: dokku_plugins: - name: global-cert diff --git a/roles/install_dokku/molecule/default/molecule.yml b/molecule/default/molecule.yml similarity index 84% rename from roles/install_dokku/molecule/default/molecule.yml rename to molecule/default/molecule.yml index a13b76f..ea950fa 100644 --- a/roles/install_dokku/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -6,7 +6,7 @@ driver: name: docker platforms: - name: instance - image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu1804}-ansible:latest" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2004}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro diff --git a/roles/install_dokku/molecule/default/verify.yml b/molecule/default/verify.yml similarity index 99% rename from roles/install_dokku/molecule/default/verify.yml rename to molecule/default/verify.yml index 9397e7a..ce6bb34 100644 --- a/roles/install_dokku/molecule/default/verify.yml +++ b/molecule/default/verify.yml @@ -5,7 +5,7 @@ tasks: - name: Run role without running any tasks include_role: - name: dokku_bot.ansible_dokku + name: install_dokku tasks_from: init.yml # Testing dokku_global_cert @@ -125,7 +125,7 @@ Re-cloning example app resulted in changed status # Testing dokku_network - - name: Create a network # noqa 301 + - name: Create a network # noqa 301 dokku_network: name: example-network register: example_network From 63560dd1ffed32b466364ac06f20eac03b9a9795 Mon Sep 17 00:00:00 2001 From: Tobias Hoge Date: Wed, 30 Nov 2022 14:24:31 +0100 Subject: [PATCH 10/15] update ubuntu version in molecule test --- molecule/default/molecule.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index ea950fa..b035070 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -6,7 +6,7 @@ driver: name: docker platforms: - name: instance - image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2004}-ansible:latest" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:ro From 157babf4e5ac73fc03533b3e732e30484e4b4f1c Mon Sep 17 00:00:00 2001 From: Tobias Hoge Date: Wed, 30 Nov 2022 14:27:07 +0100 Subject: [PATCH 11/15] fix pre-commit hooks --- plugins/modules/dokku_acl_app.py | 4 +++- plugins/modules/dokku_acl_service.py | 4 +++- plugins/modules/dokku_certs.py | 4 +++- plugins/modules/dokku_checks.py | 4 +++- plugins/modules/dokku_clone.py | 8 ++++++-- plugins/modules/dokku_config.py | 4 +++- plugins/modules/dokku_docker_options.py | 4 +++- plugins/modules/dokku_domains.py | 4 +++- plugins/modules/dokku_git_sync.py | 4 +++- plugins/modules/dokku_global_cert.py | 4 +++- plugins/modules/dokku_http_auth.py | 4 +++- plugins/modules/dokku_image.py | 8 ++++++-- plugins/modules/dokku_letsencrypt.py | 4 +++- plugins/modules/dokku_ports.py | 4 +++- plugins/modules/dokku_proxy.py | 4 +++- plugins/modules/dokku_ps_scale.py | 4 +++- plugins/modules/dokku_registry.py | 4 +++- plugins/modules/dokku_resource_limit.py | 4 +++- plugins/modules/dokku_resource_reserve.py | 4 +++- plugins/modules/dokku_service_link.py | 4 +++- plugins/modules/dokku_storage.py | 4 +++- 21 files changed, 69 insertions(+), 23 deletions(-) diff --git a/plugins/modules/dokku_acl_app.py b/plugins/modules/dokku_acl_app.py index ab57659..21e807d 100644 --- a/plugins/modules/dokku_acl_app.py +++ b/plugins/modules/dokku_acl_app.py @@ -1,7 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) DOCUMENTATION = """ --- diff --git a/plugins/modules/dokku_acl_service.py b/plugins/modules/dokku_acl_service.py index 250bfbf..ff71629 100644 --- a/plugins/modules/dokku_acl_service.py +++ b/plugins/modules/dokku_acl_service.py @@ -1,7 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) DOCUMENTATION = """ --- diff --git a/plugins/modules/dokku_certs.py b/plugins/modules/dokku_certs.py index 08c76ed..2710037 100644 --- a/plugins/modules/dokku_certs.py +++ b/plugins/modules/dokku_certs.py @@ -1,7 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) import subprocess import re diff --git a/plugins/modules/dokku_checks.py b/plugins/modules/dokku_checks.py index 5648117..316f938 100644 --- a/plugins/modules/dokku_checks.py +++ b/plugins/modules/dokku_checks.py @@ -3,7 +3,9 @@ import subprocess from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) DOCUMENTATION = """ --- diff --git a/plugins/modules/dokku_clone.py b/plugins/modules/dokku_clone.py index 76bf655..d8edfa6 100644 --- a/plugins/modules/dokku_clone.py +++ b/plugins/modules/dokku_clone.py @@ -3,8 +3,12 @@ import subprocess from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_app import dokku_app_ensure_present -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_git import dokku_git_sha +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_app import ( + dokku_app_ensure_present, +) +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_git import ( + dokku_git_sha, +) DOCUMENTATION = """ --- diff --git a/plugins/modules/dokku_config.py b/plugins/modules/dokku_config.py index cc44536..956e310 100644 --- a/plugins/modules/dokku_config.py +++ b/plugins/modules/dokku_config.py @@ -1,7 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) import json import pipes import subprocess diff --git a/plugins/modules/dokku_docker_options.py b/plugins/modules/dokku_docker_options.py index 5dc777d..1a3f427 100644 --- a/plugins/modules/dokku_docker_options.py +++ b/plugins/modules/dokku_docker_options.py @@ -1,7 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) import pipes import subprocess import re diff --git a/plugins/modules/dokku_domains.py b/plugins/modules/dokku_domains.py index dac7c1f..2814ff6 100644 --- a/plugins/modules/dokku_domains.py +++ b/plugins/modules/dokku_domains.py @@ -1,7 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) import pipes import subprocess diff --git a/plugins/modules/dokku_git_sync.py b/plugins/modules/dokku_git_sync.py index ba4c703..52d2c98 100644 --- a/plugins/modules/dokku_git_sync.py +++ b/plugins/modules/dokku_git_sync.py @@ -1,7 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) import pipes import re import subprocess diff --git a/plugins/modules/dokku_global_cert.py b/plugins/modules/dokku_global_cert.py index 6f67793..9f87985 100644 --- a/plugins/modules/dokku_global_cert.py +++ b/plugins/modules/dokku_global_cert.py @@ -1,7 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) import re import subprocess diff --git a/plugins/modules/dokku_http_auth.py b/plugins/modules/dokku_http_auth.py index 36e386b..97fa74e 100644 --- a/plugins/modules/dokku_http_auth.py +++ b/plugins/modules/dokku_http_auth.py @@ -3,7 +3,9 @@ import subprocess from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) DOCUMENTATION = """ --- diff --git a/plugins/modules/dokku_image.py b/plugins/modules/dokku_image.py index 0d48619..bd11e05 100644 --- a/plugins/modules/dokku_image.py +++ b/plugins/modules/dokku_image.py @@ -3,8 +3,12 @@ import subprocess from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_app import dokku_app_ensure_present -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_git import dokku_git_sha +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_app import ( + dokku_app_ensure_present, +) +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_git import ( + dokku_git_sha, +) DOCUMENTATION = """ --- diff --git a/plugins/modules/dokku_letsencrypt.py b/plugins/modules/dokku_letsencrypt.py index 5b409fe..f43ee94 100644 --- a/plugins/modules/dokku_letsencrypt.py +++ b/plugins/modules/dokku_letsencrypt.py @@ -1,7 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) import subprocess DOCUMENTATION = """ diff --git a/plugins/modules/dokku_ports.py b/plugins/modules/dokku_ports.py index 9379f1e..9a6b876 100644 --- a/plugins/modules/dokku_ports.py +++ b/plugins/modules/dokku_ports.py @@ -1,7 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) import pipes import re import subprocess diff --git a/plugins/modules/dokku_proxy.py b/plugins/modules/dokku_proxy.py index 31a524b..3b9e75d 100644 --- a/plugins/modules/dokku_proxy.py +++ b/plugins/modules/dokku_proxy.py @@ -1,7 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) import subprocess DOCUMENTATION = """ diff --git a/plugins/modules/dokku_ps_scale.py b/plugins/modules/dokku_ps_scale.py index a9c6600..3f7a78f 100644 --- a/plugins/modules/dokku_ps_scale.py +++ b/plugins/modules/dokku_ps_scale.py @@ -1,7 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) import subprocess import re diff --git a/plugins/modules/dokku_registry.py b/plugins/modules/dokku_registry.py index 8ed0b88..bde24c5 100644 --- a/plugins/modules/dokku_registry.py +++ b/plugins/modules/dokku_registry.py @@ -1,7 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) import pipes import re import subprocess diff --git a/plugins/modules/dokku_resource_limit.py b/plugins/modules/dokku_resource_limit.py index 7749bf6..50ed296 100644 --- a/plugins/modules/dokku_resource_limit.py +++ b/plugins/modules/dokku_resource_limit.py @@ -1,7 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) import subprocess import re diff --git a/plugins/modules/dokku_resource_reserve.py b/plugins/modules/dokku_resource_reserve.py index de3bbd5..c4e877f 100644 --- a/plugins/modules/dokku_resource_reserve.py +++ b/plugins/modules/dokku_resource_reserve.py @@ -1,7 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) import subprocess import re diff --git a/plugins/modules/dokku_service_link.py b/plugins/modules/dokku_service_link.py index ba61452..ac89ea4 100644 --- a/plugins/modules/dokku_service_link.py +++ b/plugins/modules/dokku_service_link.py @@ -1,7 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_app import dokku_apps_exists +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_app import ( + dokku_apps_exists, +) import subprocess DOCUMENTATION = """ diff --git a/plugins/modules/dokku_storage.py b/plugins/modules/dokku_storage.py index 5553ead..b26a977 100644 --- a/plugins/modules/dokku_storage.py +++ b/plugins/modules/dokku_storage.py @@ -1,7 +1,9 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import subprocess_check_output +from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( + subprocess_check_output, +) import os import pwd import subprocess From 7bc4078332406c655db76129d840e7f73e0023c3 Mon Sep 17 00:00:00 2001 From: Tobias Hoge Date: Fri, 23 Dec 2022 17:41:56 +0100 Subject: [PATCH 12/15] fix molecule role --- molecule/default/converge.yml | 2 +- molecule/default/molecule.yml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/molecule/default/converge.yml b/molecule/default/converge.yml index dafde13..39af19b 100644 --- a/molecule/default/converge.yml +++ b/molecule/default/converge.yml @@ -13,7 +13,7 @@ - gpg-agent roles: - - role: install_dokku # noqa + - role: dokku_bot.dokku_collection.install_dokku # noqa vars: dokku_plugins: - name: global-cert diff --git a/molecule/default/molecule.yml b/molecule/default/molecule.yml index 0721626..2524407 100644 --- a/molecule/default/molecule.yml +++ b/molecule/default/molecule.yml @@ -6,7 +6,7 @@ driver: name: docker platforms: - name: instance - image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu2204}-ansible:latest" + image: "geerlingguy/docker-${MOLECULE_DISTRO:-ubuntu1804}-ansible:latest" command: ${MOLECULE_DOCKER_COMMAND:-""} volumes: - /sys/fs/cgroup:/sys/fs/cgroup:rw From ce26d9cb7f688032637c5edfc558f2934b83c039 Mon Sep 17 00:00:00 2001 From: Tobias Hoge Date: Fri, 23 Dec 2022 17:50:34 +0100 Subject: [PATCH 13/15] fix galaxy name --- .github/workflows/ci.yml | 2 +- README.md | 8 ++++---- example.yml | 8 ++++---- molecule/default/verify.yml | 2 +- plugins/modules/dokku_acl_app.py | 2 +- plugins/modules/dokku_acl_service.py | 2 +- plugins/modules/dokku_app.py | 2 +- plugins/modules/dokku_certs.py | 2 +- plugins/modules/dokku_checks.py | 2 +- plugins/modules/dokku_clone.py | 4 ++-- plugins/modules/dokku_config.py | 2 +- plugins/modules/dokku_docker_options.py | 2 +- plugins/modules/dokku_domains.py | 2 +- plugins/modules/dokku_git_sync.py | 2 +- plugins/modules/dokku_global_cert.py | 2 +- plugins/modules/dokku_http_auth.py | 2 +- plugins/modules/dokku_image.py | 4 ++-- plugins/modules/dokku_letsencrypt.py | 2 +- plugins/modules/dokku_ports.py | 2 +- plugins/modules/dokku_proxy.py | 2 +- plugins/modules/dokku_ps_scale.py | 2 +- plugins/modules/dokku_registry.py | 2 +- plugins/modules/dokku_resource_limit.py | 2 +- plugins/modules/dokku_resource_reserve.py | 2 +- plugins/modules/dokku_service_link.py | 2 +- plugins/modules/dokku_storage.py | 2 +- 26 files changed, 34 insertions(+), 34 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 419a34c..6ac0650 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -5,7 +5,7 @@ on: pull_request: env: - galaxy-name: "dokku_bot.ansible_dokku" + galaxy-name: "dokku_bot.dokku_collection" jobs: diff --git a/README.md b/README.md index 73dbe45..981afd7 100644 --- a/README.md +++ b/README.md @@ -1044,7 +1044,7 @@ Manage storage for dokku applications --- - hosts: all roles: - - dokku_bot.ansible_dokku + - dokku_bot.dokku_collection ``` ### Installing Plugins @@ -1053,7 +1053,7 @@ Manage storage for dokku applications --- - hosts: all roles: - - dokku_bot.ansible_dokku + - dokku_bot.dokku_collection vars: dokku_plugins: - name: clone @@ -1068,7 +1068,7 @@ Manage storage for dokku applications --- - hosts: all roles: - - dokku_bot.ansible_dokku + - dokku_bot.dokku_collection tasks: - name: dokku apps:create inflector dokku_app: @@ -1086,7 +1086,7 @@ Manage storage for dokku applications --- - hosts: all roles: - - dokku_bot.ansible_dokku + - dokku_bot.dokku_collection - geerlingguy.swap vars: # If you are running dokku on a small VPS, you'll most likely diff --git a/example.yml b/example.yml index 0c0124c..d14bed3 100644 --- a/example.yml +++ b/example.yml @@ -4,14 +4,14 @@ examples: --- - hosts: all roles: - - dokku_bot.ansible_dokku + - dokku_bot.dokku_collection - name: Installing Plugins example: | --- - hosts: all roles: - - dokku_bot.ansible_dokku + - dokku_bot.dokku_collection vars: dokku_plugins: - name: clone @@ -24,7 +24,7 @@ examples: --- - hosts: all roles: - - dokku_bot.ansible_dokku + - dokku_bot.dokku_collection tasks: - name: dokku apps:create inflector dokku_app: @@ -39,7 +39,7 @@ examples: --- - hosts: all roles: - - dokku_bot.ansible_dokku + - dokku_bot.dokku_collection - geerlingguy.swap vars: # If you are running dokku on a small VPS, you'll most likely diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml index ce6bb34..53a97cd 100644 --- a/molecule/default/verify.yml +++ b/molecule/default/verify.yml @@ -5,7 +5,7 @@ tasks: - name: Run role without running any tasks include_role: - name: install_dokku + name: dokku_bot.dokku_collection.install_dokku tasks_from: init.yml # Testing dokku_global_cert diff --git a/plugins/modules/dokku_acl_app.py b/plugins/modules/dokku_acl_app.py index 48dd934..3679678 100644 --- a/plugins/modules/dokku_acl_app.py +++ b/plugins/modules/dokku_acl_app.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) diff --git a/plugins/modules/dokku_acl_service.py b/plugins/modules/dokku_acl_service.py index d9c9273..0e15132 100644 --- a/plugins/modules/dokku_acl_service.py +++ b/plugins/modules/dokku_acl_service.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) diff --git a/plugins/modules/dokku_app.py b/plugins/modules/dokku_app.py index 308d0e8..dd6ddce 100644 --- a/plugins/modules/dokku_app.py +++ b/plugins/modules/dokku_app.py @@ -2,7 +2,7 @@ # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_app import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_app import ( dokku_app_ensure_present, dokku_app_ensure_absent, ) diff --git a/plugins/modules/dokku_certs.py b/plugins/modules/dokku_certs.py index 2710037..cd3c11f 100644 --- a/plugins/modules/dokku_certs.py +++ b/plugins/modules/dokku_certs.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) import subprocess diff --git a/plugins/modules/dokku_checks.py b/plugins/modules/dokku_checks.py index 316f938..2380b37 100644 --- a/plugins/modules/dokku_checks.py +++ b/plugins/modules/dokku_checks.py @@ -3,7 +3,7 @@ import subprocess from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) diff --git a/plugins/modules/dokku_clone.py b/plugins/modules/dokku_clone.py index d8edfa6..b64fc5c 100644 --- a/plugins/modules/dokku_clone.py +++ b/plugins/modules/dokku_clone.py @@ -3,10 +3,10 @@ import subprocess from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_app import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_app import ( dokku_app_ensure_present, ) -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_git import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_git import ( dokku_git_sha, ) diff --git a/plugins/modules/dokku_config.py b/plugins/modules/dokku_config.py index 956e310..f4ad4b9 100644 --- a/plugins/modules/dokku_config.py +++ b/plugins/modules/dokku_config.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) import json diff --git a/plugins/modules/dokku_docker_options.py b/plugins/modules/dokku_docker_options.py index 1a3f427..7c78dc2 100644 --- a/plugins/modules/dokku_docker_options.py +++ b/plugins/modules/dokku_docker_options.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) import pipes diff --git a/plugins/modules/dokku_domains.py b/plugins/modules/dokku_domains.py index 2814ff6..3e6d6c4 100644 --- a/plugins/modules/dokku_domains.py +++ b/plugins/modules/dokku_domains.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) import pipes diff --git a/plugins/modules/dokku_git_sync.py b/plugins/modules/dokku_git_sync.py index 52d2c98..cd98994 100644 --- a/plugins/modules/dokku_git_sync.py +++ b/plugins/modules/dokku_git_sync.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) import pipes diff --git a/plugins/modules/dokku_global_cert.py b/plugins/modules/dokku_global_cert.py index 9f87985..23a7dc7 100644 --- a/plugins/modules/dokku_global_cert.py +++ b/plugins/modules/dokku_global_cert.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) import re diff --git a/plugins/modules/dokku_http_auth.py b/plugins/modules/dokku_http_auth.py index 97fa74e..50c2b50 100644 --- a/plugins/modules/dokku_http_auth.py +++ b/plugins/modules/dokku_http_auth.py @@ -3,7 +3,7 @@ import subprocess from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) diff --git a/plugins/modules/dokku_image.py b/plugins/modules/dokku_image.py index bd11e05..aa6b5b0 100644 --- a/plugins/modules/dokku_image.py +++ b/plugins/modules/dokku_image.py @@ -3,10 +3,10 @@ import subprocess from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_app import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_app import ( dokku_app_ensure_present, ) -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_git import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_git import ( dokku_git_sha, ) diff --git a/plugins/modules/dokku_letsencrypt.py b/plugins/modules/dokku_letsencrypt.py index f43ee94..f3e5ecd 100644 --- a/plugins/modules/dokku_letsencrypt.py +++ b/plugins/modules/dokku_letsencrypt.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) import subprocess diff --git a/plugins/modules/dokku_ports.py b/plugins/modules/dokku_ports.py index 9a6b876..f431bad 100644 --- a/plugins/modules/dokku_ports.py +++ b/plugins/modules/dokku_ports.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) import pipes diff --git a/plugins/modules/dokku_proxy.py b/plugins/modules/dokku_proxy.py index 3b9e75d..fad4e79 100644 --- a/plugins/modules/dokku_proxy.py +++ b/plugins/modules/dokku_proxy.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) import subprocess diff --git a/plugins/modules/dokku_ps_scale.py b/plugins/modules/dokku_ps_scale.py index 3f7a78f..31387f2 100644 --- a/plugins/modules/dokku_ps_scale.py +++ b/plugins/modules/dokku_ps_scale.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) import subprocess diff --git a/plugins/modules/dokku_registry.py b/plugins/modules/dokku_registry.py index bde24c5..bf5cae4 100644 --- a/plugins/modules/dokku_registry.py +++ b/plugins/modules/dokku_registry.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) import pipes diff --git a/plugins/modules/dokku_resource_limit.py b/plugins/modules/dokku_resource_limit.py index 50ed296..798c245 100644 --- a/plugins/modules/dokku_resource_limit.py +++ b/plugins/modules/dokku_resource_limit.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) import subprocess diff --git a/plugins/modules/dokku_resource_reserve.py b/plugins/modules/dokku_resource_reserve.py index c4e877f..1e93427 100644 --- a/plugins/modules/dokku_resource_reserve.py +++ b/plugins/modules/dokku_resource_reserve.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) import subprocess diff --git a/plugins/modules/dokku_service_link.py b/plugins/modules/dokku_service_link.py index ac89ea4..1b09fbb 100644 --- a/plugins/modules/dokku_service_link.py +++ b/plugins/modules/dokku_service_link.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_app import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_app import ( dokku_apps_exists, ) import subprocess diff --git a/plugins/modules/dokku_storage.py b/plugins/modules/dokku_storage.py index b26a977..f60dbd9 100644 --- a/plugins/modules/dokku_storage.py +++ b/plugins/modules/dokku_storage.py @@ -1,7 +1,7 @@ #!/usr/bin/python # -*- coding: utf-8 -*- from ansible.module_utils.basic import AnsibleModule -from ansible_collections.dokku_bot.ansible_dokku.plugins.module_utils.dokku_utils import ( +from ansible_collections.dokku_bot.dokku_collection.plugins.module_utils.dokku_utils import ( subprocess_check_output, ) import os From a2ef9b0b13a624e9f0e9e30057707d80f9ff6d23 Mon Sep 17 00:00:00 2001 From: Tobias Hoge Date: Tue, 3 Jan 2023 12:57:55 +0100 Subject: [PATCH 14/15] revert prior commits --- molecule/default/verify.yml | 46 ++++++++++++++++++------------------- 1 file changed, 23 insertions(+), 23 deletions(-) diff --git a/molecule/default/verify.yml b/molecule/default/verify.yml index 53a97cd..101dc18 100644 --- a/molecule/default/verify.yml +++ b/molecule/default/verify.yml @@ -10,7 +10,7 @@ # Testing dokku_global_cert - name: Check that dokku_global_cert module can parse output - dokku_global_cert: + dokku_bot.dokku_collection.dokku_global_cert: state: absent # Testing dokku_hostname @@ -42,12 +42,12 @@ # Testing dokku_app - name: create example-app - dokku_app: + dokku_bot.dokku_collection.dokku_app: app: example-app # Testing dokku_acl_app - name: Let gverdi manage example-app - dokku_acl_app: + dokku_bot.dokku_collection.dokku_acl_app: app: example-app users: - gverdi @@ -68,7 +68,7 @@ {{ dokku_acl_list.stdout }} - name: Remove permission for gverdi to manage example-app - dokku_acl_app: + dokku_bot.dokku_collection.dokku_acl_app: app: example-app users: - gverdi @@ -92,7 +92,7 @@ # Testing dokku_clone - name: clone example-app - dokku_clone: + dokku_bot.dokku_collection.dokku_clone: app: example-app repository: https://github.com/heroku/node-js-getting-started version: b10a4d7a20a6bbe49655769c526a2b424e0e5d0b @@ -110,7 +110,7 @@ {{ dokku_apps.stdout }} - name: clone example app again - dokku_clone: + dokku_bot.dokku_collection.dokku_clone: app: example-app repository: https://github.com/heroku/node-js-getting-started version: b10a4d7a20a6bbe49655769c526a2b424e0e5d0b @@ -126,7 +126,7 @@ # Testing dokku_network - name: Create a network # noqa 301 - dokku_network: + dokku_bot.dokku_collection.dokku_network: name: example-network register: example_network @@ -143,7 +143,7 @@ {{ dokku_networks.stdout }} - name: Create a network that already exists # noqa 301 - dokku_network: + dokku_bot.dokku_collection.dokku_network: name: example-network register: example_network @@ -156,7 +156,7 @@ # Testing dokku_network_property - name: Setting a network property for an app - dokku_network_property: + dokku_bot.dokku_collection.dokku_network_property: app: example-app property: attach-post-create value: example-network @@ -174,7 +174,7 @@ {{ example_app_network_report.stdout }} - name: Clearing a network property for an app - dokku_network_property: + dokku_bot.dokku_collection.dokku_network_property: app: example-app property: attach-post-create @@ -192,7 +192,7 @@ # Testing dokku_ports - name: Set port mapping for an app - dokku_ports: + dokku_bot.dokku_collection.dokku_ports: app: example-app mappings: - http:80:5000 @@ -212,7 +212,7 @@ {{ dokku_proxy_ports.stdout }} - name: Set port mapping that already exists - dokku_ports: + dokku_bot.dokku_collection.dokku_ports: app: example-app mappings: - http:80:5000 @@ -226,7 +226,7 @@ Setting existing port mapping resulted in changed status - name: Remove port mapping - dokku_ports: + dokku_bot.dokku_collection.dokku_ports: app: example-app mappings: - http:8080:5000 @@ -246,7 +246,7 @@ # Testing dokku_ps_scale - name: Scaling application processes - dokku_ps_scale: + dokku_bot.dokku_collection.dokku_ps_scale: app: example-app scale: web: 2 @@ -270,7 +270,7 @@ state: directory - name: Deploy meilisearch using dokku_image - dokku_image: + dokku_bot.dokku_collection.dokku_image: app: ms user_name: Elliot Alderson user_email: elliotalderson@protonmail.ch @@ -291,7 +291,7 @@ # Testing dokku_builder - name: Configuring the builder for an app - dokku_builder: + dokku_bot.dokku_collection.dokku_builder: app: example-app property: build-dir value: /app @@ -310,7 +310,7 @@ # Testing dokku_http_auth - name: Enabling http-auth for an app - dokku_http_auth: + dokku_bot.dokku_collection.dokku_http_auth: app: example-app state: present username: samsepi0l @@ -329,7 +329,7 @@ {{ dokku_http_auth_on.stdout }} - name: Disabling http-auth for an app - dokku_http_auth: + dokku_bot.dokku_collection.dokku_http_auth: app: example-app state: absent @@ -347,7 +347,7 @@ # Testing dokku_checks - name: Disabling the Zero Downtime deployment - dokku_checks: + dokku_bot.dokku_collection.dokku_checks: app: example-app state: absent @@ -364,7 +364,7 @@ {{ dokku_checks.stdout }} - name: Re-enabling the Zero Downtime deployment - dokku_checks: + dokku_bot.dokku_collection.dokku_checks: app: example-app state: present @@ -382,7 +382,7 @@ # Testing dokku_docker_options - name: Set docker build options - dokku_docker_options: + dokku_bot.dokku_collection.dokku_docker_options: app: example-app phase: build option: "--pull" @@ -400,7 +400,7 @@ {{ dokku_docker_options.stdout }} - name: Set docker build options that already exist # noqa 301 - dokku_docker_options: + dokku_bot.dokku_collection.dokku_docker_options: app: example-app phase: build option: "--pull" @@ -414,7 +414,7 @@ Setting existing docker options resulted in changed status - name: Remove docker build options - dokku_docker_options: + dokku_bot.dokku_collection.dokku_docker_options: app: example-app phase: build option: "--pull" From 59eb3c274307deff5cdc940cd59964cd66b9c576 Mon Sep 17 00:00:00 2001 From: Tobias Hoge Date: Tue, 3 Jan 2023 13:24:29 +0100 Subject: [PATCH 15/15] add role dependencies to install_role --- roles/install_dokku/tasks/main.yml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/roles/install_dokku/tasks/main.yml b/roles/install_dokku/tasks/main.yml index 198cfae..842194e 100644 --- a/roles/install_dokku/tasks/main.yml +++ b/roles/install_dokku/tasks/main.yml @@ -1,3 +1,9 @@ +- ansible.builtin.import_role: + name: geerlingguy.docker + +- ansible.builtin.import_role: + name: nginxinc.nginx + - import_tasks: init.yml - import_tasks: nginx.yml