From 5cde3cc7c632e95e8288bd124c4d9aeb7fc1ace9 Mon Sep 17 00:00:00 2001 From: Jakub Cierlik Date: Thu, 14 Apr 2022 10:35:18 +0200 Subject: [PATCH] blueprint examples updated --- README.md | 15 +++------ examples/blueprint.yaml | 58 +++++++++++++-------------------- examples/existing_template.yaml | 22 +++++++++---- 3 files changed, 43 insertions(+), 52 deletions(-) diff --git a/README.md b/README.md index 7813655..6353409 100644 --- a/README.md +++ b/README.md @@ -2,18 +2,12 @@ ## Packaging -To build the plugin *wagon* file, use the Cloudify Wagon Builder container image. - -``` -docker run \ - -v /path/to/cloudify-ansible-tower-plugin/:/packaging \ - --name cfy-builder \ - cloudifyplatform/cloudify-centos-7-wagon-builder -``` +The _wagon_ and _plugin.yaml_ files are available in [Releases](https://github.com/cloudify-incubator/cloudify-ansible-tower-plugin/releases). +Use them to upload the plugin into your Cloudify Manager. ## Importing -In Cloudify, go to the *System Resources* menu and click the *Upload* button within the *Plugins* widget. Use the Wagon file (.wgn) from the last section and the plugin.yaml file from this repo. +In Cloudify, go to the *System Resources* menu and click the *Upload* button within the *Plugins* widget. Use the Wagon file (.wgn) and plugin.yaml from the last section. ![Importing a Cloudify plugin](static/screenshots/cfy1.png) @@ -23,7 +17,7 @@ In Cloudify, go to the *System Resources* menu and click the *Upload* button wit Cloudify needs to perform actions as a user within AWX / Ansible Tower. To do this, it needs a *Personal Access Token (PAT)*. Within AWX/Tower, go to the *Users* menu, click on the user you want to authenticate as, click the *TOKENS* top menu button, and click the *+ (plus symbol)*. -Unless you have a specific use case, leave the *APPLICATION* field blank and change the *SCOPE* field to *Write*. The token issued should be used within your Cloudify blueprint. +Unless you have a specific use case, leave the *APPLICATION* field blank and change the *SCOPE* field to *Write*. ![Creating an Ansible Tower token](static/screenshots/awx1.png) @@ -31,3 +25,4 @@ Unless you have a specific use case, leave the *APPLICATION* field blank and cha ![Listing Ansible Tower tokens](static/screenshots/awx3.png) +Then, you can save the Token value in the secret in your Cloudify Manager. diff --git a/examples/blueprint.yaml b/examples/blueprint.yaml index d118c56..fd6ec0e 100644 --- a/examples/blueprint.yaml +++ b/examples/blueprint.yaml @@ -1,27 +1,37 @@ tosca_definitions_version: cloudify_dsl_1_3 description: > - Example for using Ansible Tower plugin + Example for using Ansible Tower plugin and create resources imports: -- /opt/manager/resources/spec/cloudify/5.0.5/types.yaml +- http://cloudify.co/spec/cloudify/6.3.1/types.yaml - plugin:cloudify-ansible-tower-plugin inputs: endpoint: - description: YOUR ANSIBLE TOWER API ENDPOINT + type: string + description: | + Ansible Tower API Endpoint. + Should contain the prefix 'http://' or 'https://'. default: https://tower.eaas.joscor.dev access_token: - description: YOUR ANSIBLE TOWER API TOKEN - default: 9qT5WKMDxx8aSvJFMmgNY3eJ0RwO27 + type: string + description: Your User's Ansible Tower Token. + default: { get_secret: ansible_tower_token } + + endpoint_verify: + type: boolean + description: Enable SSL certificate verification. + default: false dsl_definitions: client_config: &client_config endpoint: { get_input: endpoint } access_token: { get_input: access_token } + endpoint_verify: { get_input: endpoint_verify } node_templates: @@ -45,13 +55,13 @@ node_templates: - type: cloudify.ansible_tower.relationships.contained_in_organization target: org_cloudify - user_jcornutt: + user: type: cloudify.ansible_tower.nodes.User properties: resource_config: - username: jcornutt - first_name: Joshua - last_name: Cornutt + username: cloudify + first_name: John + last_name: Smith password: 1nS3Cur3P455w0rD client_config: *client_config relationships: @@ -68,30 +78,7 @@ node_templates: credential_type: Machine inputs: username: ubuntu - ssh_key_data: | - -----BEGIN RSA PRIVATE KEY----- - MIIEogIBAAKCAQEAu588SannURy58yJ50v66gRNwcEZBWCDZlTcll44j8gE6JtMfL1q5BO7mssAx - caYWnffLYjsCaNvXGyYyw6PKAHGkcIfa4yV+YB2g4RLAwOS4QGxvzyZ2v5E6fdXk3xzRS8Pw6sQZ - QzDRqaJI2Pwv+DaZVDv9ObfZ0ampO5u8onr9SlBSPfh/0XGiFh1ZujqYHVTaHYg+wgbYG2fU+zSD - wHn+OJvW7iPXhCWf/NqQekz6Y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VGQA1CYA0DD5bgkbkun1h/dG2cY9z9v5y44+1pcNN03dTrVngZ3u - HGCgUGnupuNhSd8hDKgj0CKz9gEkyI0U1qRihFdnkOyzAoGABoBElYgImBKInuqeZqqMvkfIcK2I - L6QHdB1sZIqFd+h61obZ46kP7UriiKTvAPm5GqQ4HYXWCUwsqkvgiFMasrdQxGgT4aOkvVW08pHJ - eP2CrGJO/yJB9jIpXEfCXe8Mmvkosibau3q7raJiXfgRc1frdSZ/hJJXW1S6tvxGTZc= - -----END RSA PRIVATE KEY----- + ssh_key_data: { get_secret: ssh_key } client_config: *client_config relationships: - type: cloudify.ansible_tower.relationships.contained_in_team @@ -127,9 +114,8 @@ node_templates: type: cloudify.ansible_tower.nodes.Host properties: resource_config: - name: !!str 172.18.0.1 - description: | - Local docker host + name: '172.18.0.1' + description: Local docker host client_config: *client_config relationships: - type: cloudify.ansible_tower.relationships.contained_in_inventory diff --git a/examples/existing_template.yaml b/examples/existing_template.yaml index 13cc974..f3b8e9b 100644 --- a/examples/existing_template.yaml +++ b/examples/existing_template.yaml @@ -1,27 +1,37 @@ tosca_definitions_version: cloudify_dsl_1_3 description: > - Example for using Ansible Tower plugin + Example for using Ansible Tower plugin using existing resources imports: -- /opt/manager/resources/spec/cloudify/5.0.5/types.yaml +- http://cloudify.co/spec/cloudify/6.3.1/types.yaml - plugin:cloudify-ansible-tower-plugin inputs: endpoint: - description: YOUR ANSIBLE TOWER API ENDPOINT + type: string + description: | + Ansible Tower API Endpoint. + Should contain the prefix 'http://' or 'https://'. default: https://tower.eaas.joscor.dev access_token: - description: YOUR ANSIBLE TOWER API TOKEN - default: 9qT5WKMDxx8aSvJFMmgNY3eJ0RwO27 + type: string + description: Your User's Ansible Tower Token. + default: { get_secret: ansible_tower_token } + + endpoint_verify: + type: boolean + description: Enable SSL certificate verification. + default: false dsl_definitions: client_config: &client_config endpoint: { get_input: endpoint } access_token: { get_input: access_token } + endpoint_verify: { get_input: endpoint_verify } node_templates: @@ -38,4 +48,4 @@ node_templates: client_config: *client_config relationships: - type: cloudify.ansible_tower.relationships.job_contained_in_job_template - target: job_template_example \ No newline at end of file + target: job_template_example