Ansible Basics: Variables

Variables

There are a bunch of variables that ansible / Scale expects. You can create a file that is chock full of variables and call that specifically. The official documentation has all the available options. Here is an example of vars.yaml:

#vars global variables
scale_user: ansible  # user is created on hypercore and remaining tasks execute using this user 
scale_pass: YourAnsibleUserPasswords # be default ansible masks out what it think is passwords - so using simple password can conflict with VM names - etc.
scale_admin_user: admin # default scale admin
scale_admin_pass: admin # default scale admin pw
SC_AUTH_METHOD: local

cluster_configuration:
  name: Store{{ store_number }} # Your cluster naming convention
  registration:
    company_name: Fictituous Company Name # Your company name for cluster registration
    contact: Fictitious IT # Contact Name
    phone: 410-555-1212 # Contact Phone
    email: Alerts@fictcomp.com # Alert emails
  dns:
    server_ips: "{{ store_network }}.193" # DNS Server for the cluster- We can set the store network in the inventory!
    search_domains: [] 
  time_server: pool.ntp.org #  NTP Server - Make sure its routable with your DNS if FQDN
  time_zone: US/Eastern # Time zone
  smtp:
    auth_username: smtp@relayemail.com # SMTP Relay email
    auth_password: SecurePass$$Word # SMTP Relay emailpw
    server: smtp.office.com
    port: 587
    use_ssl: true
    from_address: smtp@relayemail.com # From address
  email_alerts:
    - Alerts@fictcomp.com # Email Address that you'd like to receive email alerts
    - PFM@scalecomputing.com # Super Secret beta monitoring

So thats that. Now, we haven’t declared {{ store_number }} or {{ store_network }} but we can do that in the inventory. Open up your production-inventory.yaml and add that stuff!

all:
  hosts:
    "001" :
        ansible_host: 10.2.1.98
        store_number: 001
        store_network: 10.2.1.
    "002" :
        ansible_host: 10.2.2.98
        store_number: 002
        store_network: 10.2.2.
    "003" :
        ansible_host: 10.2.3.98
        store_number: 003
        store_network: 10.2.3.
    "004" :
        ansible_host: 10.2.4.98
        store_number: 004
        store_network: 10.2.4.
    "005" :
        ansible_host: 10.2.5.98
        store_number: 005
        store_network: 10.2.5.