-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #132 from oomichi/add-azure-ansible
Add k8s deployment with Ansible
- Loading branch information
Showing
5 changed files
with
115 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,4 @@ | ||
ci/03_ansible/hosts | ||
deployments/kubespray/container-images/ | ||
deployments/ansible/venv-ansible | ||
deployments/ansible/aks.yaml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
- name: Create Azure Kubernetes Service | ||
hosts: localhost | ||
connection: local | ||
tasks: | ||
- name: Create resource group | ||
azure.azcollection.azure_rm_resourcegroup: | ||
name: ${AKS_RESOURCE_GROUP} | ||
location: japaneast | ||
- name: Create AKS Cluster | ||
azure.azcollection.azure_rm_aks: | ||
name: ${AKS_NAME} | ||
kubernetes_version: 1.27.7 | ||
location: japaneast | ||
resource_group: ${AKS_RESOURCE_GROUP} | ||
dns_prefix: akstest | ||
agent_pool_profiles: | ||
- name: agentpool1 | ||
mode: System | ||
count: 1 | ||
vm_size: Standard_D2_v2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
packaging | ||
requests[security] | ||
xmltodict | ||
msgraph-sdk==1.0.0 | ||
azure-cli-core==2.34.0 | ||
azure-common==1.1.11 | ||
azure-identity==1.14.0 | ||
azure-mgmt-authorization==2.0.0 | ||
azure-mgmt-apimanagement==3.0.0 | ||
azure-mgmt-batch==16.2.0 | ||
azure-mgmt-cdn==11.0.0 | ||
azure-mgmt-compute==26.1.0 | ||
azure-mgmt-containerinstance==9.0.0 | ||
azure-mgmt-core==1.3.0 | ||
azure-mgmt-containerregistry==9.1.0 | ||
azure-containerregistry==1.1.0 | ||
azure-mgmt-containerservice==20.0.0 | ||
azure-mgmt-datalake-store==1.0.0 | ||
azure-mgmt-datafactory==2.0.0 | ||
azure-mgmt-dns==8.0.0 | ||
azure-mgmt-marketplaceordering==1.1.0 | ||
azure-mgmt-monitor==3.0.0 | ||
azure-mgmt-managedservices==6.0.0 | ||
azure-mgmt-managementgroups==1.0.0 | ||
azure-mgmt-network==19.1.0 | ||
azure-mgmt-nspkg==2.0.0 | ||
azure-mgmt-privatedns==1.0.0 | ||
azure-mgmt-redis==13.0.0 | ||
azure-mgmt-resource==21.1.0 | ||
azure-mgmt-rdbms==10.0.0 | ||
azure-mgmt-search==8.0.0 | ||
azure-mgmt-servicebus==7.1.0 | ||
azure-mgmt-sql==3.0.1 | ||
azure-mgmt-storage==19.0.0 | ||
azure-mgmt-trafficmanager==1.0.0b1 | ||
azure-mgmt-web==6.1.0 | ||
azure-nspkg==2.0.0 | ||
azure-storage-blob==12.11.0 | ||
azure-core==1.28.0 | ||
azure-keyvault==4.2.0 | ||
azure-mgmt-keyvault==10.0.0 | ||
azure-mgmt-cosmosdb==6.4.0 | ||
azure-mgmt-hdinsight==9.0.0 | ||
azure-mgmt-devtestlabs==9.0.0 | ||
azure-mgmt-loganalytics==12.0.0 | ||
azure-mgmt-automation==1.0.0 | ||
azure-mgmt-iothub==2.2.0 | ||
azure-iot-hub==2.6.1 | ||
azure-mgmt-recoveryservices==2.0.0 | ||
azure-mgmt-recoveryservicesbackup==3.0.0 | ||
azure-mgmt-notificationhubs==7.0.0 | ||
azure-mgmt-eventhub==10.1.0 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#!/bin/bash | ||
|
||
cd $(dirname $0) | ||
|
||
export AKS_RESOURCE_GROUP=${AKS_RESOURCE_GROUP:-"aks_rg"} | ||
export AKS_NAME=${AKS_NAME:-"akstest"} | ||
|
||
if [ "${AZURE_SUBSCRIPTION_ID}" == "" ] || [ "${AZURE_CLIENT_ID}" == "" ] || [ "${AZURE_SECRET}" == "" ] || [ "${AZURE_TENANT}" == "" ]; then | ||
echo "Environment variables AZURE_SUBSCRIPTION_ID, AZURE_CLIENT_ID, AZURE_SECRET and AZURE_TENANT should be specified." | ||
echo "To create a service principal which contains the variables, run the following steps:" | ||
echo " $ curl -sL https://aka.ms/InstallAzureCLIDeb | sudo bash" | ||
echo " $ az login" | ||
echo " $ az ad sp create-for-rbac --name ansible --role Contributor --scopes /subscriptions/<subscription id>" | ||
exit 1 | ||
fi | ||
|
||
if [ ! -d ./venv-ansible ]; then | ||
set -e | ||
sudo apt update | ||
sudo apt -y install python3-pip python3-venv | ||
python3 -m venv ./venv-ansible | ||
source ./venv-ansible/bin/activate | ||
|
||
pip install ansible | ||
ansible --version | ||
# NOTE: requirements-azure.txt is downloaded by the following command. | ||
# If necessary, please update it by doing again. | ||
# curl -O https://raw.githubusercontent.com/ansible-collections/azure/dev/requirements-azure.txt | ||
pip install -r requirements-azure.txt | ||
ansible-galaxy collection install azure.azcollection | ||
set +e | ||
else | ||
source ./venv-ansible/bin/activate | ||
fi | ||
|
||
set -e | ||
|
||
envsubst < ./aks.yaml.template > ./aks.yaml | ||
ansible-playbook ./aks.yaml | ||
az aks get-credentials --resource-group ${AKS_RESOURCE_GROUP} --name ${AKS_NAME} --admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters