Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Save LetsCreatProjects/1aa0722282c75e15dc43b6f507af5119 to your computer and use it in GitHub Desktop.
Save LetsCreatProjects/1aa0722282c75e15dc43b6f507af5119 to your computer and use it in GitHub Desktop.
Ansible external variables
Create external var outside .yml file. Ansibel
1.create dir "ansibleExternVar"
sudo mkdir /etc/ansible/roles/ansibleExternVar
2. enter dir
cd /etc/ansible/roles/ansibleExternVar
2. Create 2 file
sudo nano hello_ansble_varsV4.yml
sudo nano varsV4
4. Insert in to "sudo nano hello_ansble_varsV4.yml" this code
---
- hosts: all
vars_files:
- varsV4
tasks:
- name: Print message
debug:
msg: "{{strPrint}}"
5. insiet in "varsV4" this code:
- strPrint: Hello Ansible World
6. Run this command
ansible-playbook hello_ansble_varsV4.yml --ask-pass
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment