Skip to content
Snippets Groups Projects
Select Git revision
  • 876d4de6be683e375aec798f1ce02c205b847eca
  • master default protected
  • v2.28.0
  • v2.27.0
  • v2.25.1
  • v2.24.3
  • v2.26.0
  • v2.24.2
  • v2.25.0
  • v2.24.1
  • v2.22.2
  • v2.23.3
  • v2.24.0
  • v2.23.2
  • v2.23.1
  • v2.23.0
  • v2.22.1
  • v2.22.0
  • v2.21.0
  • v2.20.0
  • v2.19.1
  • v2.18.2
22 results

macvlan.md

Blame
  • test_host_random.yml 3.63 KiB
    ---
    - name: Test ipahost random password generation
      hosts: ipaserver
      become: true
    
      tasks:
      - name: Get Domain from server name
        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
        ansible.builtin.set_fact:
          host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
          host2_fqdn: "{{ 'host2.' + ipaserver_domain }}"
          server_fqdn: "{{ ansible_facts['fqdn'] }}"
    
      - name: Test hosts absent
        ipahost:
          ipaadmin_password: SomeADMINpassword
          name:
          - "{{ host1_fqdn }}"
          - "{{ host2_fqdn }}"
          update_dns: yes
          state: absent
    
      - name: Host "{{ host1_fqdn }}" present with random password
        ipahost:
          ipaadmin_password: SomeADMINpassword
          name: "{{ host1_fqdn }}"
          random: yes
          force: yes
          update_password: on_create
        register: ipahost
        failed_when: not ipahost.changed or ipahost.failed
    
      - name: Assert ipahost.host.randompassword is defined.
        ansible.builtin.assert:
          that:
          - ipahost.host.randompassword is defined
    
      - name: Print generated random password
        ansible.builtin.debug:
          var: ipahost.host.randompassword
    
      - name: Host "{{ host1_fqdn }}" absent
        ipahost:
          ipaadmin_password: SomeADMINpassword
          name:
          - "{{ host1_fqdn }}"
          state: absent
    
      - name: Host "{{ host1_fqdn }}" is present with random password using hosts parameter
        ipahost:
          ipaadmin_password: SomeADMINpassword
          hosts:
          - name: "{{ host1_fqdn }}"
            random: yes
            force: yes
          update_password: on_create
        register: ipahost
        failed_when: not ipahost.changed or
                     ipahost.host[host1_fqdn].randompassword is not defined or
                     ipahost.failed
    
      - name: Host "{{ host1_fqdn }}" absent
        ipahost:
          ipaadmin_password: SomeADMINpassword
          name:
          - "{{ host1_fqdn }}"