{"id":15514030,"url":"https://github.com/nibalizer/ibmcloud-ansible","last_synced_at":"2025-04-23T03:11:49.954Z","repository":{"id":136945151,"uuid":"99505035","full_name":"nibalizer/ibmcloud-ansible","owner":"nibalizer","description":"Ansible scripts, playbooks, and plugins for use with the ibmcloud","archived":false,"fork":false,"pushed_at":"2020-07-16T18:25:25.000Z","size":28,"stargazers_count":7,"open_issues_count":0,"forks_count":4,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-03-29T21:32:10.950Z","etag":null,"topics":["ansible","bluemix","ibm","ibm-cloud","ibmcloud"],"latest_commit_sha":null,"homepage":"https://www.ibm.com/cloud/vpc","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/nibalizer.png","metadata":{"files":{"readme":"Readme.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2017-08-06T18:17:48.000Z","updated_at":"2021-05-21T23:57:28.000Z","dependencies_parsed_at":null,"dependency_job_id":"d4bd7b35-bbf4-4a72-bb18-d80d0401f60a","html_url":"https://github.com/nibalizer/ibmcloud-ansible","commit_stats":null,"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nibalizer%2Fibmcloud-ansible","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nibalizer%2Fibmcloud-ansible/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nibalizer%2Fibmcloud-ansible/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/nibalizer%2Fibmcloud-ansible/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/nibalizer","download_url":"https://codeload.github.com/nibalizer/ibmcloud-ansible/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":250360498,"owners_count":21417721,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["ansible","bluemix","ibm","ibm-cloud","ibmcloud"],"created_at":"2024-10-02T09:57:00.856Z","updated_at":"2025-04-23T03:11:49.947Z","avatar_url":"https://github.com/nibalizer.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"ibmcloud-ansible\n--------------\n\nAnsible playbooks and utilities for working with the [IBM Cloud](https://cloud.ibm.com). Also see the [ansible-collection-ibm](https://github.com/IBM-Cloud/ansible-collection-ibm).\n\nMost require an ansible inventory file. You can create one easily as below or we provide a [dynamic inventory script](https://github.com/nibalizer/ibmcloud-ansible#dynamic-inventory) for IBM Cloud VPC. You can also integrate [IBM Cloud Schematics Terraform](https://cloud.ibm.com/docs/terraform?topic=terraform-ansible#import_from_terraform) for inventory.\n\nInventory:\n\n```shell\ncat inventory\n[hosts]\n192.168.0.5 ansible_ssh_user=ubuntu\n```\n\n\n## `bootstrap_python.sh`\n\nDescription: This script will install python on ubuntu hosts, needed for other playbooks.\n\nUsage:\n\n```bash\n./bootstrap_python.sh \u003cip\u003e\n```\n\n## `first-config.yml`\n\nDescription: This playbook will do first-run configuration for IBM Cloud VMs including securing ssh, installing basic packages, etc.\n\nUsage:\n\n```bash\nansible-playbook -i inventory first-config.yml\n```\n\n## `ibmcloud-client.yml`\n\nDescription: This playbook will install the `ibmcloud` cli tool and several common plugins. User to install with is customizable.\n\n```shell\nansible-playbook -i inventory ibmcloud-client.yml\n```\n\n\u003e Note: `ibmcloud` plugins are installed per-user. If you want to install under your user do an override like this:\n\n```shell\nansible-playbook -i inventory ibmcloud-client.yml --extra-vars \"ibmcloud_unix_user=ubuntu\"\n```\n\n## Dynamic Inventory\n\nIBM Cloud has a dynamic inventory plugin for ansible. It can detect your vpc gen 1 and gen 2 instances so you don't have to keep static inventory files around.\n\n### Set up dynamic inventory\n\n1. Install python dependencies for inventory (`plugins/inventory/requirements.txt`)\n\n1. Set up `ansible.cfg` (add the following)\n\n    ```\n    [inventory]\n    enable_plugins = auto\n    ```\n\n1. Set up `ibmcloud.yaml`\n\n```\nplugin: ibmcloud.ibmcollection.vpcinventory\n```\n\n1. Export or set your [IBM Cloud API Key](https://cloud.ibm.com/docs/iam?topic=iam-userapikey#create_user_key)\n\n```bash\nexport IBMCLOUD_API_KEY='93nift8rl1h8f93tl3itn3GGGST83n382921n11n\"\n```\n\n1. Test using `ansible-inventory`\n\n```bash\n$ ansible-inventory -i ibmcloud.yaml --list all\n```\n```json\n{\n    \"_meta\": {\n        \"hostvars\": {\n            \"marty-vm1\": {\n                \"ansible_host\": \"10.240.0.4\",\n                \"vpc_name\": \"marty-vpc\"\n            },\n            \"nibz-falco-2\": {\n                \"ansible_host\": \"10.240.0.11\",\n                \"vpc_name\": \"nibz\"\n            },\n            \"svergara-vpc-vm1-ubu\": {\n                \"ansible_host\": \"10.240.128.4\",\n                \"vpc_name\": \"svergara-vpc\"\n            },\n            \"svergara-vpc-vm1-win\": {\n                \"ansible_host\": \"10.240.128.36\",\n                \"vpc_name\": \"svergara-vpc\"\n            },\n            \"testinstance\": {\n                \"ansible_host\": \"10.240.0.4\",\n                \"vpc_name\": \"nibz\"\n            }\n        }\n    },\n    \"all\": {\n        \"children\": [\n            \"ungrouped\"\n        ]\n    },\n    \"ungrouped\": {\n        \"hosts\": [\n            \"marty-vm1\",\n            \"nibz-falco-2\",\n            \"svergara-vpc-vm1-ubu\",\n            \"svergara-vpc-vm1-win\",\n            \"testinstance\"\n        ]\n    }\n}\n```\n\n### Developer Utilities\n\nAnsible playbooks to install basic developer utilities for working with bluemix: bx, kubectl, docker, cf, etc. This solves the problem of collecting and installing the client utilities which are typically distributed as binaries in tarballs available over https.\n\n| Software | Org | command(s)  | version  |\n|--:|---|---|---|\n| IBMCloud CLI  | IBM  | ibmcloud  | latest  |\n| Kubernetes  | CNCF  | kubectl  | latest  |\n| Helm | CNCF  | helm | latest  |\n| Cloud Foundry | Cloud Foundry | cf | latest |\n| Moby | Moby | docker | latest  |\n| Packer | Hashicorp | packer | 1.0.3 |\n| Terraform | Hashicorp | terraform | 0.10.0 |\n\n\nThis requires an ansible inventory file.\n\nInventory:\n\n```shell\ncat inventory\n[hosts]\n192.168.0.5 ansible_ssh_user=ubuntu\n```\n\n\nUsage:\n\n```shell\n./run_all.sh\n```\n\nor\n\n```shell\nansible-playbook -i inventory k8s-client.yml\nansible-playbook -i inventory ibmcloud-client.yml\nansible-playbook -i inventory cf-client.yml\nansible-playbook -i inventory docker.yml\nansible-playbook -i inventory hashicorp.yml\nansible-playbook -i inventory istio.yml\nansible-playbook -i inventory git-repos.yml\n```\n\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnibalizer%2Fibmcloud-ansible","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fnibalizer%2Fibmcloud-ansible","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fnibalizer%2Fibmcloud-ansible/lists"}