host*: 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
This commit is contained in:
Thomas Woerner
2022-12-20 13:50:23 +01:00
parent d546b4614d
commit 473ed03e26
24 changed files with 61 additions and 61 deletions

View File

@@ -14,5 +14,5 @@
register: ipahost
- name: Print generated random password
debug:
ansible.builtin.debug:
var: ipahost.host.randompassword

View File

@@ -13,5 +13,5 @@
register: ipahost
- name: Print generated random password
debug:
ansible.builtin.debug:
var: ipahost.host.randompassword

View File

@@ -17,9 +17,9 @@
register: ipahost
- name: Print generated random password for host01.example.com
debug:
ansible.builtin.debug:
var: ipahost.host["host01.example.com"].randompassword
- name: Print generated random password for host02.example.com
debug:
ansible.builtin.debug:
var: ipahost.host["host02.example.com"].randompassword

View File

@@ -5,12 +5,12 @@
tasks:
- name: Get Domain from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
- name: Generate self-signed certificates.
shell:
ansible.builtin.shell:
cmd: |
openssl req -x509 -newkey rsa:2048 -days 365 -nodes -keyout "private{{ item }}.key" -out "cert{{ item }}.pem" -subj '/CN=test'
openssl x509 -outform der -in "cert{{ item }}.pem" -out "cert{{ item }}.der"
@@ -100,7 +100,7 @@
failed_when: result.changed or result.failed
- name: Remove certificate files. # noqa: deprecated-command-syntax
shell:
ansible.builtin.shell:
cmd: rm -f "private{{ item }}.key" "cert{{ item }}.pem" "cert{{ item }}.der" "cert{{ item }}.b64"
with_items: [1, 2, 3]
become: no

View File

@@ -5,7 +5,7 @@
tasks:
- name: Get Domain from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
@@ -26,7 +26,7 @@
failed_when: not result.changed or result.failed
- name: Generate self-signed certificates.
shell:
ansible.builtin.shell:
cmd: |
openssl req -x509 -newkey rsa:2048 -days 365 -nodes -keyout "private{{ item }}.key" -out "cert{{ item }}.pem" -subj '/CN=test'
openssl x509 -outform der -in "cert{{ item }}.pem" -out "cert{{ item }}.der"
@@ -99,7 +99,7 @@
failed_when: not result.changed or result.failed
- name: Remove certificate files. # noqa: deprecated-command-syntax
shell:
ansible.builtin.shell:
cmd: rm -f "private{{ item }}.key" "cert{{ item }}.pem" "cert{{ item }}.der" "cert{{ item }}.b64"
with_items: [1, 2, 3]
become: no

View File

@@ -5,12 +5,12 @@
tasks:
- name: Get Domain from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
- name: Set host1_fqdn .. host6_fqdn
set_fact:
ansible.builtin.set_fact:
host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
host2_fqdn: "{{ 'host2.' + ipaserver_domain }}"
host3_fqdn: "{{ 'host3.' + ipaserver_domain }}"
@@ -33,7 +33,7 @@
state: absent
- name: Get IPv4 address prefix from server node
set_fact:
ansible.builtin.set_fact:
ipv4_prefix: "{{ ansible_facts['default_ipv4'].address.split('.')[:-1] |
join('.') }}"

View File

@@ -5,17 +5,17 @@
tasks:
- name: Get Domain from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
- name: Get Realm from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_realm: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') | upper }}"
when: ipaserver_realm is not defined
- name: Set host1_fqdn .. host3_fqdn
set_fact:
ansible.builtin.set_fact:
host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
host2_fqdn: "{{ 'host2.' + ipaserver_domain }}"
host3_fqdn: "{{ 'host3.' + ipaserver_domain }}"

View File

@@ -5,17 +5,17 @@
tasks:
- name: Get Domain from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
- name: Get Realm from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_realm: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') | upper }}"
when: ipaserver_realm is not defined
- name: Set host1_fqdn .. host3_fqdn
set_fact:
ansible.builtin.set_fact:
host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
host2_fqdn: "{{ 'host2.' + ipaserver_domain }}"
host3_fqdn: "{{ 'host3.' + ipaserver_domain }}"

View File

@@ -5,12 +5,12 @@
tasks:
- name: Get Domain from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
- name: Set host1_fqdn .. host6_fqdn
set_fact:
ansible.builtin.set_fact:
host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
- name: Host absent

View File

@@ -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 automember using client context, in client host.
import_playbook: test_host.yml
ansible.builtin.import_playbook: test_host.yml
when: groups['ipaclients']
vars:
ipa_test_host: ipaclients
- name: Test automember using client context, in server host.
import_playbook: test_host.yml
ansible.builtin.import_playbook: test_host.yml
when: groups['ipaclients'] is not defined or not groups['ipaclients']
vars:
ipa_context: client

View File

@@ -6,12 +6,12 @@
tasks:
- name: Get Domain from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
- name: Set host1_fqdn .. host6_fqdn
set_fact:
ansible.builtin.set_fact:
host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
# CLEANUP TEST ITEMS

View File

@@ -5,18 +5,18 @@
tasks:
- name: Get Domain from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
- name: Set host1_fqdn .. host6_fqdn
set_fact:
ansible.builtin.set_fact:
host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
host2_fqdn: "{{ 'host2.' + ipaserver_domain }}"
host3_fqdn: "{{ 'host3.' + ipaserver_domain }}"
- name: Get IPv4 address prefix from server node
set_fact:
ansible.builtin.set_fact:
ipv4_prefix: "{{ ansible_facts['default_ipv4'].address.split('.')[:-1] |
join('.') }}"

