Skip to content
Snippets Groups Projects
Commit f2a0edeb authored by Thomas Woerner's avatar Thomas Woerner
Browse files

role: 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
parent 45baf5c1
No related branches found
No related tags found
No related merge requests found
--- ---
- block: - block:
- name: Get Domain from server name - name: Get Domain from server name
set_fact: ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}" ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: "'fqdn' in ansible_facts" when: "'fqdn' in ansible_facts"
- name: Set Domain to 'ipa.test' if FQDN could not be retrieved. - name: Set Domain to 'ipa.test' if FQDN could not be retrieved.
set_fact: ansible.builtin.set_fact:
ipaserver_domain: "ipa.test" ipaserver_domain: "ipa.test"
when: "'fqdn' not in ansible_facts" when: "'fqdn' not in ansible_facts"
when: ipaserver_domain is not defined when: ipaserver_domain is not defined
- name: Set ipaserver_realm. - name: Set ipaserver_realm.
set_fact: ansible.builtin.set_fact:
ipaserver_realm: "{{ ipaserver_domain | upper }}" ipaserver_realm: "{{ ipaserver_domain | upper }}"
when: ipaserver_realm is not defined when: ipaserver_realm is not defined
- name: Create FQDN for host01 - name: Create FQDN for host01
set_fact: ansible.builtin.set_fact:
host1_fqdn: "host01.{{ ipaserver_domain }}" host1_fqdn: "host01.{{ ipaserver_domain }}"
host2_fqdn: "host02.{{ ipaserver_domain }}" host2_fqdn: "host02.{{ ipaserver_domain }}"
--- ---
- name: Cleanup environment. - name: Cleanup environment.
import_tasks: env_cleanup.yml ansible.builtin.import_tasks: env_cleanup.yml
- name: Ensure test user is present. - name: Ensure test user is present.
ipauser: ipauser:
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
tasks: tasks:
- name: Set environment facts. - name: Set environment facts.
import_tasks: env_facts.yml ansible.builtin.import_tasks: env_facts.yml
- name: Setup environment. - name: Setup environment.
import_tasks: env_setup.yml ansible.builtin.import_tasks: env_setup.yml
# tests # tests
- name: Ensure role is present. - name: Ensure role is present.
...@@ -424,4 +424,4 @@ ...@@ -424,4 +424,4 @@
# cleanup # cleanup
- name: Cleanup environment. - name: Cleanup environment.
include_tasks: env_cleanup.yml ansible.builtin.include_tasks: env_cleanup.yml
...@@ -6,7 +6,7 @@ ...@@ -6,7 +6,7 @@
tasks: tasks:
- name: Include FreeIPA facts. - name: Include FreeIPA facts.
include_tasks: ../env_freeipa_facts.yml ansible.builtin.include_tasks: ../env_freeipa_facts.yml
# Test will only be executed if host is not a server. # Test will only be executed if host is not a server.
- name: Execute with server context in the client. - name: Execute with server context in the client.
...@@ -27,13 +27,13 @@ ...@@ -27,13 +27,13 @@
# in upstream CI. # in upstream CI.
- name: Test role using client context, in client host. - name: Test role using client context, in client host.
import_playbook: test_role.yml ansible.builtin.import_playbook: test_role.yml
when: groups['ipaclients'] when: groups['ipaclients']
vars: vars:
ipa_test_host: ipaclients ipa_test_host: ipaclients
- name: Test role using client context, in server host. - name: Test role using client context, in server host.
import_playbook: test_role.yml ansible.builtin.import_playbook: test_role.yml
when: groups['ipaclients'] is not defined or not groups['ipaclients'] when: groups['ipaclients'] is not defined or not groups['ipaclients']
vars: vars:
ipa_context: client ipa_context: client
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
tasks: tasks:
- name: Set environment facts. - name: Set environment facts.
import_tasks: env_facts.yml ansible.builtin.import_tasks: env_facts.yml
- name: Setup environment. - name: Setup environment.
import_tasks: env_setup.yml ansible.builtin.import_tasks: env_setup.yml
- name: Add role. - name: Add role.
iparole: iparole:
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
failed_when: result.failed or not result.changed failed_when: result.failed or not result.changed
- name: Verify role privileges. - name: Verify role privileges.
shell: ansible.builtin.shell:
cmd: | cmd: |
echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin
KRB5CCNAME={{ krb5ccname }} ipa role-show testrole KRB5CCNAME={{ krb5ccname }} ipa role-show testrole
...@@ -71,7 +71,7 @@ ...@@ -71,7 +71,7 @@
failed_when: result.failed or not result.changed failed_when: result.failed or not result.changed
- name: Verify role users. - name: Verify role users.
shell: ansible.builtin.shell:
cmd: | cmd: |
echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin
KRB5CCNAME={{ krb5ccname }} ipa role-show testrole KRB5CCNAME={{ krb5ccname }} ipa role-show testrole
...@@ -95,7 +95,7 @@ ...@@ -95,7 +95,7 @@
failed_when: result.failed or not result.changed failed_when: result.failed or not result.changed
- name: Verify role group. - name: Verify role group.
shell: ansible.builtin.shell:
cmd: | cmd: |
echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin
KRB5CCNAME={{ krb5ccname }} ipa role-show testrole KRB5CCNAME={{ krb5ccname }} ipa role-show testrole
...@@ -119,7 +119,7 @@ ...@@ -119,7 +119,7 @@
failed_when: result.failed or not result.changed failed_when: result.failed or not result.changed
- name: Verify role hosts. - name: Verify role hosts.
shell: ansible.builtin.shell:
cmd: | cmd: |
echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin
KRB5CCNAME={{ krb5ccname }} ipa role-show testrole KRB5CCNAME={{ krb5ccname }} ipa role-show testrole
...@@ -145,7 +145,7 @@ ...@@ -145,7 +145,7 @@
failed_when: result.failed or not result.changed failed_when: result.failed or not result.changed
- name: Verify role hostgroups. - name: Verify role hostgroups.
shell: ansible.builtin.shell:
cmd: | cmd: |
echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin
KRB5CCNAME={{ krb5ccname }} ipa role-show testrole KRB5CCNAME={{ krb5ccname }} ipa role-show testrole
...@@ -169,7 +169,7 @@ ...@@ -169,7 +169,7 @@
failed_when: result.failed or not result.changed failed_when: result.failed or not result.changed
- name: Verify role services. - name: Verify role services.
shell: ansible.builtin.shell:
cmd: | cmd: |
echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin
KRB5CCNAME={{ krb5ccname }} ipa role-show testrole KRB5CCNAME={{ krb5ccname }} ipa role-show testrole
...@@ -197,7 +197,7 @@ ...@@ -197,7 +197,7 @@
failed_when: result.failed or not result.changed failed_when: result.failed or not result.changed
- name: Verify role services. - name: Verify role services.
shell: ansible.builtin.shell:
cmd: | cmd: |
echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin
KRB5CCNAME={{ krb5ccname }} ipa role-show testrole KRB5CCNAME={{ krb5ccname }} ipa role-show testrole
...@@ -225,7 +225,7 @@ ...@@ -225,7 +225,7 @@
failed_when: result.failed or not result.changed failed_when: result.failed or not result.changed
- name: Verify role services. - name: Verify role services.
shell: ansible.builtin.shell:
cmd: | cmd: |
echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin echo SomeADMINpassword | kinit -c {{ krb5ccname }} admin
KRB5CCNAME={{ krb5ccname }} ipa role-show testrole KRB5CCNAME={{ krb5ccname }} ipa role-show testrole
...@@ -256,4 +256,4 @@ ...@@ -256,4 +256,4 @@
# cleanup # cleanup
- name: Cleanup environment. - name: Cleanup environment.
include_tasks: env_cleanup.yml ansible.builtin.include_tasks: env_cleanup.yml
...@@ -22,7 +22,7 @@ ...@@ -22,7 +22,7 @@
- MySVC/host01 - MySVC/host01
tasks: tasks:
- include_tasks: ../env_freeipa_facts.yml - ansible.builtin.include_tasks: ../env_freeipa_facts.yml
- block: - block:
# setup # setup
......
...@@ -6,10 +6,10 @@ ...@@ -6,10 +6,10 @@
tasks: tasks:
- name: Set environment facts. - name: Set environment facts.
import_tasks: env_facts.yml ansible.builtin.import_tasks: env_facts.yml
- name: Setup environment. - name: Setup environment.
import_tasks: env_setup.yml ansible.builtin.import_tasks: env_setup.yml
# tests # tests
...@@ -92,4 +92,4 @@ ...@@ -92,4 +92,4 @@
# cleanup # cleanup
- name: Cleanup environment. - name: Cleanup environment.
include_tasks: env_cleanup.yml ansible.builtin.include_tasks: env_cleanup.yml
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment