Created
November 15, 2013 13:16
-
-
Save resmo/7484178 to your computer and use it in GitHub Desktop.
ansible host module testing playbook
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
--- | |
- hosts: localhost | |
connection: local | |
gather_facts: no | |
remote_user: root | |
tasks: | |
- name: test add a record | |
host: hostname=foobar ip=192.168.123.1 | |
register: result | |
failed_when: not result.changed | |
- name: test error handling only hostname given on present | |
host: hostname=foobar | |
register: result | |
failed_when: result.changed | |
- name: test error handling only ip given on present | |
host: ip=192.168.123.1 | |
register: result | |
failed_when: result.changed | |
- name: test record exists | |
host: hostname=foobar ip=192.168.123.1 | |
register: result | |
failed_when: result.changed | |
- name: test remove record using hostname | |
host: hostname=foobar state=absent | |
register: result | |
failed_when: not result.changed | |
- name: test remove not existing record using hostname | |
host: hostname=foobar state=absent | |
register: result | |
failed_when: result.changed | |
- name: test add a record again | |
host: hostname=foobar ip=192.168.123.1 | |
register: result | |
failed_when: not result.changed | |
- name: test remove record using ip | |
host: ip=192.168.123.1 state=absent | |
register: result | |
failed_when: not result.changed | |
- name: test remove not existing record using ip | |
host: ip=192.168.123.1 state=absent | |
register: result | |
failed_when: result.changed | |
- name: test add a record with alias | |
host: hostname=foobar ip=192.168.123.1 aliases=foobar.com,foobar.net | |
register: result | |
failed_when: not result.changed | |
- name: test add an existing record with alias | |
host: hostname=foobar ip=192.168.123.1 aliases=foobar.com,foobar.net | |
register: result | |
failed_when: result.changed | |
- name: test add an existing record with changed alias | |
host: hostname=foobar ip=192.168.123.1 aliases=foobar.net,foobar.com | |
register: result | |
failed_when: not result.changed | |
- name: test remove aliases from existing record | |
host: hostname=foobar ip=192.168.123.1 | |
register: result | |
failed_when: not result.changed | |
- name: test add aliases for existing record | |
host: hostname=foobar ip=192.168.123.1 aliases=foobar.net,foobar.com | |
register: result | |
failed_when: not result.changed | |
- name: test change ip on existing record | |
host: hostname=foobar ip=192.168.123.2 | |
register: result | |
failed_when: not result.changed | |
- name: test change hostname on existing record | |
host: hostname=barfoo ip=192.168.123.2 | |
register: result | |
failed_when: not result.changed |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment