From b175c78c95c171771431c36b9bd62e4b39af49c5 Mon Sep 17 00:00:00 2001
From: Thomas Woerner <twoerner@redhat.com>
Date: Tue, 20 Dec 2022 13:55:19 +0100
Subject: [PATCH] vault: Use FQCN for ansible.builtin

Use Fully Qualified Collection Name (FQCN) for ansible builtins. This is
ansible.builtin.set_fact instead of set_fact for example and aplies for
all actions that are part of ansible.builtin.

All the replaced ansible.builtins:
  assert, command, copy, debug, fail, fetch, file, import_playbook,
  import_tasks, include_role, include_tasks, include_vars, package,
  set_fact, shell, slurp, stat, systemd
---
 .../vault/retrive-data-asymmetric-vault.yml   |  2 +-
 .../vault/retrive-data-symmetric-vault.yml    |  2 +-
 .../vault-is-present-with-password-file.yml   |  4 ++--
 .../vault-is-present-with-public-key-file.yml |  4 ++--
 tests/vault/env_cleanup.yml                   |  4 ++--
 tests/vault/env_setup.yml                     |  6 +++---
 tests/vault/tasks_vault_members.yml           |  4 ++--
 tests/vault/test_vault_asymmetric.yml         |  6 +++---
 tests/vault/test_vault_change_type.yml        | 20 +++++++++----------
 tests/vault/test_vault_client_context.yml     |  4 ++--
 tests/vault/test_vault_members.yml            |  2 +-
 tests/vault/test_vault_standard.yml           |  6 +++---
 tests/vault/test_vault_symmetric.yml          |  6 +++---
 13 files changed, 35 insertions(+), 35 deletions(-)

diff --git a/playbooks/vault/retrive-data-asymmetric-vault.yml b/playbooks/vault/retrive-data-asymmetric-vault.yml
index 35472d20..89359872 100644
--- a/playbooks/vault/retrive-data-asymmetric-vault.yml
+++ b/playbooks/vault/retrive-data-asymmetric-vault.yml
@@ -15,5 +15,5 @@
       register: result
       no_log: true
     - name: Display retrieved data.
-      debug:
+      ansible.builtin.debug:
         msg: "Data: {{ result.vault.data }}"
diff --git a/playbooks/vault/retrive-data-symmetric-vault.yml b/playbooks/vault/retrive-data-symmetric-vault.yml
index 98902a1b..a415d33d 100644
--- a/playbooks/vault/retrive-data-symmetric-vault.yml
+++ b/playbooks/vault/retrive-data-symmetric-vault.yml
@@ -15,5 +15,5 @@
       register: result
       no_log: true
     - name: Display retrieved data.
-      debug:
+      ansible.builtin.debug:
         msg: "Data: {{ result.vault.data }}"
diff --git a/playbooks/vault/vault-is-present-with-password-file.yml b/playbooks/vault/vault-is-present-with-password-file.yml
index c92e2a6b..aa1700ce 100644
--- a/playbooks/vault/vault-is-present-with-password-file.yml
+++ b/playbooks/vault/vault-is-present-with-password-file.yml
@@ -6,7 +6,7 @@
 
   tasks:
   - name: Copy file containing password to server.
-    copy:
+    ansible.builtin.copy:
       src: "{{ playbook_dir }}/password.txt"
       dest: "{{ ansible_facts['env'].HOME }}/password.txt"
       owner: "{{ ansible_user }}"
@@ -20,6 +20,6 @@
       vault_type: symmetric
       vault_password_file: "{{ ansible_facts['env'].HOME }}/password.txt"
   - name: Remove file containing password from server.
-    file:
+    ansible.builtin.file:
       path: "{{ ansible_facts['env'].HOME }}/password.txt"
       state: absent
diff --git a/playbooks/vault/vault-is-present-with-public-key-file.yml b/playbooks/vault/vault-is-present-with-public-key-file.yml
index cd1e7597..fbd6d7d9 100644
--- a/playbooks/vault/vault-is-present-with-public-key-file.yml
+++ b/playbooks/vault/vault-is-present-with-public-key-file.yml
@@ -11,7 +11,7 @@
 
   tasks:
   - name: Copy public key file to server.
-    copy:
+    ansible.builtin.copy:
       src: "{{ playbook_dir }}/public.pem"
       dest: "{{ ansible_facts['env'].HOME }}/public.pem"
       owner: "{{ ansible_user }}"
@@ -25,6 +25,6 @@
       vault_type: asymmetric
       vault_public_key_file: "{{ ansible_facts['env'].HOME }}/public.pem"
   - name: Remove public key file from server.
-    file:
+    ansible.builtin.file:
       path: "{{ ansible_facts['env'].HOME }}/public.pem"
       state: absent
diff --git a/tests/vault/env_cleanup.yml b/tests/vault/env_cleanup.yml
index 85f4d10c..c91ae409 100644
--- a/tests/vault/env_cleanup.yml
+++ b/tests/vault/env_cleanup.yml
@@ -41,7 +41,7 @@
       state: absent
 
   - name: Remove files from target host.
-    file:
+    ansible.builtin.file:
       path: "{{ ansible_facts['env'].HOME }}/{{ item }}"
       state: absent
     with_items:
@@ -58,7 +58,7 @@
     - out.txt
 
   - name: Remove files from controller.
-    file:
+    ansible.builtin.file:
       path: "{{ playbook_dir }}/{{ item }}"
       state: absent
     delegate_to: localhost
diff --git a/tests/vault/env_setup.yml b/tests/vault/env_setup.yml
index 69e9cb71..a1224549 100644
--- a/tests/vault/env_setup.yml
+++ b/tests/vault/env_setup.yml
@@ -1,10 +1,10 @@
 ---
   # Tasks executed to ensure a sane environment to test IPA Vault module.
   - name: Ensure environment is clean.
-    import_tasks: env_cleanup.yml
+    ansible.builtin.import_tasks: env_cleanup.yml
 
   - name: Create private/public key pair.
-    shell:
+    ansible.builtin.shell:
       cmd: |
         openssl genrsa -out "{{ item }}private.pem" 2048
         openssl rsa -in "{{ item }}private.pem" -outform PEM -pubout -out "{{ item }}public.pem"
@@ -17,7 +17,7 @@
     - B_
 
   - name: Copy files to target host.
-    copy:
+    ansible.builtin.copy:
       src: "{{ playbook_dir }}/{{ item }}"
       dest: "{{ ansible_facts['env'].HOME }}/{{ item }}"
       mode: 0644
diff --git a/tests/vault/tasks_vault_members.yml b/tests/vault/tasks_vault_members.yml
index d3af9347..a68d5aac 100644
--- a/tests/vault/tasks_vault_members.yml
+++ b/tests/vault/tasks_vault_members.yml
@@ -1,7 +1,7 @@
 ---
   # Tasks to test member management for Vault module.
   - name: Setup testing environment.
-    import_tasks: env_setup.yml
+    ansible.builtin.import_tasks: env_setup.yml
 
   - name: Ensure vault is present
     ipavault:
@@ -315,4 +315,4 @@
     failed_when: result.changed or result.failed
 
   - name: Cleanup testing environment.
-    import_tasks: env_cleanup.yml
+    ansible.builtin.import_tasks: env_cleanup.yml
diff --git a/tests/vault/test_vault_asymmetric.yml b/tests/vault/test_vault_asymmetric.yml
index a757e7fd..2790cf5e 100644
--- a/tests/vault/test_vault_asymmetric.yml
+++ b/tests/vault/test_vault_asymmetric.yml
@@ -7,7 +7,7 @@
 
   tasks:
   - name: Setup testing environment.
-    import_tasks: env_setup.yml
+    ansible.builtin.import_tasks: env_setup.yml
 
   - name: Ensure asymmetric vault is present
     ipavault:
@@ -165,7 +165,7 @@
     failed_when: result.changed or result.failed or (result.vault.data | default(false))
 
   - name: Verify retrieved data.
-    slurp:
+    ansible.builtin.slurp:
       src: "{{ ansible_facts['env'].HOME }}/data.txt"
     register: slurpfile
     failed_when: slurpfile['content'] | b64decode != 'Hello World.'
@@ -299,4 +299,4 @@
     failed_when: result.changed or result.failed
 
   - name: Cleanup testing environment.
-    import_tasks: env_cleanup.yml
+    ansible.builtin.import_tasks: env_cleanup.yml
diff --git a/tests/vault/test_vault_change_type.yml b/tests/vault/test_vault_change_type.yml
index 8490a2c9..a5fb0c8b 100644
--- a/tests/vault/test_vault_change_type.yml
+++ b/tests/vault/test_vault_change_type.yml
@@ -7,7 +7,7 @@
 
   tasks:
   - name: Setup testing environment.
-    import_tasks: env_setup.yml
+    ansible.builtin.import_tasks: env_setup.yml
 
   - name: Ensure test_vault is absent.
     ipavault:
@@ -42,7 +42,7 @@
       failed_when: result.failed or not result.changed
 
     - name: Verify assymetric-only fields are not present.
-      shell: |
+      ansible.builtin.shell: |
          echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin
          KRB5CCNAME={{ krb5ccname }} ipa vault-show test_vault
          kdestroy -A -q -c {{ krb5ccname }}
@@ -63,7 +63,7 @@
       failed_when: result.failed or not result.changed
 
     - name: Verify salt is not present.
-      shell: |
+      ansible.builtin.shell: |
          echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin
          KRB5CCNAME={{ krb5ccname }} ipa vault-show test_vault
          kdestroy -A -q -c {{ krb5ccname }}
@@ -94,7 +94,7 @@
       failed_when: result.failed or not result.changed
 
     - name: Verify salt is not present.
-      shell: |
+      ansible.builtin.shell: |
          echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin
          KRB5CCNAME={{ krb5ccname }} ipa vault-show test_vault
          kdestroy -A -q -c {{ krb5ccname }}
@@ -115,7 +115,7 @@
       failed_when: result.failed or not result.changed
 
     - name: Verify assymetric-only fields are not present.
-      shell: |
+      ansible.builtin.shell: |
          echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin
          KRB5CCNAME={{ krb5ccname }} ipa vault-show test_vault
          kdestroy -A -q -c {{ krb5ccname }}
@@ -168,7 +168,7 @@
       failed_when: result.failed or not result.changed
 
     - name: Verify assymetric-only fields are not present.
-      shell: |
+      ansible.builtin.shell: |
          echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin
          KRB5CCNAME={{ krb5ccname }} ipa vault-show test_vault
          kdestroy -A -q -c {{ krb5ccname }}
@@ -198,7 +198,7 @@
       failed_when: result.failed or not result.changed
 
     - name: Verify salt is not present.
-      shell: |
+      ansible.builtin.shell: |
          echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin
          KRB5CCNAME={{ krb5ccname }} ipa vault-show test_vault
          kdestroy -A -q -c {{ krb5ccname }}
@@ -246,7 +246,7 @@
       failed_when: result.failed or not result.changed
 
     - name: Verify salt is not present.
-      shell: |
+      ansible.builtin.shell: |
          echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin
          KRB5CCNAME={{ krb5ccname }} ipa vault-show test_vault
          kdestroy -A -q -c {{ krb5ccname }}
@@ -276,7 +276,7 @@
       failed_when: result.failed or not result.changed or result.failed
 
     - name: Verify assymetric-only fields are not present.
-      shell: |
+      ansible.builtin.shell: |
          echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin
          KRB5CCNAME={{ krb5ccname }} ipa vault-show test_vault
          kdestroy -A -q -c {{ krb5ccname }}
@@ -301,4 +301,4 @@
       state: absent
 
   - name: Cleanup testing environment.
-    import_tasks: env_cleanup.yml
+    ansible.builtin.import_tasks: env_cleanup.yml
diff --git a/tests/vault/test_vault_client_context.yml b/tests/vault/test_vault_client_context.yml
index 2ebb410e..7f6fa452 100644
--- a/tests/vault/test_vault_client_context.yml
+++ b/tests/vault/test_vault_client_context.yml
@@ -7,7 +7,7 @@
 
   tasks:
   - name: Setup testing environment.
-    import_tasks: env_setup.yml
+    ansible.builtin.import_tasks: env_setup.yml
 
   # vault requires 'ipaapi_context: client', and uses this
   # context by defoult, so we test only for the case where
@@ -22,4 +22,4 @@
     failed_when: not (result.failed and result.msg is regex("Context 'server' for ipavault not yet supported."))
 
   - name: Cleanup testing environment.
-    import_tasks: env_cleanup.yml
+    ansible.builtin.import_tasks: env_cleanup.yml
diff --git a/tests/vault/test_vault_members.yml b/tests/vault/test_vault_members.yml
index 219236ae..eb22e78e 100644
--- a/tests/vault/test_vault_members.yml
+++ b/tests/vault/test_vault_members.yml
@@ -7,7 +7,7 @@
 
   tasks:
   - name: Test vault module member operations.
-    include_tasks:
+    ansible.builtin.include_tasks:
       file: tasks_vault_members.yml
       apply:
         tags:
diff --git a/tests/vault/test_vault_standard.yml b/tests/vault/test_vault_standard.yml
index 67aca203..c828d1bf 100644
--- a/tests/vault/test_vault_standard.yml
+++ b/tests/vault/test_vault_standard.yml
@@ -7,7 +7,7 @@
 
   tasks:
   - name: Setup testing environment.
-    import_tasks: env_setup.yml
+    ansible.builtin.import_tasks: env_setup.yml
 
   - name: Ensure standard vault is present
     ipavault:
@@ -67,7 +67,7 @@
     failed_when: result.changed or result.failed or (result.vault.data | default(false))
 
   - name: Verify retrieved data.
-    slurp:
+    ansible.builtin.slurp:
       src: "{{ ansible_facts['env'].HOME }}/data.txt"
     register: slurpfile
     failed_when: slurpfile['content'] | b64decode != 'Hello World.'
@@ -138,4 +138,4 @@
     failed_when: result.changed or result.failed
 
   - name: Cleanup testing environment.
-    import_tasks: env_cleanup.yml
+    ansible.builtin.import_tasks: env_cleanup.yml
diff --git a/tests/vault/test_vault_symmetric.yml b/tests/vault/test_vault_symmetric.yml
index 0ae79349..89ee1424 100644
--- a/tests/vault/test_vault_symmetric.yml
+++ b/tests/vault/test_vault_symmetric.yml
@@ -7,7 +7,7 @@
 
   tasks:
   - name: Setup testing environment.
-    import_tasks: env_setup.yml
+    ansible.builtin.import_tasks: env_setup.yml
 
   - name: Ensure symmetric vault is present
     ipavault:
@@ -74,7 +74,7 @@
     failed_when: result.changed or result.failed or (result.vault.data | default(false))
 
   - name: Verify retrieved data.
-    slurp:
+    ansible.builtin.slurp:
       src: "{{ ansible_facts['env'].HOME }}/data.txt"
     register: slurpfile
     failed_when: slurpfile['content'] | b64decode != 'Hello World.'
@@ -351,4 +351,4 @@
     failed_when: result.failed or not result.changed
 
   - name: Cleanup testing environment.
-    import_tasks: env_cleanup.yml
+    ansible.builtin.import_tasks: env_cleanup.yml
-- 
GitLab