View File

@@ -5,12 +5,12 @@
tasks:
- name: Get Domain from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
- name: Set host1_fqdn .. host2_fqdn
set_fact:
ansible.builtin.set_fact:
host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
host2_fqdn: "{{ 'host2.' + ipaserver_domain }}"

View File

@@ -5,17 +5,17 @@
tasks:
- name: Get Domain from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
- name: Get Realm from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_realm: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') | upper }}"
when: ipaserver_realm is not defined
- name: Set host1_fqdn
set_fact:
ansible.builtin.set_fact:
host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
- name: Host host1 absent

View File

@@ -5,12 +5,12 @@
tasks:
- name: Get Domain from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
- name: Set host1_fqdn and host2_fqdn
set_fact:
ansible.builtin.set_fact:
host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
host2_fqdn: "{{ 'host2.' + ipaserver_domain }}"
@@ -34,12 +34,12 @@
failed_when: not ipahost.changed or ipahost.failed
- name: Assert ipahost.host.randompassword is defined.
assert:
ansible.builtin.assert:
that:
- ipahost.host.randompassword is defined
- name: Print generated random password
debug:
ansible.builtin.debug:
var: ipahost.host.randompassword
- name: Host "{{ host1_fqdn }}" absent
@@ -64,7 +64,7 @@
failed_when: not ipahost.changed or ipahost.failed
- name: Assert randompassword is defined for host1 and host2.
assert:
ansible.builtin.assert:
that:
- ipahost.host["{{ host1_fqdn }}"].randompassword is
defined
@@ -72,11 +72,11 @@
defined
- name: Print generated random password for "{{ host1_fqdn }}"
debug:
ansible.builtin.debug:
var: ipahost.host["{{ host1_fqdn }}"].randompassword
- name: Print generated random password for "{{ host2_fqdn }}"
debug:
ansible.builtin.debug:
var: ipahost.host["{{ host2_fqdn }}"].randompassword
- name: Enrolled host "{{ ansible_facts['fqdn'] }}" fails to set random password with update_password always
@@ -90,7 +90,7 @@
failed_when: ipahost.changed or not ipahost.failed
- name: Assert randompassword is not defined for 'ansible_fqdn'.
assert:
ansible.builtin.assert:
that:
- ipahost.host["{{ ansible_facts['fqdn'] }}"].randompassword is
not defined

View File

@@ -5,12 +5,12 @@
tasks:
- name: Get Domain from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
- name: Set host1_fqdn
set_fact:
ansible.builtin.set_fact:
host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
- name: Host absent
@@ -22,12 +22,12 @@
state: absent
- name: Get IPv4 address prefix from server node
set_fact:
ansible.builtin.set_fact:
ipv4_prefix: "{{ ansible_facts['default_ipv4'].address.split('.')[:-1] |
join('.') }}"
- name: Set zone prefixes.
set_fact:
ansible.builtin.set_fact:
zone_ipv6_reverse: "ip6.arpa."
zone_ipv6_reverse_workaround: "d.f.ip6.arpa."
zone_prefix_reverse: "in-addr.arpa"

View File

@@ -5,12 +5,12 @@
tasks:
- name: Get Domain from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
- name: Set host1_fqdn
set_fact:
ansible.builtin.set_fact:
host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
- name: Host host1 absent

View File

@@ -5,12 +5,12 @@
tasks:
- name: Get Domain from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
- name: Set host1_fqdn .. host6_fqdn
set_fact:
ansible.builtin.set_fact:
host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
host2_fqdn: "{{ 'host2.' + ipaserver_domain }}"
host3_fqdn: "{{ 'host3.' + ipaserver_domain }}"

View File

@@ -5,12 +5,12 @@
tasks:
- name: Get Domain from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
- name: Set host1_fqdn .. host5_fqdn
set_fact:
ansible.builtin.set_fact:
host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
host2_fqdn: "{{ 'host2.' + ipaserver_domain }}"
host3_fqdn: "{{ 'host3.' + ipaserver_domain }}"

View File

@@ -5,17 +5,17 @@
tasks:
- name: Get Domain from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined
- name: Get Realm from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_realm: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') | upper }}"
when: ipaserver_realm is not defined
- name: Set host1_fqdn .. host2_fqdn
set_fact:
ansible.builtin.set_fact:
host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
host2_fqdn: "{{ 'host2.' + ipaserver_domain }}"

View File

@@ -6,7 +6,7 @@
tasks:
- name: Get Domain from server name
set_fact:
ansible.builtin.set_fact:
ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
when: ipaserver_domain is not defined

View File

@@ -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 hostgroup using client context, in client host.
import_playbook: test_hostgroup.yml
ansible.builtin.import_playbook: test_hostgroup.yml
when: groups['ipaclients']
vars:
ipa_test_host: ipaclients
- name: Test hostgroup using client context, in server host.
import_playbook: test_hostgroup.yml
ansible.builtin.import_playbook: test_hostgroup.yml
when: groups['ipaclients'] is not defined or not groups['ipaclients']
vars:
ipa_context: client

View File

@@ -5,7 +5,7 @@
gather_facts: false
tasks:
- include_tasks: ../env_freeipa_facts.yml
- ansible.builtin.include_tasks: ../env_freeipa_facts.yml
- name: Tests requiring IPA version 4.8.4+
block:

View File

@@ -5,7 +5,7 @@
gather_facts: false
tasks:
- include_tasks: ../env_freeipa_facts.yml
- ansible.builtin.include_tasks: ../env_freeipa_facts.yml
- name: Tests requiring IPA version 4.8.7+
block: