]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph-ansible.git/commitdiff
ansible: use ansible.utils.ipwrap instead of ansible.netcommon.ipwrap
authorSeena Fallah <seenafallah@gmail.com>
Tue, 7 Jun 2022 18:38:51 +0000 (20:38 +0200)
committerGuillaume Abrioux <gabrioux@redhat.com>
Tue, 14 Jun 2022 07:36:39 +0000 (09:36 +0200)
ansible.netcommon.ipwrap is deprecated and is not being redirected with ansible 2.9.*

Signed-off-by: Seena Fallah <seenafallah@gmail.com>
Co-authored-by: Guillaume Abrioux <gabrioux@redhat.com>
17 files changed:
.gitignore
docs/source/index.rst
group_vars/all.yml.sample
group_vars/rhcs.yml.sample
infrastructure-playbooks/cephadm-adopt.yml
infrastructure-playbooks/cephadm.yml
requirements.txt
requirements.yml [new file with mode: 0644]
roles/ceph-dashboard/tasks/configure_dashboard.yml
roles/ceph-defaults/defaults/main.yml
roles/ceph-facts/tasks/grafana.yml
roles/ceph-facts/tasks/set_monitor_address.yml
roles/ceph-facts/tasks/set_radosgw_address.yml
tests/requirements.txt
tox-external_clients.ini
tox-subset_update.ini
tox.ini

index 583556ecc8b880146dea9b07c2ec0a6210aa1b72..23d4c25bb5602959821effe94fc695c76b5a7d8c 100644 (file)
@@ -20,3 +20,4 @@ ceph-ansible.spec
 !.travis.yml
 !.mergify.yml
 !raw_install_python.yml
+!requirements.yml
index 916b5e8888da21c6745925e747a45b92d738db1b..7fa721874bb622a1a2beb4e814d143f9c990d3d3 100644 (file)
@@ -63,6 +63,16 @@ You can acquire Ansible on Ubuntu by using the `Ansible PPA <https://launchpad.n
    $ sudo apt update
    $ sudo apt install ansible
 
+Ansible collections
+-------------------
+
+In order to install third-party collections that are required for ceph-ansible,
+please run:
+
+.. code-block:: console
+
+   $ ansible-galaxy install -r requirements.yml
+
 
 Releases
 ========
index 06128a872ab2274f6500655ea8e1b2235f4f2685..658ff3d788291a1b870074548f66a365c90e3d70 100644 (file)
@@ -752,7 +752,7 @@ dummy:
 # For example:
 # If the ceph public network is 2a00:8a60:1:c301::/64 and the iSCSI Gateway resides
 # at a dedicated gateway network (2a00:8a60:1:c300::/64) (With routing between those networks).
-# It means "{{ hostvars[item]['ansible_facts']['all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) | last | ansible.netcommon.ipwrap }}" will be empty.
+# It means "{{ hostvars[item]['ansible_facts']['all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) | last | ansible.utils.ipwrap }}" will be empty.
 # As a consequence, this prevent from deploying dashboard with iSCSI node when it reside in a subnet different than `public_network`.
 # Using `igw_network` make it possible, set it with the subnet used by your iSCSI node.
 #igw_network: "{{ public_network }}"
index 3c1a10f53cfcef12947930b6ea604317b1eeffd8..d1f9cd66a65598e6516b65d395f3d953d1d31a42 100644 (file)
@@ -752,7 +752,7 @@ alertmanager_container_image: registry.redhat.io/openshift4/ose-prometheus-alert
 # For example:
 # If the ceph public network is 2a00:8a60:1:c301::/64 and the iSCSI Gateway resides
 # at a dedicated gateway network (2a00:8a60:1:c300::/64) (With routing between those networks).
-# It means "{{ hostvars[item]['ansible_facts']['all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) | last | ansible.netcommon.ipwrap }}" will be empty.
+# It means "{{ hostvars[item]['ansible_facts']['all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) | last | ansible.utils.ipwrap }}" will be empty.
 # As a consequence, this prevent from deploying dashboard with iSCSI node when it reside in a subnet different than `public_network`.
 # Using `igw_network` make it possible, set it with the subnet used by your iSCSI node.
 #igw_network: "{{ public_network }}"
index 3f1c0dfc68d853b926fee1bd573f217f50eca0ea..40e06a34cb0b2b38a39e55867f62ee7015b6c31a 100644 (file)
       when: ip_version == 'ipv4'
 
     - name: manage nodes with cephadm - ipv6
-      command: "{{ ceph_cmd }} orch host add {{ ansible_facts['nodename'] }} {{ ansible_facts['all_ipv6_addresses'] | ips_in_ranges(cephadm_mgmt_network.split(',')) | last | ansible.netcommon.ipwrap }} {{ group_names | intersect(adopt_label_group_names) | join(' ') }}"
+      command: "{{ ceph_cmd }} orch host add {{ ansible_facts['nodename'] }} {{ ansible_facts['all_ipv6_addresses'] | ips_in_ranges(cephadm_mgmt_network.split(',')) | last | ansible.utils.ipwrap }} {{ group_names | intersect(adopt_label_group_names) | join(' ') }}"
       changed_when: false
       delegate_to: '{{ groups[mon_group_name][0] }}'
       when: ip_version == 'ipv6'
index 7d2bdbb69cc00b448df9afc39fc79f7f828ec350..01a6ce2bd10d06b3e7b2e1a441547758e7db10c6 100644 (file)
       when: ip_version == 'ipv4'
 
     - name: manage nodes with cephadm - ipv6
-      command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch host add {{ ansible_facts['hostname'] }} {{ ansible_facts['all_ipv6_addresses'] | ips_in_ranges(public_network.split(',')) | last | ansible.netcommon.ipwrap }} {{ group_names | join(' ') }} {{ '_admin' if mon_group_name | default('mons') in group_names else '' }}"
+      command: "{{ cephadm_cmd }} shell -- ceph --cluster {{ cluster }} orch host add {{ ansible_facts['hostname'] }} {{ ansible_facts['all_ipv6_addresses'] | ips_in_ranges(public_network.split(',')) | last | ansible.utils.ipwrap }} {{ group_names | join(' ') }} {{ '_admin' if mon_group_name | default('mons') in group_names else '' }}"
       changed_when: false
       delegate_to: '{{ groups[mon_group_name][0] }}'
       environment:
index b637816c3a49977e84e967561e428075a4b7dde4..b8b6274aac01d5f117a8a69634242971e5154a76 100644 (file)
@@ -1,4 +1,4 @@
 # These are Python requirements needed to run ceph-ansible master
-ansible>=3,<4
+ansible>=2.10,<2.11,!=2.9.10
 netaddr
 six
diff --git a/requirements.yml b/requirements.yml
new file mode 100644 (file)
index 0000000..5cb7863
--- /dev/null
@@ -0,0 +1,5 @@
+---
+# These are Ansible requirements needed to run ceph-ansible main
+collections:
+  - name: ansible.utils
+    version: '>=2.5.0'
index fe3d639173a7078071c328260d0eb0d544f333b1..d0152c4f03ed6af870909264c37198228a457ff5 100644 (file)
     - name: add iscsi gateways - ipv6
       command: "{{ ceph_cmd }} --cluster {{ cluster }} dashboard iscsi-gateway-add -i -"
       args:
-        stdin: "{{ 'https' if hostvars[item]['api_secure'] | default(false) | bool else 'http' }}://{{ hostvars[item]['api_user'] | default('admin') }}:{{ hostvars[item]['api_password'] | default('admin') }}@{{ hostvars[item]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(igw_network.split(',')) | last | ansible.netcommon.ipwrap }}:{{ hostvars[item]['api_port'] | default(5000) }}"
+        stdin: "{{ 'https' if hostvars[item]['api_secure'] | default(false) | bool else 'http' }}://{{ hostvars[item]['api_user'] | default('admin') }}:{{ hostvars[item]['api_password'] | default('admin') }}@{{ hostvars[item]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(igw_network.split(',')) | last | ansible.utils.ipwrap }}:{{ hostvars[item]['api_port'] | default(5000) }}"
         stdin_add_newline: no
       changed_when: false
       delegate_to: "{{ groups[mon_group_name][0] }}"
index 2f8ec959b8e82c674137c562cae191973f0bc087..1b434dc09ae31b34a71a264976c62b74f7cbec04 100644 (file)
@@ -744,7 +744,7 @@ alertmanager_dashboard_api_no_ssl_verify: "{{ true if dashboard_protocol == 'htt
 # For example:
 # If the ceph public network is 2a00:8a60:1:c301::/64 and the iSCSI Gateway resides
 # at a dedicated gateway network (2a00:8a60:1:c300::/64) (With routing between those networks).
-# It means "{{ hostvars[item]['ansible_facts']['all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) | last | ansible.netcommon.ipwrap }}" will be empty.
+# It means "{{ hostvars[item]['ansible_facts']['all_ipv4_addresses'] | ips_in_ranges(public_network.split(',')) | last | ansible.utils.ipwrap }}" will be empty.
 # As a consequence, this prevent from deploying dashboard with iSCSI node when it reside in a subnet different than `public_network`.
 # Using `igw_network` make it possible, set it with the subnet used by your iSCSI node.
 igw_network: "{{ public_network }}"
index 8f311f3febb82ccf24e8df070fdc0abc846f8f41..90c01bfb7e973ebc00b742e6de2c6bbf679e3746 100644 (file)
@@ -9,7 +9,7 @@
 
 - name: set grafana_server_addr fact - ipv6
   set_fact:
-    grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(grafana_network.split(',')) | last | ansible.netcommon.ipwrap }}"
+    grafana_server_addr: "{{ hostvars[inventory_hostname]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(grafana_network.split(',')) | last | ansible.utils.ipwrap }}"
   when:
     - groups.get(monitoring_group_name, []) | length > 0
     - ip_version == 'ipv6'
@@ -27,7 +27,7 @@
 
 - name: set grafana_server_addrs fact - ipv6
   set_fact:
-    grafana_server_addrs: "{{ (grafana_server_addrs | default([]) + [hostvars[item]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(grafana_network.split(',')) | last | ansible.netcommon.ipwrap]) | unique }}"
+    grafana_server_addrs: "{{ (grafana_server_addrs | default([]) + [hostvars[item]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(grafana_network.split(',')) | last | ansible.utils.ipwrap]) | unique }}"
   with_items: "{{ groups.get(monitoring_group_name, []) }}"
   when:
     - groups.get(monitoring_group_name, []) | length > 0
index 3ccce577e6049c0c31f546a03e2f9c60298c3483..b1cb3466752568c720443ccf029d5137154b9f92 100644 (file)
@@ -11,7 +11,7 @@
 
 - name: set_fact _monitor_addresses to monitor_address_block ipv6
   set_fact:
-    _monitor_addresses: "{{ _monitor_addresses | default([]) + [{ 'name': item, 'addr': hostvars[item]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(hostvars[item]['monitor_address_block'].split(',')) | last | ansible.netcommon.ipwrap }] }}"
+    _monitor_addresses: "{{ _monitor_addresses | default([]) + [{ 'name': item, 'addr': hostvars[item]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(hostvars[item]['monitor_address_block'].split(',')) | last | ansible.utils.ipwrap }] }}"
   with_items: "{{ groups.get(mon_group_name, []) }}"
   when:
     - "item not in _monitor_addresses | default([]) | selectattr('name', 'defined') |  map(attribute='name') | list"
@@ -21,7 +21,7 @@
 
 - name: set_fact _monitor_addresses to monitor_address
   set_fact:
-    _monitor_addresses: "{{ _monitor_addresses | default([]) + [{ 'name': item, 'addr': hostvars[item]['monitor_address'] | ansible.netcommon.ipwrap}] }}"
+    _monitor_addresses: "{{ _monitor_addresses | default([]) + [{ 'name': item, 'addr': hostvars[item]['monitor_address'] | ansible.utils.ipwrap}] }}"
   with_items: "{{ groups.get(mon_group_name, []) }}"
   when:
     - "item not in _monitor_addresses | default([]) | selectattr('name', 'defined') | map(attribute='name') | list"
@@ -30,7 +30,7 @@
 
 - name: set_fact _monitor_addresses to monitor_interface - ipv4
   set_fact:
-    _monitor_addresses: "{{ _monitor_addresses | default([]) + [{ 'name': item, 'addr': hostvars[item]['ansible_facts'][(hostvars[item]['monitor_interface']|replace('-', '_'))][ip_version]['address'] | ansible.netcommon.ipwrap }]  }}"
+    _monitor_addresses: "{{ _monitor_addresses | default([]) + [{ 'name': item, 'addr': hostvars[item]['ansible_facts'][(hostvars[item]['monitor_interface']|replace('-', '_'))][ip_version]['address'] | ansible.utils.ipwrap }]  }}"
   with_items: "{{ groups.get(mon_group_name, []) }}"
   when:
     - "item not in _monitor_addresses | default([]) | selectattr('name', 'defined') | map(attribute='name') | list"
@@ -41,7 +41,7 @@
 
 - name: set_fact _monitor_addresses to monitor_interface - ipv6
   set_fact:
-    _monitor_addresses: "{{ _monitor_addresses | default([]) + [{ 'name': item, 'addr': hostvars[item]['ansible_facts'][(hostvars[item]['monitor_interface']|replace('-', '_'))][ip_version][0]['address'] | ansible.netcommon.ipwrap }] }}"
+    _monitor_addresses: "{{ _monitor_addresses | default([]) + [{ 'name': item, 'addr': hostvars[item]['ansible_facts'][(hostvars[item]['monitor_interface']|replace('-', '_'))][ip_version][0]['address'] | ansible.utils.ipwrap }] }}"
   with_items: "{{ groups.get(mon_group_name, []) }}"
   when:
     - "item not in _monitor_addresses | default([]) | selectattr('name', 'defined') | map(attribute='name') | list"
index 779e1916e75129b98eadd390d2a464a68dadd374..a2dc10584915a32842d1be9aa59807081e138a3d 100644 (file)
@@ -18,7 +18,7 @@
 
 - name: set_fact _radosgw_address to radosgw_address_block ipv6
   set_fact:
-    _radosgw_address: "{{ hostvars[inventory_hostname]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(hostvars[inventory_hostname]['radosgw_address_block'].split(',')) | last | ansible.netcommon.ipwrap }}"
+    _radosgw_address: "{{ hostvars[inventory_hostname]['ansible_facts']['all_ipv6_addresses'] | ips_in_ranges(hostvars[inventory_hostname]['radosgw_address_block'].split(',')) | last | ansible.utils.ipwrap }}"
   when:
     - radosgw_address_block is defined
     - radosgw_address_block != 'subnet'
@@ -26,7 +26,7 @@
 
 - name: set_fact _radosgw_address to radosgw_address
   set_fact:
-    _radosgw_address: "{{ radosgw_address | ansible.netcommon.ipwrap }}"
+    _radosgw_address: "{{ radosgw_address | ansible.utils.ipwrap }}"
   when:
     - radosgw_address is defined
     - radosgw_address != 'x.x.x.x'
@@ -53,7 +53,7 @@
 
     - name: set_fact _radosgw_address to radosgw_interface - ipv6
       set_fact:
-        _radosgw_address: "{{ hostvars[item]['ansible_facts'][_interface][ip_version][0]['address'] | ansible.netcommon.ipwrap }}"
+        _radosgw_address: "{{ hostvars[item]['ansible_facts'][_interface][ip_version][0]['address'] | ansible.utils.ipwrap }}"
       loop: "{{ groups.get(rgw_group_name, []) }}"
       delegate_to: "{{ item }}"
       delegate_facts: true
index 8c4fe99f31eae68490285a5a562d106f6d8565a3..5394e33e1623e0813060c449a33c937f00859e2c 100644 (file)
@@ -2,11 +2,11 @@
 testinfra
 pytest-xdist
 pytest
-ansible>=3,<4
+ansible>=2.10,<2.11,!=2.9.10
 Jinja2>=2.10
 netaddr
 mock
 jmespath
 pytest-rerunfailures
 pytest-cov
-six
\ No newline at end of file
+six
index e9b8bff4fc741ea57091252897165c200e577f80..207193e7570c3233f8a2ac61580eba0c2558147c 100644 (file)
@@ -30,6 +30,7 @@ setenv=
 deps= -r{toxinidir}/tests/requirements.txt
 changedir={toxinidir}/tests/functional/external_clients{env:CONTAINER_DIR:}
 commands=
+  ansible-galaxy install -r {toxinidir}/requirements.yml -v
   bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox}
   bash {toxinidir}/tests/scripts/generate_ssh_config.sh {changedir}
 
index 976f979d231d07de98141c16ce49f1f6d1102cb1..cafbb844409f6d3bed2a30e41930a9d7b10b8a76 100644 (file)
@@ -56,6 +56,7 @@ commands=
 
   pip uninstall -y ansible
   pip install -r {toxinidir}/tests/requirements.txt
+  ansible-galaxy install -r {toxinidir}/requirements.yml -v
 # upgrade mons
 # mon1
   ansible-playbook -vv -i {changedir}/{env:INVENTORY} {toxinidir}/infrastructure-playbooks/rolling_update.yml --limit mon1 --tags=mons --extra-vars "\
diff --git a/tox.ini b/tox.ini
index 20b1df9e326c756a5b5cf1a56368cc0b475a4c75..e514b771b3316a2c6c21656208128338bfc375cd 100644 (file)
--- a/tox.ini
+++ b/tox.ini
@@ -326,6 +326,7 @@ changedir=
   cephadm_adopt: {toxinidir}/tests/functional/all_daemons{env:CONTAINER_DIR:}
 
 commands=
+  ansible-galaxy install -r {toxinidir}/requirements.yml -v
   rhcs: ansible-playbook -vv -i "localhost," -c local {toxinidir}/tests/functional/rhcs_setup.yml --extra-vars "change_dir={changedir}" --tags "vagrant_setup"
 
   bash {toxinidir}/tests/scripts/vagrant_up.sh --no-provision {posargs:--provider=virtualbox}