Skip to main content

Molecule GCE Plugin :: run molecule tests on Google Cloud Engine

Project description

Molecule GCE Plugin

PyPI Package image Python Black Code Style Ansible Code of Conduct Ansible mailing lists Repository License -->

Molecule GCE is designed to allow use Google Cloud Engine for provisioning test resources.

Please note that this driver is currently in its early stage of development.

This plugin requires google.cloud and community.crypto collections to be present:

ansible-galaxy collection install google.cloud
ansible-galaxy collection install community.crypto

Installation and Usage

Install molecule-gce :

pip install molecule-gce

Create a new role with molecule using the GCE driver:

molecule init role <role_name> -d gce

Configure <role_name>/molecule/default/molecule.yml with required parameters:

dependency:
  name: galaxy
driver:
  name: gce
  project_id: my-google-cloud-platform-project-id  # if not set, will default to env GCE_PROJECT_ID
  region: us-central1  # REQUIRED
  network_name: my-vpc  # specify if other than default
  subnetwork_name: my-subnet  # specify if other than default
  vpc_host_project: null  # if you use a shared vpc, set here the vpc host project. In that case, your GCP user needs the necessary permissions in the host project, see https://cloud.google.com/vpc/docs/shared-vpc#iam_in_shared_vpc
  auth_kind: serviceaccount  # set to machineaccount or serviceaccount or application - if set to null will read env GCP_AUTH_KIND
  service_account_email: null  # set to an email associated with the project - if set to null, will default to GCP_SERVICE_ACCOUNT_EMAIL. Should not be set if using auth_kind serviceaccount.
  service_account_file: /path/to/gce-sa.json  # set to the path to the JSON credentials file - if set to null, will default to env GCP_SERVICE_ACCOUNT_FILE
  scopes:
    - "https://www.googleapis.com/auth/compute"  # will default to env GCP_SCOPES, https://www.googleapis.com/auth/compute is the minimum required scope.
  external_access: false  # chose whether to create a public IP for the VM or not - default is private IP only
  instance_os_type: linux  # Either windows or linux. Will be considered linux by default. You can NOT mix Windows and Linux VMs in the same scenario.
platforms:
  - name: ubuntu-instance-created-by-molecule  #  REQUIRED: this will be your VM name
    zone: us-central1-a  # Example: us-west1-b. Will default to zone b of region defined in driver (some regions do not have a zone-a)
    machine_type: n1-standard-1  # If not specified, will default to n1-standard-1
    preemptible: false  # If not specified, will default to false. Preemptible instances have no SLA, in case of resource shortage in the zone they might get destroyed (or not be created) without warning, and will always be terminated after 24 hours. But they cost less and will mitigate the financial consequences of a PAYG licenced VM that would be forgotten.
    image: 'projects/ubuntu-os-cloud/global/images/family/ubuntu-1604-lts'  # Points to an image, you can get a list of available images with command 'gcloud compute images list'.
       # The expected format of this string is projects/<project>/global/images/family/<family-name>
       # (see https://googlecloudplatform.github.io/compute-image-tools/daisy-automating-image-creation.html)
       #  Wille default to debian-10 image for os_type Linux, Windows 2019 for os_type Windows
  - name: debian-instance-created-by-molecule
    zone: us-central1-a
    machine_type: n1-standard-2
    image: 'projects/debian-cloud/global/images/family/debian-10'
  - name: n1-standard1-debian10-in-region-b


provisioner:
  name: ansible
verifier:
  name: ansible

Get Involved

License

The MIT License.

The logo is licensed under the Creative Commons NoDerivatives 4.0 License.

If you have some other use in mind, contact us.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

molecule-gce-0.0.0.tar.gz (28.3 kB view details)

Uploaded Source

Built Distribution

molecule_gce-0.0.0-py3-none-any.whl (19.2 kB view details)

Uploaded Python 3

File details

Details for the file molecule-gce-0.0.0.tar.gz.

File metadata

  • Download URL: molecule-gce-0.0.0.tar.gz
  • Upload date:
  • Size: 28.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for molecule-gce-0.0.0.tar.gz
Algorithm Hash digest
SHA256 506f6f5377cf844c79fd9cf544aeb851a4f93c190054c8babf47d38cfea3c1d2
MD5 9740f2de0cb7379b0c63cae92ac7c827
BLAKE2b-256 0de517d4a4220789b6823537ad64213faf88604c40bc1bb5f3b951863c2dd743

See more details on using hashes here.

File details

Details for the file molecule_gce-0.0.0-py3-none-any.whl.

File metadata

File hashes

Hashes for molecule_gce-0.0.0-py3-none-any.whl
Algorithm Hash digest
SHA256 38daef4d151e895d099d1b26f571c08031b33199094553f91bb3458788d235a5
MD5 01fb348520c3f78cf1e2e2ae1d6698b0
BLAKE2b-256 0c6c5bbdb161e5c8215ac1bc1476e90f7bf403a70aed1fe760edf94fccac7e44

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page