Skip to content

Instantly share code, notes, and snippets.

@garystafford
Last active January 30, 2019 02:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save garystafford/75d79de362f523016885e6a10b7f9c06 to your computer and use it in GitHub Desktop.
Save garystafford/75d79de362f523016885e6a10b7f9c06 to your computer and use it in GitHub Desktop.
---
- name: Test gcpweb Ansible role
hosts: webservers
gather_facts: yes
tasks:
# - name: List all ansible facts
# debug:
# msg: "{{ ansible_facts }}"
- name: Check if timezone is UTC
debug:
msg: Timezone is UTC
failed_when: ansible_facts['date_time']['tz'] != 'UTC'
- name: Check if processor vCPUs count is 1
debug:
msg: Processor vCPUs count is 1
failed_when: ansible_facts['processor_vcpus'] != 1
- name: Check if distribution is CentOS
debug:
msg: Distribution is CentOS
failed_when: ansible_facts['distribution'] != 'CentOS'
- name: Check if distribution major version is 7
debug:
msg: Distribution major version is 7
failed_when: ansible_facts['distribution_major_version'] != '7'
- name: Check if hostname contains 'web-'
debug:
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