From 2e635dd5bcd3cdcfb50d8f0a4b30c3fdcdf4aaed Mon Sep 17 00:00:00 2001 From: Bo-Yi Wu Date: Sun, 16 Jun 2019 18:54:50 +0800 Subject: [PATCH] feat: update readme and meta --- README.md | 78 ++++++++++++++++++++++++++++++++++++----------- defaults/main.yml | 8 +++-- meta/main.yml | 76 +++++++++++++-------------------------------- 3 files changed, 86 insertions(+), 76 deletions(-) diff --git a/README.md b/README.md index 6d232bd..7746d2c 100644 --- a/README.md +++ b/README.md @@ -9,31 +9,73 @@ This role will install drone [agents][1] + [server][2] using [docker](https://ww This role requires: [docker installed](https://docs.docker.com/install/) on the server -Role Variables --------------- +### Role Variables -A description of the settable variables for this role should go here, including any variables that are in defaults/main.yml, vars/main.yml, and any variables that can/should be set via parameters to the role. Any variables that are read from other roles and/or the global scope (ie. hostvars, group vars, etc.) should be mentioned here as well. +Change the `drone_host_port` for expose port if conflict and update the `drone_version` from [github release page](https://github.com/drone/drone/releases). -Dependencies ------------- +```yml +drone_version: "latest" +drone_host_port: "8080" +``` -A list of other roles hosted on Galaxy should go here, plus any details in regards to parameters that may need to be set for other roles, or variables that are used from other roles. +Install the drone server or agent via the following config. Default is `false`. -Example Playbook ----------------- +```yml +drone_server_enable: "false" +drone_agent_enable: "false" +``` -Including an example of how to use your role (for instance, with variables passed in as parameters) is always nice for users too: +Default database is `sqlite` and drone can be installed with `mysql` or `postgres` database. See the followings. - - hosts: servers - roles: - - { role: username.rolename, x: 42 } +```yml +drone_database_driver: "postgres" +drone_postgres_data_dir: "/var/lib/postgresql/data" +drone_postgres_password: "drone" +drone_postgres_user: "drone" +drone_postgres_db: "drone +``` -License -------- +mysql database (5.7 version) -BSD +```yml +drone_database_driver: "mysql" +drone_mysql_data_dir: "/var/lib/mysql/data" +drone_mysql_password: "drone" +drone_mysql_user: "drone" +drone_mysql_db: "drone" +``` -Author Information ------------------- +### additional parameters -An optional section for the role authors to include contact information, or a website (HTML is not allowed). +The ansible role offers additional parameters - please check `defaults/main.yml` file. + +## Example Playbook + +- hosts: drone + vars_files: + - vars/main.yml + roles: + - { role: appleboy.drone } + +Inside `vars/main.yml` for `drone-server` + +```yml +drone_server_enable: "true" +drone_version: "latest" +drone_github_client_id: "e2bdde88b88f7ccf873a" +drone_github_client_secret: "b0412c975bbf2b6fcd9b3cf5f19c8165b1c14d0c" +drone_server_host: "368a7a66.ngrok.io" +drone_server_proto: "https" +drone_rpc_secret: "30075d074bfd9e74cfd0b84a5886b986" +drone_database_driver: "mysql" +drone_database_datasource: "drone:drone@tcp(mysql:3306)/drone?parseTime=true" +``` + +for drone-agent: + +```yml +drone_agent_enable: "true" +drone_version: "latest" +drone_rpc_server: "http://192.168.64.2:8081" +drone_rpc_secret: "30075d074bfd9e74cfd0b84a5886b986" +``` diff --git a/defaults/main.yml b/defaults/main.yml index 3942ad8..6e631c2 100644 --- a/defaults/main.yml +++ b/defaults/main.yml @@ -3,14 +3,16 @@ drone_agent_enable: "false" drone_version: "latest" drone_tls_autocert: "false" drone_agents_enabled: "true" -drone_github_server: "https://github.com" -drone_github_client_id: "" -drone_github_client_secret: "" drone_logs_pretty: "true" drone_logs_color: "true" drone_rpc_server: "http://drone-server" drone_runner_capacity: "3" drone_host_port: "8080" + +drone_github_server: "https://github.com" +drone_github_client_id: "" +drone_github_client_secret: "" + drone_database_driver: "sqlite" drone_sqlite_dir: "/var/lib/drone" drone_postgres_data_dir: "/var/lib/postgresql/data" diff --git a/meta/main.yml b/meta/main.yml index 5d50bf4..a86af4e 100644 --- a/meta/main.yml +++ b/meta/main.yml @@ -1,60 +1,26 @@ galaxy_info: - author: your name - description: your description - company: your company (optional) + role_name: drone + author: Bo-Yi Wu + description: Ansible role to configure drone (server and agent) + license: MIT - # If the issue tracker for your role is not on github, uncomment the - # next line and provide a value - # issue_tracker_url: http://example.com/issue/tracker + min_ansible_version: 2.3 - # Some suggested licenses: - # - BSD (default) - # - MIT - # - GPLv2 - # - GPLv3 - # - Apache - # - CC-BY - license: license (GPLv2, CC-BY, etc) + platforms: + - name: Ubuntu + versions: + - bionic + - xenial + - name: Debian + versions: + - stretch - min_ansible_version: 2.4 + galaxy_tags: + - drone + - docker + - ci + - drone-ci + - droneci - # If this a Container Enabled role, provide the minimum Ansible Container version. - # min_ansible_container_version: - - # Optionally specify the branch Galaxy will use when accessing the GitHub - # repo for this role. During role install, if no tags are available, - # Galaxy will use this branch. During import Galaxy will access files on - # this branch. If Travis integration is configured, only notifications for this - # branch will be accepted. Otherwise, in all cases, the repo's default branch - # (usually master) will be used. - #github_branch: - - # - # Provide a list of supported platforms, and for each platform a list of versions. - # If you don't wish to enumerate all versions for a particular platform, use 'all'. - # To view available platforms and versions (or releases), visit: - # https://galaxy.ansible.com/api/v1/platforms/ - # - # platforms: - # - name: Fedora - # versions: - # - all - # - 25 - # - name: SomePlatform - # versions: - # - all - # - 1.0 - # - 7 - # - 99.99 - - galaxy_tags: [] - # List tags for your role here, one per line. A tag is a keyword that describes - # and categorizes the role. Users find roles by searching for tags. Be sure to - # remove the '[]' above, if you add tags to this list. - # - # NOTE: A tag is limited to a single word comprised of alphanumeric characters. - # Maximum 20 tags per role. - -dependencies: [] - # List your role dependencies here, one per line. Be sure to remove the '[]' above, - # if you add dependencies to this list. \ No newline at end of file +dependencies: + - { role: geerlingguy.docker }