This is an automated email from the ASF dual-hosted git repository.

arvindsh pushed a commit to branch main
in repository https://gitbox.apache.org/repos/asf/fluo-muchos.git


The following commit(s) were added to refs/heads/main by this push:
     new ad73d6d  Update Ansible (Azure) version (#404)
ad73d6d is described below

commit ad73d6d5d73251d62ae675100ef1fe5d69382441
Author: Arvind Shyamsundar <[email protected]>
AuthorDate: Wed Aug 11 10:15:18 2021 -0700

    Update Ansible (Azure) version (#404)
    
    * Update to ansible-core (2.11.3), ansible-lint (5.1.2)
    * Switch to using community-contributed Azure VMSS Ansible module
    * Update README to include steps for installing the Azure Ansible
      modules from Ansible Galaxy
    * Update CI to align with above
    * Pin Ansible collection versions
---
 .github/workflows/ci.yaml                          |  2 ++
 README.md                                          |  4 ++--
 ansible/roles/azure/tasks/create_multiple_vmss.yml |  6 +++---
 ansible/roles/azure/tasks/create_vmss.yml          |  6 +++---
 ansible/roles/azure/tasks/main.yml                 |  4 +++-
 lib/muchos/azure.py                                | 14 ++++++++++----
 lib/muchos/config/azurevalidationhelpers.py        |  6 +++++-
 lib/requirements.txt                               |  5 ++---
 scripts/cibuild                                    |  2 +-
 scripts/install-ansible-for-azure                  |  5 +++++
 10 files changed, 36 insertions(+), 18 deletions(-)

diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml
index 18274f6..d793b5c 100644
--- a/.github/workflows/ci.yaml
+++ b/.github/workflows/ci.yaml
@@ -46,5 +46,7 @@ jobs:
         python-version: '3.6'
     - name: Install required packages
       run: pip install -r ./lib/requirements.txt
+    - name: Install Azure specific Ansible collections
+      run: ./scripts/install-ansible-for-azure
     - name: Run Fluo-Muchos CI script
       run: ./scripts/cibuild
diff --git a/README.md b/README.md
index efe71fb..a4d498e 100644
--- a/README.md
+++ b/README.md
@@ -70,8 +70,8 @@ sudo yum install azure-cli-2.0.69-1.el7.x86_64.rpm
 ```
 * An Azure account with permissions to either use an existing or create new 
Resource Groups, Virtual Networks and Subnets
 * A machine which can connect to securely deploy the cluster in Azure.
-* Install [Ansible for 
Azure](https://docs.microsoft.com/en-us/azure/virtual-machines/linux/ansible-install-configure)
 within
-  the Python virtual environment by using `pip install ansible[azure]==2.9.13`
+* Install the [Ansible collection for 
Azure](https://github.com/ansible-collections/azure), and associated 
pre-requisites within
+  the Python virtual environment, by executing the 
[install-ansible-for-azure](scripts/install-ansible-for-azure) script.
 
 When running Muchos under Ubuntu 18.04, checkout these 
[tips](docs/azure-ubuntu-1804.md).
 
diff --git a/ansible/roles/azure/tasks/create_multiple_vmss.yml 
b/ansible/roles/azure/tasks/create_multiple_vmss.yml
index 151c620..906c43a 100644
--- a/ansible/roles/azure/tasks/create_multiple_vmss.yml
+++ b/ansible/roles/azure/tasks/create_multiple_vmss.yml
@@ -31,7 +31,7 @@
     name: azure_multiple_vmss_vars
 
 - name: Create Scale Set
-  azure_rm_virtualmachinescaleset:
+  community.azure.azure_rm_virtualmachinescaleset:
     resource_group: "{{ resource_group }}"
     location: "{{ location }}"
     name: "{{ vmss_name }}-{{ item.name_suffix }}"
@@ -180,13 +180,13 @@
       {{ vmss_host }}
 
 - name: Clear section
-  ini_file:
+  community.general.ini_file:
     path: "{{ deploy_path }}/conf/muchos.props"
     section: "nodes"
     state: absent
 
 - name: Recreate section
-  ini_file:
+  community.general.ini_file:
     path: "{{ deploy_path }}/conf/muchos.props"
     section: "nodes"
     option: "#host0"
diff --git a/ansible/roles/azure/tasks/create_vmss.yml 
b/ansible/roles/azure/tasks/create_vmss.yml
index 7dec7c4..2812f58 100644
--- a/ansible/roles/azure/tasks/create_vmss.yml
+++ b/ansible/roles/azure/tasks/create_vmss.yml
@@ -40,7 +40,7 @@
   when: numnodes > 100
 
 - name: Create Scale Set
-  azure_rm_virtualmachinescaleset:
+  community.azure.azure_rm_virtualmachinescaleset:
     resource_group: "{{ resource_group }}"
     location: "{{ location }}"
     name: "{{ vmss_name }}"
@@ -133,13 +133,13 @@
     mode: 0644
 
 - name: Clear section
-  ini_file:
+  community.general.ini_file:
     path: "{{ deploy_path }}/conf/muchos.props"
     section: "nodes"
     state: absent
 
 - name: Recreate section
-  ini_file:
+  community.general.ini_file:
     path: "{{ deploy_path }}/conf/muchos.props"
     section: "nodes"
     option: "#host0"
diff --git a/ansible/roles/azure/tasks/main.yml 
b/ansible/roles/azure/tasks/main.yml
index 0b5dab9..bd0e447 100644
--- a/ansible/roles/azure/tasks/main.yml
+++ b/ansible/roles/azure/tasks/main.yml
@@ -22,7 +22,9 @@
     quiet: yes
     that: ansible_version.full is version('2.9.0', '>=')
     fail_msg: "Ansible 2.9 or above is required for using Azure ADLS Gen2 in 
Muchos.
-    Update it using pip install --upgrade ansible[azure]==2.9.13"
+    Please use the requirements.txt file to install the currently supported
+    version of Ansible, and also execute the 
./scripts/install-ansible-for-azure
+    script to install the Ansible collection for Azure and other 
pre-requisites."
   when: use_adlsg2
 
 - import_tasks: create_common_resources.yml
diff --git a/lib/muchos/azure.py b/lib/muchos/azure.py
index 8558a1e..54cdbb3 100644
--- a/lib/muchos/azure.py
+++ b/lib/muchos/azure.py
@@ -84,7 +84,8 @@ class VmssCluster(ExistingCluster):
                 [
                     "ansible-playbook",
                     path.join(
-                        config.deploy_path, "ansible/azure_terminate.yml",
+                        config.deploy_path,
+                        "ansible/azure_terminate.yml",
                     ),
                     "--extra-vars",
                     json.dumps(azure_config),
@@ -108,7 +109,10 @@ class VmssCluster(ExistingCluster):
         retcode = subprocess.call(
             [
                 "ansible-playbook",
-                path.join(config.deploy_path, "ansible/azure_wipe.yml",),
+                path.join(
+                    config.deploy_path,
+                    "ansible/azure_wipe.yml",
+                ),
                 "--extra-vars",
                 json.dumps(azure_config),
             ]
@@ -198,7 +202,8 @@ class VmssCluster(ExistingCluster):
 
                     print(
                         "{0}: {1}".format(
-                            "worker_data_dirs", curr_worker_dirs,
+                            "worker_data_dirs",
+                            curr_worker_dirs,
                         ),
                         file=vmss_file,
                     )
@@ -213,7 +218,8 @@ class VmssCluster(ExistingCluster):
 
                     print(
                         "{0}: {1}".format(
-                            "default_data_dirs", curr_default_dirs,
+                            "default_data_dirs",
+                            curr_default_dirs,
                         ),
                         file=vmss_file,
                     )
diff --git a/lib/muchos/config/azurevalidationhelpers.py 
b/lib/muchos/config/azurevalidationhelpers.py
index 3d9ff1e..421cd10 100644
--- a/lib/muchos/config/azurevalidationhelpers.py
+++ b/lib/muchos/config/azurevalidationhelpers.py
@@ -50,7 +50,11 @@ def vmss_status_succeeded_if_exists(config, client):
 
 
 def validate_disk_count(
-    context, specified_disk_count, mount_root, disk_pattern, validation_errors,
+    context,
+    specified_disk_count,
+    mount_root,
+    disk_pattern,
+    validation_errors,
 ):
     # min_data_disk_count is 1 unless we are using exclusively
     # ephemeral storage (data_disk_count is 0), which in turn is when:
diff --git a/lib/requirements.txt b/lib/requirements.txt
index 90e584e..d17ac69 100644
--- a/lib/requirements.txt
+++ b/lib/requirements.txt
@@ -1,5 +1,4 @@
 flake8==3.8.0
-ansible-lint==4.2.0
-ansible==2.9.13
-ansible[azure]==2.9.13
+ansible-core==2.11.3
+ansible-lint==5.1.2
 nose==1.3.7
diff --git a/scripts/cibuild b/scripts/cibuild
index b78d3e9..51b1841 100755
--- a/scripts/cibuild
+++ b/scripts/cibuild
@@ -4,7 +4,7 @@ echo "Running nose tests..."
 nosetests -w lib/
 echo "SUCCESS: All Nose tests completed."
 echo "Running Ansible-lint..."
-ansible-lint -x 204,301
+ansible-lint -x no-changed-when,risky-file-permissions,unnamed-task,var-naming
 echo "SUCCESS: Ansible-lint completed."
 echo "Running flake8 to check Python code..."
 flake8
diff --git a/scripts/install-ansible-for-azure 
b/scripts/install-ansible-for-azure
new file mode 100755
index 0000000..a7388a8
--- /dev/null
+++ b/scripts/install-ansible-for-azure
@@ -0,0 +1,5 @@
+#!/usr/bin/env bash
+ansible-galaxy collection install community.general:3.4.0
+ansible-galaxy collection install azure.azcollection:1.8.0
+pip install -r 
~/.ansible/collections/ansible_collections/azure/azcollection/requirements-azure.txt
+ansible-galaxy collection install community.azure:1.0.0

Reply via email to