Created
April 5, 2024 20:24
-
-
Save LetsCreatProjects/1aa0722282c75e15dc43b6f507af5119 to your computer and use it in GitHub Desktop.
Ansible external variables
This file contains hidden or 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
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