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