Skip to content

Instantly share code, notes, and snippets.

@garystafford garystafford/tests.yml
Last active Jan 30, 2019

What would you like to do?
- name: Test gcpweb Ansible role
hosts: webservers
gather_facts: yes
# - name: List all ansible facts
# debug:
# msg: "{{ ansible_facts }}"
- name: Check if timezone is UTC
msg: Timezone is UTC
failed_when: ansible_facts['date_time']['tz'] != 'UTC'
- name: Check if processor vCPUs count is 1
msg: Processor vCPUs count is 1
failed_when: ansible_facts['processor_vcpus'] != 1
- name: Check if distribution is CentOS
msg: Distribution is CentOS
failed_when: ansible_facts['distribution'] != 'CentOS'
- name: Check if distribution major version is 7
msg: Distribution major version is 7
failed_when: ansible_facts['distribution_major_version'] != '7'
- name: Check if hostname contains 'web-'
msg: Hostname contains 'web-'
failed_when: "'web-' not in ansible_facts['hostname']"
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.