Molecule GCE插件 :: 在Google Cloud Engine上运行molecule测试
项目描述
Molecule GCE插件
Molecule GCE旨在允许使用Google Cloud Engine来配置测试资源。
请注意,此驱动程序目前处于开发初期阶段。
此插件需要存在google.cloud和community.crypto集合
ansible-galaxy collection install google.cloud
ansible-galaxy collection install community.crypto
安装和使用
安装molecule-gce
pip install molecule-gce
使用GCE驱动程序使用molecule创建新角色
molecule init role <role_name> -d gce
配置<role_name>/molecule/default/molecule.yml
,并添加所需参数
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
username: ssh-user # used to connect with ssh to the GCE instance, will default to 'molecule'
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:
# see src/molecule_gce/playbooks/tasks/create_linux_instance.yml for a complete list of supported keys
- 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
tags: # Not required. Format must follow https://docs.ansible.org.cn/ansible/latest/collections/google/cloud/gcp_compute_instance_module.html#parameter-tags
items:
- allow-ssh
- allow-rdp
- 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
参与其中
- 加入我们Libera上的
#ansible-devtools
频道。 - 加入molecule-users论坛的讨论。
- 通过查看维基百科加入社区工作组。
- 想了解发行信息,请订阅ansible-announce 列表。
- 关于Ansible电子邮件列表、IRC频道的完整列表,请查看通信页面。
许可证
MIT许可证。
该标志受Creative Commons NoDerivatives 4.0许可证许可。
如果您有其他用途,请联系我们。
项目详情
下载文件
下载适合您平台的文件。如果您不确定选择哪个,请了解更多关于安装包的信息。
源代码分发
molecule-gce-1.0.0.tar.gz (36.1 kB 查看哈希)
构建分发
molecule_gce-1.0.0-py3-none-any.whl (19.6 kB 查看哈希)
关闭
molecule-gce-1.0.0.tar.gz的哈希
算法 | 哈希摘要 | |
---|---|---|
SHA256 | c78dc4a862f265c862656f9a4948e565cac579ec9e3feee5bdc263aaf11d9be5 |
|
MD5 | fb062eea75d0184121f34b2713443be9 |
|
BLAKE2b-256 | a9e032bc68ae26855d7884408d5a2ee2a841c4c85b632bb746053b2542d95b47 |
关闭
molecule_gce-1.0.0-py3-none-any.whl的哈希
算法 | 哈希摘要 | |
---|---|---|
SHA256 | 0f6a1435a58450d4800d78dfcc02267fec5ad480167b204129521148b02a9fb1 |
|
MD5 | d531ecadb244c8ac3d873d16f3cc4df3 |
|
BLAKE2b-256 | 792bf76a9c6f66096b10d533affa04fcfacc61f4fdf75cd8a30da94571ed1237 |