Skip to content
Snippets Groups Projects
Select Git revision
  • d0287f90cd078a01c518dc7a2bbd65b1754fb405
  • master default protected
  • v1.14.7
  • v1.14.6
  • v1.14.5
  • v1.14.4
  • v1.14.3
  • v1.14.2
  • v1.14.1
  • v1.14.0
  • v1.13.2
  • v1.13.1
  • v1.13.0
  • v1.12.1
  • v1.12.0
  • v1.11.1
  • v1.11.0
  • v1.10.0
  • v1.9.2
  • v1.9.1
  • v1.9.0
  • v1.8.4
22 results

test_host.yml

Blame
    • Rafael Guterres Jeffman's avatar
      d0287f90
      ipahost: Allow execution of plugin in client host. · d0287f90
      Rafael Guterres Jeffman authored
      Update host README file and add tests for executing plugin with
      `ipaapi_context` set to `client`.
      
      A new test playbook can be found at:
      
          tests/host/test_host_client_context.yml
      
      The new test file can be executed in a FreeIPA client host that is
      not a server. In this case, it should be defined in the `ipaclients`
      group, in the inventory file.
      d0287f90
      History
      ipahost: Allow execution of plugin in client host.
      Rafael Guterres Jeffman authored
      Update host README file and add tests for executing plugin with
      `ipaapi_context` set to `client`.
      
      A new test playbook can be found at:
      
          tests/host/test_host_client_context.yml
      
      The new test file can be executed in a FreeIPA client host that is
      not a server. In this case, it should be defined in the `ipaclients`
      group, in the inventory file.
    test_host.yml 7.07 KiB
    ---
    - name: Test host
      hosts: "{{ ipa_test_host | default('ipaserver') }}"
      become: true
    
      tasks:
      - name: Get Domain from server name
        set_fact:
          ipaserver_domain: "{{ ansible_facts['fqdn'].split('.')[1:] | join ('.') }}"
        when: ipaserver_domain is not defined
    
      - name: Set host1_fqdn .. host6_fqdn
        set_fact:
          host1_fqdn: "{{ 'host1.' + ipaserver_domain }}"
          host2_fqdn: "{{ 'host2.' + ipaserver_domain }}"
          host3_fqdn: "{{ 'host3.' + ipaserver_domain }}"
          host4_fqdn: "{{ 'host4.' + ipaserver_domain }}"
          host5_fqdn: "{{ 'host5.' + ipaserver_domain }}"
          host6_fqdn: "{{ 'host6.' + ipaserver_domain }}"
    
      - name: Host absent
        ipahost:
          ipaadmin_password: SomeADMINpassword
          ipaapi_context: "{{ ipa_context | default(omit) }}"
          name:
          - "{{ host1_fqdn }}"
          - "{{ host2_fqdn }}"
          - "{{ host3_fqdn }}"
          - "{{ host4_fqdn }}"
          - "{{ host5_fqdn }}"
          - "{{ host6_fqdn }}"
          update_dns: yes
          state: absent
    
      - name: Get IPv4 address prefix from server node
        set_fact:
          ipv4_prefix: "{{ ansible_facts['default_ipv4'].address.split('.')[:-1] |
                           join('.') }}"
    
      - name: Host "{{ host1_fqdn }}" present
        ipahost:
          ipaadmin_password: SomeADMINpassword
          ipaapi_context: "{{ ipa_context | default(omit) }}"
          name: "{{ host1_fqdn }}"
          ip_address: "{{ ipv4_prefix + '.201' }}"
          update_dns: yes
          reverse: no
        register: result
        failed_when: not result.changed or result.failed
    
      - name: Host "{{ host1_fqdn }}" present again
        ipahost:
          ipaadmin_password: SomeADMINpassword
          ipaapi_context: "{{ ipa_context | default(omit) }}"
          name: "{{ host1_fqdn }}"
          ip_address: "{{ ipv4_prefix + '.201' }}"
          update_dns: yes
          reverse: no
        register: result
        failed_when: result.changed or result.failed
    
      - name: Host "{{ host2_fqdn }}" present
        ipahost:
          ipaadmin_password: SomeADMINpassword
          ipaapi_context: "{{ ipa_context | default(omit) }}"
          name: "{{ host2_fqdn }}"
          ip_address: "{{ ipv4_prefix + '.202' }}"
          update_dns: yes
          reverse: no
        register: result